/* Objekt-Abfrage zur Browserdifferenzierung */

function objekt(name) {
	if (document.getElementById) {
		this.obj = document.getElementById(name);
		this.style = document.getElementById(name).style;
  }
	else if (document.all) {
		this.obj = document.all[name];
		this.style = document.all[name].style;
	}
	else if (document.layers) {
		this.obj = document.layers[name];
		this.style = document.layers[name];
	}
}

/* Scrollen */

var position;
var scrollinhalt;
var texthoehe;
var zeilenhoehe;
var schleife;

function init(layer,layerinhalt) {
	position = new objekt(layer);
	scrollinhalt = new objekt(layerinhalt);
	texthoehe = (-scrollinhalt.obj.offsetHeight+parseInt(position.style.height)+"px");
	zeilenhoehe = parseInt(scrollinhalt.style.lineHeight);
	if (parseInt(texthoehe) < 0) {
		var pfeilezeigen = new objekt("pfeilhoch");
		pfeilezeigen.style.visibility = "visible";
		var pfeilezeigen = new objekt("pfeilrunter");
		pfeilezeigen.style.visibility = "visible";
	}
}

function scrollen(wohin) {
	if (wohin == "anfang") {
		scrollinhalt.style.top = "0px";
	}
	if (wohin == "hoch") {
		tausch("pfeil_runter","");
		hoch();
	}
	if (wohin == "runter") {
		tausch("pfeil_hoch","");
		runter();
	}
	if (wohin == "ende") {
		scrollinhalt.style.top = texthoehe;
	}
}

function hoch() {
	if (parseInt(scrollinhalt.style.top) < 0) {
		scrollinhalt.style.top = (parseInt(scrollinhalt.style.top)+zeilenhoehe+"px");
		schleife = setTimeout("hoch()",100);
	}
	if (parseInt(scrollinhalt.style.top) >= 0) {
		clearTimeout(schleife);
		tausch("pfeil_hoch","_anfang");
	}
}

function runter() {
	if (parseInt(scrollinhalt.style.top) > parseInt(texthoehe)) {
		scrollinhalt.style.top = (parseInt(scrollinhalt.style.top)-zeilenhoehe+"px");
		schleife = setTimeout("runter()",100);
	}
	if (parseInt(scrollinhalt.style.top) <= parseInt(texthoehe)) {
		clearTimeout(schleife);
		tausch("pfeil_runter","_ende");
	}
}

/* Bilder vorladen */

function bilderladen()
{ 
  var args = bilderladen.arguments;
  document.imageArray = new Array(args.length);
  for(var i=0; i<args.length; i++)
  {
    document.imageArray[i] = new Image;
    document.imageArray[i].src = args[i];
  }
}

/* Bilder austauschen */

function tausch(bild,status) {
	var wechsel = new objekt(bild);
	wechsel.obj.src = ("navigation/"+bild+status+".gif");
}