

defaultStep=0
step=defaultStep
timerInitial=0
function scrollDivInitial(id){
document.getElementById(id).scrollLeft+=step+1
timerInitial=setTimeout("scrollDivInitial('"+id+"')",60)
}

function scrollDivRight(id){
document.getElementById(id).scrollLeft+=step
timerRight=setTimeout("scrollDivRight('"+id+"')",1)
}

function scrollDivLeft(id){
document.getElementById(id).scrollLeft-=step
timerLeft=setTimeout("scrollDivLeft('"+id+"')",1)
}

function startScrollRight(id){
	clearTimeout(timerInitial);
  step+=1;
	scrollDivRight(id);
}

function startScrollLeft(id){
	clearTimeout(timerInitial);
  step+=1;
	scrollDivLeft(id);
}

function endScrollRight(id){
  clearTimeout(timerRight);
  step-=1;
  setCookie('position-'+id, document.getElementById(id).scrollLeft, 1)
}

function endScrollLeft(id){
  clearTimeout(timerLeft);
  step-=1;
  setCookie('position-'+id, document.getElementById(id).scrollLeft, 1)
}

function toRight(id){
document.getElementById(id).scrollLeft=document.getElementById(id).scrollWidth
}

function toLeft(id){
document.getElementById(id).scrollLeft=0
}

function loadPosition(id)
{
position=getCookie('position-'+id);
if ((position!=null) && (position!= ""))
  {
		document.getElementById(id).scrollLeft=position;
  }
	else
	{
		timerInitial=setTimeout("scrollDivInitial('"+id+"')",60);
	}

}

function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
var test=new Date();
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}
