var scrollb = new VScroll("scroller", "gotop", "godown", "scrollbarshadow", "scrollbarposition");

var thumbsanimation = Array();
function movebg(thediv, to, dir,firstime, boxheight)
{
	if(firstime==1)
	{
		theimage2 = thediv.style.backgroundImage;
		theimage2 = theimage2.replace("url(","");
		theimage2 = theimage2.replace("url('","");
		theimage2 = theimage2.replace(")","");
		theimage2 = theimage2.replace("')","");
		loadimage2 = new Image();
		loadimage2.src = theimage2;
		if(loadimage2.height > boxheight)
			thumbsanimation[thediv.id] = setTimeout(function(){movebg(thediv,to,1,0,boxheight)},400);
	}
	else
	{
	thediv.style.backgroundPosition = "0px -" + to + "px";
	
	theimage = thediv.style.backgroundImage;
	theimage = theimage.replace("url(","");
	theimage = theimage.replace("url('","");
	theimage = theimage.replace(")","");
	theimage = theimage.replace("')","");
	loadimage = new Image();
	loadimage.src = theimage;
	if(dir==1)
	{
		to=to+5;
		if(to>(loadimage.height-boxheight))
		{
			to=loadimage.height-boxheight-5;
			thumbsanimation[thediv.id] = setTimeout(function(){movebg(thediv,to,2,0,boxheight)},50);
		}
		else
			thumbsanimation[thediv.id] = setTimeout(function(){movebg(thediv,to,1,0,boxheight)},50);
	}
	else
	{
		to=to-5;
		if(to<=0)
		{
			to=5;
			thumbsanimation[thediv.id] = setTimeout(function(){movebg(thediv,to,1,0,boxheight)},50);
		}
		else
			thumbsanimation[thediv.id] = setTimeout(function(){movebg(thediv,to,2,0,boxheight)},50);
	}
	}
	
}

thumbs = document.getElementById("scroller").getElementsByTagName("ul")[0].getElementsByTagName("a");

for(x=0;x<thumbs.length;x++)
{
	thumbs[x].id = "thumb"+x;
	thumbs[x].onmouseover = function(){movebg(this, 0, 1, 1, 100)};
	thumbs[x].onmouseout = function(){clearTimeout(thumbsanimation[this.id]);this.style.backgroundPosition = "0px 0px";};
	thumbsbackground[x] = thumbs[x].getElementsByTagName("span")[0].title;
}
