// JavaScript Document

isIE = false;

window.onresize = Function("document.location.reload()");

if(document.all && !window.opera){

	isIE = true;

}



function init(){

	if(isIE){

		untenH = document.all.unten.clientHeight;
		obenH = document.all.rechts_oben.clientHeight;
		bodyH = document.all.bb.clientHeight;
		diffH = Math.ceil(bodyH/100 * 7);
		
		if(untenH + obenH + diffH > bodyH){
			
			document.all.rechts_oben.style.height = (bodyH - untenH - 40) + "px";
			
		}	
		
			
	}

	nua=navigator.userAgent;
	saf=(nua.indexOf('Safari')!=-1);
	if (saf)
	{
		ver = nua.substr(nua.indexOf('Version') + 8, 5); 
		
		if(parseInt(ver.charAt(0)) < 3){
			
			//untenH = document.getElementById("unten").clientHeight;
			robenH = document.getElementById("rechts_oben").scrollHeight;
			obenH = document.getElementById("oben").clientHeight
			
			
			if(robenH > obenH){
				document.getElementById("rechts_oben").style.height = (obenH - 40) + "px";
			}
			
		}
		
	}
	
	if(document.layers) return;
	con = document.getElementById("bilddiv");
	
	bilder = con.getElementsByTagName("img");
	
	for(i = 0; i < bilder.length; i++){
	
		bilder[i].onclick = showBig;
		
	}
		
}

function showBig(){

	oWidth = (this.width > 120) ? 450 : 225;

	oHeight = "380";

	oDiv = document.createElement("div");
	oImg = document.createElement("img");
	oP = document.createElement("p");
	
	oDiv.style.backgroundColor = "#666666";
	oP.style.color = "#FFFFFF";
	oP.innerHTML = this.alt;
	oP.style.textAlign = "center";
	oP.style.fontSize = "12px";
	oDiv.appendChild(oP);
	oDiv.style.position = "absolute";
	oDiv.style.width = oWidth + "px";
	oDiv.style.height = oHeight + "px";
	oDiv.style.zIndex = 10;
	oDiv.style.left = (windowWidth() - oWidth) / 2  + "px";
	oDiv.style.top = (windowHeight() - oHeight) / 2 + "px";
	oDiv.zIndex = 10;
	oDiv.appendChild(oImg);
	oImg.src = this.src.replace("150", "300");
	document.getElementById("bb").appendChild(oDiv);
	oDiv.style.textAlign = "center";
	oDiv.onclick = removeDiv;
	document.getElementById("bb").remLay = oDiv;
	document.getElementById("bb").onmousedown = removeLayer;
	
}

function removeDiv(){
		document.getElementById("bb").onmousedown = null;
		document.getElementById("bb").removeChild(this);
	
}

function removeLayer(){

	this.removeChild(this.remLay);
	this.onmousedown = null;
	
}

function windowWidth(){

	if (self.innerHeight){// all except Explorer
		
		wW = self.innerWidth;
				
	}
	else if (document.documentElement && document.documentElement.clientHeight){// Explorer 6 Strict Mode
		
		wW = document.documentElement.clientWidth;
		
	}
	else if (document.body){// other Explorers
		
		wW = document.body.clientWidth;
		
	}
	
	return wW;
	
}	

function windowHeight(){

	if (self.innerHeight){// all except Explorer
		
		wH = self.innerHeight;
				
	}
	else if (document.documentElement && document.documentElement.clientHeight){// Explorer 6 Strict Mode
		
		wH = document.documentElement.clientHeight;
		
	}
	else if (document.body){// other Explorers
		
		wH = document.body.clientHeight;
		
	}
	
	return wH;
	
}	
	



