window.onload=init;

var d=document;
var lContainer;

var currentTop=0;
var zInterval = null;
var direction;
var startTop=0;

var scrollRate=1;
var scrollTick=0;


var MAX_LIST_HEIGHT=540;
var MIN_LIST_HEIGHT=540;

function init() {
	if(!d.getElementById)return;

	up=d.getElementById("upArrow");
	down=d.getElementById("downArrow");

	down.onclick=function(){scrollObjects(0);}
	up.onclick=function(){scrollObjects(1);}

	lContainer = d.getElementById("thumbs");

	d.getElementById("thumbcontainer").style.height=MIN_LIST_HEIGHT+"px";
}

function scrollObjects(dir) {
	if(zInterval)return;
	// Wenn öfter gescrollt werden soll, hier anpassen
	// 420 = 3x Scrollen (1x Scrollen = +140)
	if((!dir && currentTop<=-420) || (dir && currentTop==0))return;
	direction=dir;
	zInterval=setInterval("animate()",20);
}

function animate() {
	if(!direction) {
		currentTop-=140;
	} else {
		currentTop+=140;
	}
	scrollTick++;
	lContainer.style.top=currentTop+"px";
	clearInterval(zInterval);
	zInterval=null;
	startTop=currentTop;
	scrollTick=0;
	scrollRate=1;
}
