function Fensterweite() {
	var x;
	if (self.innerHeight) // all except Explorer
	{ x = self.innerWidth; } else if (document.documentElement && document.documentElement.clientHeight)
	// Explorer 6 Strict Mode
	{ x = document.documentElement.clientWidth; } else if (document.body) // other Explorers
	{ x = document.body.clientWidth; }
	return x;
}

function Fensterhoehe() {
	var y;
	if (self.innerHeight) // all except Explorer
	{ y = self.innerHeight; } else if (document.documentElement && document.documentElement.clientHeight)
	// Explorer 6 Strict Mode
	{ y = document.documentElement.clientHeight; } else if (document.body) // other Explorers
	{ y = document.body.clientHeight; }
	return y;
}

function neuAufbau() {
	blSeiteGeladen = false;
	
	// GRÖSSE WIRD BERECHNET:
	var Haupt = document.getElementById("Haupt");
	var Links = document.getElementById("Links");
	var Adresse = document.getElementById("Adresse");
	if ( document.getElementById("flash_content") ) {
		var flash_content = document.getElementById("flash_content");
	} else {
		var flash_content = false;
	}
	
	var Rechts = document.getElementById("Rechts");
	var Navi3 = document.getElementById("Navi_3");
	var Beschreibung_Inhalte = document.getElementById("Beschreibung_Inhalte");
	var Merkliste = document.getElementById("Merkliste");
	
	// EIGENSCHAFTEN WERDEN NUR GELESEN:
	var Oben = document.getElementById("Oben");
	
	if ( Firefox_erkennen() ) {
		Weite = document.body.clientWidth; // Global
	} else {
		Weite = Fensterweite(); // Global
	}
	Hoehe = Fensterhoehe();
	
	// Diese 2 Zeilen sind notwendig, um die Anfangswerte zu überschreiben:
	Haupt.style.position = "absolute";
	Haupt.style.margin = "0";
	
	Haupt.style.width = "auto";
	Haupt.style.height = "auto";
	if ( flash_content !== false ) {
		flash_content.style.height = "auto";
	}
	if ( Merkliste != null ) {
		// Wenn die Seite noch nicht fertig geladen ist und man im form#Merkliste ein Element anklickt, kann es zu einer Fehlermedlung kommen, deshalb wird das Formular erst hier eingeblendet:
		Merkliste.style.visibility = "visible";
	}
	Beschreibung_Inhalte.style.height = "auto";
	Links.style.height = "auto";
	
	/*
	// Hier wird die Mindesthöhe ermittelt, die der Viewport haben muss, damit linke Navi und Flash mit Preisen darunter sichtbar sind:
	if ( !skaliert ) {
		if ( flash_content !== false ) {
			//var HoeheBildbrowser = flash_content.offsetHeight;
			var HoeheBildbrowser = 475;
		} else {
			var HoeheBildbrowser = 475;
		}
		if ( document.getElementById("Merkliste") != null ) {
			var HoeheMerkliste = document.getElementById("Merkliste").offsetHeight + 60;
		} else {
			var HoeheMerkliste = 60;
		}
		var HoeheMitte = HoeheBildbrowser + HoeheMerkliste + HoeheMitteOben + Oben.offsetHeight;
		var HoeheNavi = Links.offsetHeight + Oben.offsetHeight + 2;
		HoeheMin = Math.max(HoeheMitte, HoeheNavi) + 20;
	}
	*/
	
	var HoeheMitteOben = 70;
	var HoeheMin = 900;
	//var HoeheMin = 880;
	var BreiteMin = 1024;
	var Breite19Zoll = 1024;
	//var Breite19Zoll = 1280;
	var Breite17Zoll = 1024;
	var Hoehe17Zoll = 768;
	var Hoehe19Zoll = 768;
	//var Hoehe19Zoll = 1024;
	Hoehe19Zoll = Math.max( Hoehe19Zoll, HoeheMin );
	if ( Hoehe > Hoehe19Zoll ) {
		var Abstand = Math.floor((Hoehe - Hoehe19Zoll) / 2);
		if ( Abstand > 40 ) {
			Abstand = 40;
		}
	}
	Rechts.style.top = HoeheMitteOben + 100 + "px";
	
	// Wenn Bildschirm > 19"
	if ( Weite > Breite19Zoll ) {
		Haupt.style.overflow = "hidden";
		Haupt.style.left = (Weite - Breite19Zoll) / 2 + "px";
		Haupt.style.width = Breite19Zoll - 2 + "px";
	} else {
		Haupt.style.left = "0";
		// Wenn Bildschirm > 17"
		if ( Weite > Breite17Zoll ) {
			Haupt.style.overflow = "hidden";
			Haupt.style.width = Weite - 2 + "px";
		} else {
			// Wenn Bildschirm < 17"
			if ( Weite > BreiteMin ) {
				Haupt.style.overflow = "hidden";
				Haupt.style.width = Weite - 2 + "px";
			}
		}
	}
	
	// Wenn Bildschirm > 19"
	if ( Hoehe > Hoehe19Zoll ) {
		Haupt.style.overflow = "hidden";
		var HauptHoehe = Hoehe - (Abstand * 2) - 2;
		Haupt.style.top = Abstand + "px";
		Haupt.style.height = HauptHoehe + "px";
		Rechts.style.height = HauptHoehe - Oben.offsetHeight - HoeheMitteOben + "px";
		Beschreibung_Inhalte.style.height = Haupt.offsetHeight - Oben.offsetHeight - 104 + "px";
	} else {
		Haupt.style.top = 0 + "px";
		// Wenn Bildschirm > 17"
		if ( Hoehe > Hoehe17Zoll && Hoehe > HoeheMin ) {
			Haupt.style.overflow = "hidden";
			var HauptHoehe = Hoehe - 2;
			Haupt.style.height = HauptHoehe + "px";
			Rechts.style.height = HauptHoehe - Oben.offsetHeight - HoeheMitteOben + "px";
			Beschreibung_Inhalte.style.height = Haupt.offsetHeight - Oben.offsetHeight - 104 + "px";
		} else {
			// Wenn Bildschirm < 17"
			if ( Hoehe > HoeheMin ) {
				Haupt.style.overflow = "hidden";
				var HauptHoehe = Hoehe - 2;
				Haupt.style.height = HauptHoehe + "px";
				Rechts.style.height = HauptHoehe - Oben.offsetHeight - HoeheMitteOben + "px";
				Beschreibung_Inhalte.style.height = Haupt.offsetHeight - Oben.offsetHeight - 104 + "px";
			}
		}
	}
	
	// Wenn Bildschirm (Breite & Hoehe) < Minimum
	if ( Weite <= BreiteMin ) {
		Haupt.style.width = BreiteMin + "px";
	}
	
	Rechts.style.width = Haupt.offsetWidth - 543 + "px";
	if ( Navi3 != null ) {
		Navi3.style.width = Rechts.style.width;
	}
	
	if ( Hoehe <= HoeheMin || Weite <= BreiteMin ) {
		Haupt.style.overflow = "visible";
		Haupt.style.height = "auto";
		Beschreibung_Inhalte.style.height = "auto";
		Rechts.style.height = "auto";
		var Hoehe1 = Haupt.offsetHeight;
		var Hoehe2 = Oben.offsetHeight + HoeheMitteOben + Beschreibung_Inhalte.offsetHeight + 63;
		Haupt.style.height = Math.max( Hoehe1, Math.max( Hoehe2, HoeheMin )) - 4 + "px";
	}
	
	Adresse.style.width = Haupt.offsetWidth - 460 + "px";
	if ( flash_content !== false ) {
		flash_content.style.height = Haupt.offsetHeight - Oben.offsetHeight - HoeheMitteOben + "px";
	}
	Links.style.height = Haupt.offsetHeight - 100 + "px";
	// Schalter "Modell konfigurieren" soll erst verfügbar sein, wenn alles geladen wurde:
	if ( !skaliert ) {
		var arrATags = Rechts.getElementsByTagName("a");
		for( x=0; x < arrATags.length; x++ ) {
			if ( arrATags[x].className == "ModellKonfig" ) {
				arrATags[x].style.display = "inline";
			}
		}
	}
	skaliert = true;
	blSeiteGeladen = true;
}

function neuLaden() {
	if ( !Firefox_erkennen() ) {
		if ( Weite != Fensterweite() || Hoehe != Fensterhoehe() ) {
			neuAufbau();
		}
	} else {
		neuAufbau();
	}
	MerklisteLeer();
	// Hier wird sichergestellt, dass der MSIE korrekt mit Ankern umgeht:
	var Anker = document.location.hash;
	if ( Anker != "" ) {
		location.hash = Anker;
	}
}

/* Überwachung von Netscape initialisieren */
if (!window.Weite && window.innerWidth) {
	
	// Globale Variablen:
	var Weite, Hoehe, skaliert = false;
	blSeiteGeladen = false;
	
	window.onresize = neuAufbau;
}

/* Überwachung von Internet Explorer initialisieren */
if (!window.Weite && document.body && document.body.offsetWidth) {
	
	// Globale Variablen:
	var Weite, Hoehe, skaliert = false;
	blSeiteGeladen = false;
	
	window.onresize = neuAufbau;
}
