// JavaScript Document

window.onload = delay;

var Timer;
var innerwidth;
var outerwidth;
var direction = "right";

function delay()
{
	clearInterval(Timer);
	setTimeout(doslidein, 5000);
}
var num = 0;

function doslidein()
{
	num=num+1;
	element = document.getElementById('outer');
	startheight = 60;
	endheight = 1;
	if (element.slide)
	{
		window.clearInterval(element.slide);
	}
	element.slide = window.setInterval(
		function()
		{
			startheight = startheight-1;
			element.style.top = startheight + "px";
			if(startheight < endheight)
			{
				element.style.top = endheight + "px";
				window.clearInterval(element.slide);
			}
		}
	, 1);
	setTimeout(doslideout, 5000);
}



function doslideout()
{
	
	element = document.getElementById('outer');
	startheight = 1;
	endheight = 60;
	if (element.slide)
	{
		window.clearInterval(element.slide);
	}
	element.slide = window.setInterval(
		function()
		{
			startheight = startheight+1;
			element.style.top = startheight + "px";
			if(startheight >= endheight)
			{
				element.style.top = endheight + "px";
				window.clearInterval(element.slide);
			}
		}
	, 1);
	if(num < 2)
	{
	setTimeout(doslidein, 5000);
	}
}