var geschwindigkeit = 15, faktor = 3;
var textboxHeight = 320, textboxWidth = 970;
var rand = 5;

var timer = 0, richtung = 0;
var textOffset = rand, textTop = 369;

var textHeight = 680;
function getTextboxSize(){
	if (document.getElementById("text_box").height){ textHeight = document.getElementById("text_box").height + rand; }
	var clipBottom = textboxHeight - textOffset;
	document.getElementById("text_box").style.clip = "rect(-" + rand + "px " + textboxWidth + "px " + clipBottom + "px 0px)";
}

function startScroll(richtungStart, aktiv){
	window.clearInterval(timer);
	if (aktiv){
		richtung = richtungStart * faktor;
		timer = window.setInterval("scrollText()", geschwindigkeit);
	}
}

function scrollText(){
	if (textOffset >= textboxHeight - textHeight - richtung && textOffset <= - richtung + rand){
		textOffset += richtung;
		var clipTop = - textOffset;
		var clipBottom = textboxHeight - textOffset;

		document.getElementById("text_box").style.top = textTop + textOffset;
		document.getElementById("text_box").style.clip = "rect(" + clipTop + "px " + textboxWidth + "px " + clipBottom + "px 0px)";
	} else {
		window.clearInterval(timer);
	}
}
