
// assumes that contentDiv has clip rect(0,290,260,0) and top 48px

var scrollSteps = 5000;
var scrollDist = 18;
var presentScroll = 0;
var scrollNum = 0;
var scrollDelay = 15;
var divHeight = 155;
var divClipTop = 0;
var timeoutVar;
var baseTop = 10;
var isFirstTime = 1;


function setVars(){
	if(isFirstTime){
		isFirstTime = 0;
		checkScroll();
		if (document.all){
			a = document.all.contentDiv;
			a.style.pixelTop = 10;
			a.style.clip = 'rect(0,559,155,0)';
			}
		else if(document.getElementById){
			a = document.getElementById("contentDiv");
			a.style.top = 10;
			a.style.clip = 'rect(0,559,155,0)';
			}
		if ( (navigator.appVersion.indexOf('Win') != -1) && !document.getElementById){
			scrollDist = 6;
			}
		else{
			if(document.getElementById){
				scrollDelay = 2;
				}
			else{
				scrollDelay = 5;
				}
			}
		}
	}


function checkScroll(){
	if(document.layers){
		w = window.document.layers["contentDiv"];
		endMark = w.document.layers["contentEndMark"].top;
		if(endMark > divHeight){
			window.document.layers.contentButtons.top = 180;
			}
		}
	else if(document.all){
		a = document.all.contentDiv;
		if(a.offsetHeight > divHeight){
			document.all.contentButtons.style.pixelTop = 180;
			}
		}
	else if(document.getElementById){
		a = document.getElementById("contentDiv");
		if(a.offsetHeight > divHeight){
			document.getElementById('contentButtons').style.top = 180;
			}
		}
	}
	

function scrollUp(){
	setVars();
	if(document.layers){
		w = window.document.layers["contentDiv"];
		if(divHeight < w.document.layers["contentEndMark"].top){
			w.top -= scrollDist;
			w.clip.top += scrollDist;
			w.clip.bottom += scrollDist;
			divHeight += scrollDist;
			}
		}
	else if(document.all){
		a = document.all.contentDiv;
		if(a.style.pixelTop > (a.offsetHeight * -1) + 158){
			a.style.pixelTop = a.style.pixelTop - scrollDist;
			divHeight += scrollDist;
			divClipTop += scrollDist;
			document.all.contentDiv.style.clip = 'rect(' + divClipTop + ',559,' + divHeight + ',0)';
			}
		}
	else if(document.getElementById){
		a = document.getElementById("contentDiv");
		if( (parseInt(a.style.top) > a.offsetHeight * -1) + 158){
			a.style.top = parseInt(a.style.top) - scrollDist + 'px';
			divHeight += scrollDist;
			divClipTop += scrollDist;
			a.style.clip = 'rect(' + divClipTop + ',579,' + divHeight + ',0)';
			}
		}
	timeoutVar = window.setTimeout("scrollUp()", scrollDelay);
	}


function scrollDown(){
	setVars();
	if(document.layers){
		w = window.document.layers["contentDiv"];
		if( w.top < baseTop){ 
			w.top += scrollDist;
			w.clip.top -= scrollDist;
			w.clip.bottom -= scrollDist;
			divHeight -= scrollDist;
			}
		else{
			w.top = baseTop;
			w.clip.top = 0;
			w.clip.bottom = 155;
			divHeight = 155;
			}
		}
	else if(document.all){
		a = document.all.contentDiv;
		if(a.style.pixelTop < baseTop){
			a.style.pixelTop = a.style.pixelTop + scrollDist;
			divHeight -= scrollDist;
			divClipTop -= scrollDist;
			document.all.contentDiv.style.clip = 'rect(' + divClipTop + ',579,' + divHeight + ',0)';
			}
		else{
			a.style.pixelTop = baseTop;
			a.style.clip = 'rect(0,579,155,0)';
			divHeight = 155;//260/
			}
		}
	else if(document.getElementById){
		a = document.getElementById("contentDiv");
		if(parseInt(a.style.top) < baseTop){
			a.style.top = parseInt(a.style.top) + scrollDist + 'px';
			divHeight -= scrollDist;
			divClipTop -= scrollDist;
			a.style.clip = 'rect(' + divClipTop +',579,' + divHeight + ',0)';
			}
		else{
			a.style.top = baseTop + 'px';
			a.style.clip = 'rect(0,579,155,0)';
			divHeight = 155;//260
			}
		}
	timeoutVar = window.setTimeout("scrollDown()", scrollDelay);
	}




function killscroll(){
	if(timeoutVar){
		window.clearTimeout(timeoutVar);
		}
	}


function nothing(){
	killscroll();
	}



