var animations = [];
var count = 0;

function showMessage(msg)
{
	var msg = msg || "Geen bericht";
	
	var div = document.createElement("DIV");
	div.setAttribute("class", "message");
	
	var text = document.createElement("DIV");
	text.innerHTML = msg;
	
	div.appendChild(text);
	
	document.body.appendChild(div);
	
	animations.push(new Animation({
		from: -30,
		to: 0,
		tweenType: "default",
		onTween: function(value)
		{
			dropDown(div, value);
		},
		onComplete: function()
		{
			setTimeout(nextAnimation, 3500);
		}
	}));
	
	animations.push(new Animation({
		from: 0,
		to: -30,
		tweenType: "default",
		onTween: function(value)
		{
			pullUp(div, value);
		},
		onComplete: function()
		{
			document.body.removeChild(div);
		}
	}));
	animations[count].start();
}

function nextAnimation()
{
	count++;
	animations[count].start();
}

function pullUp(target, value)
{
	target.style.top = value + "px";
}

function dropDown(target, value)
{
	target.style.top = value + "px";
}
