xTarget = 0;

function InitStartPage ()
{
	setNextDiv();
	next ();
}

function setNextDiv()
{
//	if (current!=-1)
//	{
		if (current<div_array.length-1)
		{
			current++;
		}
		else
		{
			current=0;
		}
//	}
//	else
//	{	
//		current = Math.floor(Math.random()*div_array.length);
//	}
}

function next ()
{
	obj = document.getElementById(div_array[current]);
	obj.style.display = "block";
	obj.style.zIndex = zindex++;
	x=650;
	move(obj);
}

function move(obj) 
{
	var xDiff = xTarget - x;
	x += xDiff/4;
	obj.style.left = x + "px";
	if (Math.round(xDiff) == 0) 
	{
		window.clearTimeout(move_timeout);
		move_timeout = null;
		if (div_array.length>1)
		{
			setNextDiv();
			window.setTimeout ("next ();", 5000);
		}
	} else {
		move_timeout = window.setTimeout("move(obj);",25);
	}
}
