//Content-Layer am unteren oder oberen Ende
var unten=false;
var oben=false;
var running;

//Steuerung fuer ScrollLayer mit den Scroll-Buttons
function run(dir){
	if(dir>0&&!unten){
	//alert("rundown");
		running=true;
		scrollLayer(dir,true);
		unten=false;
		oben=false;
	}
	
	if(dir<0&&!oben){
	//alert("runup");
		running=true;
		scrollLayer(dir,true);
		oben=false;
		unten=false;
	}
}
	
function stopScrolling(){
	
	running=false;
}

//Steuerung fuer ScrollLayer mit den Jump-Buttons
function jump(stepJ){
	
	if(stepJ>0){
	
		if(clipBottom<(dY-stepJ)){
		scrollLayer(stepJ,false);
		}
		else{
			newstep=(dY-clipBottom);
			scrollLayer(newstep,false);
			unten=true;
			oben=false;
		}
	}
	else{
		if(clipTop>-stepJ)scrollLayer(stepJ,false);
		else{
			newstep=scrollYC-contentTop;
			scrollLayer(newstep,false);
			unten=false;
			oben=true;
		}
	}
}

//Layer und clipping bewegen
function scrollLayer(step,scrolling){
	
	s=step;
	
	
	if(clipBottom<=dY-step){
	
		if(clipTop>=(-step)){
			scrollYC=scrollYC-step;
			clipTop=clipTop+step;
			clipBottom=clipBottom+step;
			pushTo("content",xContent,scrollYC)
			
			//clipping
			if(IE4 || IE5){
				scrollRef=eval("document.all.content.style");
				scrollRef.clip="rect("+clipTop+"px "+contentWidth+"px "+clipBottom+"px 0px)";
			}
			if(NN4){
				document.content.clip.top=clipTop;
				document.content.clip.bottom=clipBottom;
			}
			if(NN6){
				scrollRef=eval('document.getElementById("content").style');
				scrollRef.clip="rect("+clipTop+"px "+contentWidth+"px "+clipBottom+"px 0px)";
			}
			
			
			//alert(scrollYC);
			if(running&&scrolling)setTimeout('scrollLayer(s,true)',100);
		}
		else{
			oben=true;
			scrollLayer(-clipTop,false);
			clipTop=0;
			
		}
	}
	else{
		unten=true;
		scrollLayer((dY-clipBottom),false);
	}
}
