// JavaScript Document

/*
		#---------------------------#
		#		Fenstergrössen		#
		#---------------------------#
*/

function Fensterweite () {
  if (window.innerWidth) {
    return window.innerWidth;
  } else if (document.body && document.body.offsetWidth) {
    return document.body.offsetWidth;
  } else {
    return 0;
  }
}

function Fensterhoehe () {
  if (window.innerHeight) {
    return window.innerHeight;
  } else if (document.body && document.body.offsetHeight) {
    return document.body.offsetHeight;
  } else {
    return 0;
  }
}

function neuAufbau () {
  if (Weite != Fensterweite() || Hoehe != Fensterhoehe())
    location.href = location.href;
}

/* Überwachung von Netscape initialisieren */
if (!window.Weite && window.innerWidth) {
	window.onresize = neuAufbau;

	Weite = Fensterweite();
	Hoehe = Fensterhoehe();
}

// --- Fenstergröße

//wird bei body onload initialisiert
function Start() {
	
	//Browserinfos
	var spitzname = navigator.appCodeName;
	var name = navigator.appName;
	var version = navigator.appVersion;
  	var sprache = navigator.language;
	if (navigator.appName == "Microsoft Internet Explorer") {
 		var sprache = navigator.browserLanguage;
	}
	var platform = navigator.platform;
	var agent = navigator.userAgent;
	var java = navigator.javaEnabled();
		
/*		var myBrowser = document.createTextNode(name+" ("+spitzname+") "+sprache+agent);
		var Ausgabebereich = document.getElementById("browserInfo");
		Ausgabebereich.appendChild(myBrowser);
*/

	if (agent.indexOf("Internet Explorer") != -1) {
		compatible = 0;
	} else if (agent.indexOf("MSIE") != -1) {
		compatible = 0;
	} else if (agent.indexOf("Firefox") != -1) {
		compatible = 1;
	} else if (agent.indexOf("Safari") != -1) {
		compatible = 0;
	} else if (agent.indexOf("Opera") != -1) {
		compatible = 0;
	} else if (agent.indexOf("Netscape") != -1) {
		compatible = 1;
	}

	//positionieren
	positionMain();
	
}

function positionMain() {
	document.getElementById("main").style.left = ((Weite - 1020) / 2) + "px";
	document.getElementById("main").style.top = ((Hoehe - 650) / 2) + "px";
	document.getElementById("Unterzeile").style.left = ((Weite - 1020) / 2) + "px";
	document.getElementById("Unterzeile").style.top = (((Hoehe - 650) / 2) + 610) + "px";
}

/*
		#-----------------------------------#
		#		Fenstergrössen - ENDE		#
		#-----------------------------------#
*/


function ButtonSize(Name, Nr) {
	document.getElementById(Name).style.right = (90 * Nr) + "px";
}


//Baustelle laden
function loadBaustelle(SID) {
	//Baustellen Startseite
	document.getElementById("MainFrame").src = "sites/baustelle.php?" + SID + "&";
}

function loadSite(Name, SID) {
	document.getElementById("MainFrame").src = "sites/" + Name + "?" + SID + "&";
}