//Internet Professionell 9/2001 - Anja Weinstein

function zeigen(id){

		if(document.getElementById) {
			document.getElementById(id).style.display = 'block';
		}else if(document.all){
			document.all[id].style.display = 'block';
		}else{
			document.layers[id].display = 'block';
		}
	
}

function verstecken(id){

		if (document.getElementById){
			document.getElementById(id).style.display = 'none';
		}else if (document.all){
			document.all[id].style.display = 'none';
		}else{
			document.layers[id].display = 'none';
		}
	
}

function BrowserCheck() {

this.browser = "inkompatibel";

if(document.layers) {
	this.ebene = 'document["dhtmlebene"]';
	this.bild = this.ebene + '.document.images[0]';
	this.browser = "nn4";
	}

else if (document.getElementById) {
	this.ebene = 'document.getElementById("dhtmlebene").style';
	this.bild = 'document.getElementById("dhtmlbild")'; 
	this.browser = "ns6";
	}

if(document.all && document.styleSheets) {
	this.ebene = 'document.all["dhtmlebene"].style';
	this.bild = 'document.all["dhtmlbild"]';
	this.browser = "ie";
	}
	this.ausgangX = 0;
	this.ausgangY = 0;

}

var move = new BrowserCheck();


function LadeBilder() {
	if(move.browser != "inkompatibel"){
	dhtml = new Array();
	for(i=1; i<5; i++) {
		n = dhtml.length;
		dhtml[n] = new Image();
		dhtml[n].src = "img/butterfly"+i+".gif";
		}
	EbenePositionieren();
}
}

function zentrieren(){
	if(move.browser != "inkompatibel"){
		breite=(move.browser == "ie") ? document.body.clientWidth : innerWidth;
		hoehe=(move.browser == "ie") ? document.body.clientHeight : innerHeight;
		if (breite>1024) {

			var x_left = (breite-1024)/2;
			document.getElementById('zentriert').style.left = x_left;
		} else {
			document.getElementById('rechts').style.position = "absolute";
			document.getElementById('rechts').style.left = "772px";
		}
		if (hoehe > 642){
			var y_top = (hoehe - 642);

			document.getElementById('zentriert').style.top = y_top;
			document.getElementById('logo').style.top = 40-(y_top-40);
		}
	}
}		

function EbenePositionieren(){
	if(move.browser != "inkompatibel"){
	breite=(move.browser == "ie") ? document.body.clientWidth : innerWidth;
	hoehe=(move.browser == "ie") ? document.body.clientHeight : innerHeight;
	//alert (hoehe);
	//alert(breite);
	EbeneBeginn = eval(move.ebene);

	move.ausgangX=(breite>600) ? (Math.max(0.25 * breite,150) + ((Math.max(0.45*breite,408) - 488)/2)) : 150;
	move.ausgangY=(hoehe>800) ? (Math.max(0.25 * hoehe,468) + ((Math.max(0.45*hoehe,468) - 488)/2)) : 150;
	
	move.ausgangX -= 300;
	move.ausgangY -= 100;
	//alert (move.ausgangX);
	//alert (move.ausgangY);

	EbeneBeginn.left = (move.ausgangX);
	EbeneBeginn.top = (move.ausgangY);
	

	EbeneBeginn.visibility = "visible";

	move.Xe = new Array(0,1,2,3,4,5,6,7,8,7,6,5,4,3,2,1,0,-1,0,1,2,3,4,5,6,7,8);
	move.Ys = new Array(move.Xe.length);
	move.Ys[0] = move.ausgangY;
	//alert(move.Ys[0]);
	for(i=1; i<move.Xe.length; i++) {
	// top des objektes (hoehe-move.ausgangY-180)
		if (breite> 1024){
		move.Ys[i] = move.Ys[i-1] + ((hoehe-move.ausgangY-180)/move.Ys.length);
		} else {
		move.Ys[i] = move.Ys[i-1] + ((hoehe-move.ausgangY-80)/move.Ys.length);
		}
		//alert(move.Ys[i])
	}
	move.verzoegerung = 2000/move.Xe.length;
	move.zaehler2 = 0;
	move.richtung = 1;
	move.aktuell = 0;
	Verschieben();
}
}

function Verschieben() {
	if(move.zaehler2 < move.Xe.length) {
	//left des objektes (breite-move.ausgangX-320)
	if (breite> 1024){
		EbeneBeginn.left = move.ausgangX+(move.Xe[move.zaehler2]*((breite-move.ausgangX-320)/10));
	} else {
		EbeneBeginn.left = move.ausgangX+(move.Xe[move.zaehler2]*((breite-move.ausgangX-180)/10));
		}
		EbeneBeginn.top = move.Ys[move.zaehler2];
		//alert(EbeneBeginn.left);
		//alert(EbeneBeginn.top);
		if(move.zaehler2 == move.Xe.length-1) {
			bewegtbild = eval(move.bild);
			bewegtbild.src = dhtml[dhtml.length-1].src;
		}
		else if(move.Xe[move.zaehler2+1]-move.Xe[move.zaehler2] != move.richtung) {
			bewegtbild = eval(move.bild);
			bewegtbild.src = dhtml[++move.aktuell].src;
			move.richtung = move.richtung * -1;
		}
		move.zaehler2++;
		setTimeout("Verschieben()",move.verzoegerung);
	}
	else {
		setTimeout('EbeneBeginn.visibility = "hidden"',1000);
	}
}

