var timerID;
var scrollDir=0;
var scrollSpeed=50/30;


function smallScroll(pCurrent, pControlId) {
	var tmp=document.getElementById(pControlId).style.top
	if (tmp.indexOf('px')>0)
		tmp=tmp.substr(0,tmp.length-2);
		
	tmp-=scrollSpeed*scrollDir;

	if (tmp <= pCurrent - 100) {
		if (timerIDsmall != null) clearTimeout(timerIDsmall);
//		document.getElementById(pControlId).style.top = pCurrent - 100;
	}
	else {
		document.getElementById(pControlId).style.top = tmp;
		timerIDsmall = setTimeout("smallScroll(" + pCurrent + ", '" + pControlId + "')", 100);
	}
}

function scrollIt(pControlId){
	var tmp=document.getElementById(pControlId).style.top
	if (tmp.indexOf('px')>0)
		tmp=tmp.substr(0,tmp.length-2);
		
	var m=document.getElementById(pControlId).offsetHeight;
//	alert(m);
	if(tmp<=-(m-100)) {tmp = 100;}
	
	
	document.getElementById(pControlId).style.top = tmp;
	smallScroll(tmp, pControlId);
	
	timerID = setTimeout("scrollIt('" + pControlId + "')", 5000);

}

function scrollStart(Dir, pControlId){
	scrollDir=Dir;
	scrollIt(pControlId);
}

function scrollStop(){
	if (timerID != null) clearTimeout(timerID);
}

function init() {
	scrollStart(1, 'pagdata');
}

