/**
 * @author harald.wittmann / former 03
 */

window.onload = function(){
	checkHeight(600);	
}

window.onresize = function(){
	checkHeight(600);
}

function checkHeight(maxHeight){
	var mov = getFlashMovieObject("saeule");
	if(window.innerHeight < maxHeight){
		mov.style.height = maxHeight +"px";
	}else if(window.innerHeight == undefined){ // IE
		if(document.body.clientHeight < maxHeight){ // +20 wegen Rahmen
			mov.style.height = maxHeight +"px";
		}else{
			mov.style.height = "";
		}
	}else{
		mov.style.height = "";
	}
}

function getFlashMovieObject(movieName){
	if(window.document[movieName]){
		return window.document[movieName];
	}
	if(navigator.appName.indexOf("Microsoft Internet")==-1){
		if(document.embeds && document.embeds[movieName])
			return document.embeds[movieName];
	}else{ // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
		return document.getElementById(movieName);
	}
}

function openGuestbook(){
	var gb = document.getElementById("gbuch");
	var mov = getFlashMovieObject("saeule");

	gb.style.display = "block";
	if(navigator.appName == "Microsoft Internet Explorer"){
		gb.style.position = "absolute"; // "absolute";
	}
	gb.style.width = 600;
	gb.style.left = "50%";
	gb.style.marginLeft = "-300px";

	gb.style.height = 585;
	gb.style.top = "50%";
	gb.style.marginTop = "-240px";
	
	if(mov.style.height != ""){
		gb.style.top = "0px";
		gb.style.marginTop = "70px";
		gb.style.height = (window.innerHeight - 70) +"px";
	}
}

function closeGuestbook(){
	var gb = document.getElementById("gbuch");
	document.getElementById("gbuch").style.display = "none";
}

function openGMaps(){
	var gm = document.getElementById("gmaps");
	var mov = getFlashMovieObject("saeule");

	gm.style.position = "fixed";
	gm.style.visibility = "visible";
	gm.style.display = "block";
	if(navigator.appName == "Microsoft Internet Explorer"){
		gm.style.position = "absolute"; // "absolute";
	}
	gm.style.width = 780;
	gm.style.left = "50%";
	gm.style.marginLeft = "-390px";

	gm.style.height = 551;
	gm.style.top = "50%";
	gm.style.marginTop = "-240px";
	
	if(mov.style.height != ""){
		gm.style.top = "0px";
		gm.style.marginTop = "70px";
		gm.style.height = (window.innerHeight - 70) +"px";
	}
}

function closeGMaps(){
	var gm = document.getElementById("gmaps");
	gm.style.display = "none";
/*	gm.style.position = "absolute";
	gm.style.visibility = "hidden";
	gm.style.top = 0;
	gm.style.left = 0;
	gm.style.height = 0;
	gm.style.width = 0;
	gm.style.marginLeft = 0;
	gm.style.marginTop = 0;*/
}
