var SelektiertesGasthaus = "";
var AltGasthaus = "";
var AltEbene = "";
var AltSubNummer = "";
var AltNummer = "";
var GasthausButton = "";



// Navigationsmenübedienung
function ChangeNavigation (Gasthaus, Ebene, SubNummer, Nummer, Link) {
	// Link direkt öffnen oder Submenü
	if (Ebene == "0") {
		if (Link != "") {
			// Link öffnen
			//parent.document.getElementById("content").location.href = Link;
			parent.document.getElementById("content").src = Link;
		}
	} else {
		if (Link != "") {
			// Link öffnen
			//parent.document.getElementById("content").location.href = Link;
			parent.document.getElementById("content").src = Link;
		}

		// Submenü öffnen
		document.getElementById(Gasthaus + "_sub_" + Nummer).style.display = "";
	}

	// Alte Navigationselemente normal
	if (AltGasthaus != "" && AltEbene != "" && AltNummer != "") {
		// NORMAL
		if (AltEbene != "2") {
			document.getElementById(AltGasthaus + "_" + AltEbene + "_" + AltNummer).style.textDecoration = "none";
		}
		if (AltEbene >= 1 && Nummer != AltNummer) {
			// Submenü schließen
			if (AltEbene > 1) { AltEbene = "1"; }
			document.getElementById(AltGasthaus + "_sub_" + AltNummer).style.display = "none";
		}
	}

	// Navigationselemente unterstreichen
	if (Ebene != "2") {
		document.getElementById(Gasthaus + "_" + Ebene + "_" + Nummer).style.textDecoration = "underline";
	}

	// Header-Bild ändern (aufgrund von Fehlern in manchen Browsern)
	if (parent.document.getElementById("header").src != "media/header_schadts.jpg") {
		parent.document.getElementById("header").src = "media/header_schadts.jpg";
	}

	AltGasthaus = Gasthaus;
	AltEbene = Ebene;
	AltNummer = Nummer;
}

// Buttons ändern
function ChangeImage (Gasthaus, Status, Sprache) {
	if (Gasthaus == "Schadts") {
		if (Status == "1") {
			document.getElementById("button_schadts").src = "media/schadts_button_" + Sprache + "_over.gif";
		} else {
			if (GasthausButton != "Schadts") {
				document.getElementById("button_schadts").src = "media/schadts_button_" + Sprache + ".gif";
			}
		}
	} else {
		if (Status == "1") {
			document.getElementById("button_zumloewen").src = "media/zumloewen_button_" + Sprache + "_over.gif";
		} else {
			if (GasthausButton != "ZumLoewen") {
				document.getElementById("button_zumloewen").src = "media/zumloewen_button_" + Sprache + ".gif";
			}
		}
	}
}

// Navigationsmenübedienung: Alle Elemente deaktivieren
function ClearNavigation (Link) {
	// Alte Navigationselemente normal
	Ebene = "0";

	AltGasthaus2 = navigation.AltGasthaus;
	AltEbene2    = navigation.AltEbene;
	AltNummer2   = navigation.AltNummer;

	if (AltGasthaus2 != "" && AltEbene2 != "" && AltNummer2 != "") {
		// NORMAL
		if (AltEbene2 != "2") {
			navigation.document.getElementById(AltGasthaus2 + "_" + AltEbene2 + "_" + AltNummer2).style.textDecoration = "none";
		}
		if (Ebene == "0" && AltEbene2 >= 1) {
			// Submenü schließen
			if (AltEbene2 > 1) { navigation.AltEbene = "1"; }
			navigation.document.getElementById(AltGasthaus2 + "_sub_" + AltNummer2).style.display = "none";
		}
	}

	navigation.AltGasthaus = "";
	navigation.AltEbene = "";
	navigation.AltNummer = "";

	// Weiterleiten
	if (Link != "") {
		//document.getElementById("content").location.href = Link;
		document.getElementById("content").src = Link;
	}
}

// Anfahrtsbild öffnen
function ZeigeBild (Bild, BildBreite, BildHoehe) {
	window.open(Bild, "bild_popup", "width=" + (BildBreite + 20) + ",height=" + (BildHoehe + 30) + ",screenX=0,screenY=0,directories=no,location=no,menubar=no,scrollbars=no,status=no,titlebar=no,resizable=no");
}

// Ankuftswerte aktualisieren
function AktualisiereAnkunft (Ankunft) {
	if (Ankunft == "schadts") {
		document.getElementById("tostreet").value = "Am Marstall 2";
		document.getElementById("toplz").value = "38100";
		document.getElementById("tocity").value = "Braunschweig";
	} else {
		document.getElementById("tostreet").value = "Waisenhausdamm 13";
		document.getElementById("toplz").value = "38100";
		document.getElementById("tocity").value = "Braunschweig";
	}
}

// Sprache
function Sprache (DieSprache) {

	// Seite aus IFrame
	//AktuelleSeite = document.getElementById("content").location;
	AktuelleSeite = document.getElementById("content").src;

	// Weiterleitung
	document.location.href = "index.php?sprache=" + DieSprache + "&temp_weiterleitung=" + escape(AktuelleSeite);

}

// Eintrag löschen, allerdings vorher Bestätigung einholen
function LoeschenMitBestaetigung (Eintrag, Typ, Seite) {
	var Bestaetigung = confirm('Soll dieser Eintrag wirklich unwiderruflich gelöscht werden?');
	if (Bestaetigung) {
		document.location.href = Seite + '&typ=' + Typ + '&loeschen=Ja&id=' + Eintrag;
	}

	if (typeof(window.opera) != "undefined") {
		if (Bestaetigung) {
			document.location.href = Seite + '&typ=' + Typ + '&loeschen=Ja&id=' + Eintrag;
		}
	}
}
