
function scrollto(nr,cat)
{
	z = nr;
	c = cat;
	y = document.getElementById(c).style.top;
	y = y.replace('px','');
	x = Number(y);
	xbun = (1-nr)*450;
	if(x>xbun)
	{
		if(x<(xbun+65))
		{
			x=x-1;
		}
		else if(x>(xbun+450))
		{
			x=x-75;
		}
		else
		{
			x=x-25;
		}
		document.getElementById(c).style.top=x+"px";
		t=setTimeout("scrollto(z,c)",1);
	}
	if(x<xbun)
	{
		if(x>(xbun-65))
		{
			x=x+1;
		}
		else if(x<(xbun-450))
		{
			x=x+75;
		}
		else
		{
			x=x+25;
		}
		document.getElementById(c).style.top=x+"px";
		t=setTimeout("scrollto(z,c)",1);
	}
	
}
timing = 50;
pas = 1;
topnou = 0;
function playCan(directie)
{
	obj = document.getElementById('canul');
	topul = obj.offsetTop;
	if(directie == 'jos')
	{
		topnou = topul+pas;
		obj.style.top = topnou + "px";
		if(topul < 45)
		{
			setTimeout ( "playCan('jos')", timing );
		}		
		else
		{
			setTimeout ( "playCan('sus')", timing );
		}
	}
	else
	{	
		topnou = topul-pas;
		obj.style.top = topnou + "px"
		if(topul > 0)
		{
			setTimeout ( "playCan('sus')", timing );
		}
		else
		{
			setTimeout ( "playCan('jos')", timing );
		}
	}
}

function canUp()
{
	obj = document.getElementById('canul');
	topul = obj.offsetTop;
	topnou = topul-1;
	obj.style.top = topnou + "px"
	if(topul > 0)
	{
		setTimeout ( "canUp()", 50 );
	}
}
function canDown()
{
	obj = document.getElementById('canul');
	topul = obj.offsetTop;
	topnou = topul+1;
	obj.style.top = topnou + "px"
	if(topul < 45)
	{
		setTimeout ( "canDown()", 50 );
	}
}

function rollGal(nr,max)
{
	z = nr;
	y = document.getElementById('listgal').style.top;
	y = y.replace('px','');
	x = Number(y);
	xbun = (nr)*150;
	if(x>xbun)
	{
		if(x<(xbun+20))
		{
			x=x-1;
		}
		else
		{
			x=x-10;
		}
		
		if(x < max){x = max;}
		document.getElementById('listgal').style.top=x+"px";
		t=setTimeout("rollGal(z)",1);
	}
	if(x<xbun)
	{
		if(x>(xbun-20))
		{
			x=x+1;
		}
		else
		{
			x=x+10;
		}
		
		if(x > 0){x = 0;}
		document.getElementById('listgal').style.top=x+"px";
		t=setTimeout("rollGal(z)",1);
	}	
}

function scrollGal(directie)
{
	obj = document.getElementById('listgal');
	topul = obj.offsetTop;
	heightul = obj.offsetHeight;
	max = 317 - heightul;
	if(directie == "up")
	{
		if(topul < 0)
		{
			topnou = topul+150;
			nr = topnou/150;
			rollGal(nr,max);
		}
	}
	else
	{
		if((Math.abs(topul)+317)< heightul)
		{
			topnou = topul-150;
			nr = topnou/150;
			rollGal(nr,max);
		}
	}
}

