// JavaScript Document

var timeout=30;
var expdate = new Date (); // pre-set to the current time and date
expdate.setTime(expdate.getTime() + 1000 * 60 * 60 * 1);

function ControlSilder(dr)
{
	if(dr=='up')
	{
		moveUp('0');
		setCookie("tslider","-330",expdate);
	}
	else if(dr=='down')
	{
		moveDown('-330');
		setCookie("tslider","0",expdate);
	}
}

function moveDown(pos)
{
	if(pos<0){
		pos=parseInt(pos)+30;
		 setTimeout("moveDown("+pos+ ")",timeout);
		 moveSilder(pos);
	}
}

function moveSilder(pos)
{
	
	document.getElementById("sliderPanel").style.top=pos+"px";
	
}

function moveUp(pos)
{
	if(pos>-330){
		pos=parseInt(pos)-30;
		 setTimeout("moveUp("+pos+ ")",timeout);
		 moveSilder(pos);
	}
}


function setCookie(name, value, expires)

{

	// no expiration date specified? use this date and it will just be deleted soon.

        if (!expires) expires = new Date(); 

	document.cookie = name + "=" + escape(value) + "; expires=" + expires.toGMTString() + "; path=/";

}

function getCookie(name)

{

	var cookies = document.cookie;

	if (cookies.indexOf(name) != -1)

	{

		var startpos = cookies.indexOf(name)+name.length+1;

		var endpos = cookies.indexOf(";",startpos)-1;

		if (endpos == -2) endpos = cookies.length;

		return unescape(cookies.substring(startpos,endpos));

	}

	else

	{

		return null; // the cookie couldn't be found! it was never set before, or it expired.

	}

}



function InitSilder(){
	/*alert("xxxx");*/
	var topValue=getCookie('tslider');
	if(topValue!=null)
	{
		document.getElementById("sliderPanel").style.top=parseInt(topValue)+"px";
	}

}

/*function InitSilder(pos){
	//alert(pos);
		document.getElementById("sliderPanel").style.top=parseInt(pos)+"px";

}*/

