// JavaScript zum Herausladen aus fremden Frames. Direkt im Header aufrufen!
function checkTopFrameset() {
/*	if (top.frames && (top.frames.length > 0) && (top.location.href != document.location.href)) {
		top.location.href = document.location.href;
	}*/
}

// Für die Index-Seiten zum Nachladen der Ursprungsseite im Hauptframe:
function checkFramecall() {
	if (location.search && top.stationhaupt)
		top.stationhaupt.location.href = location.search.substr(1,location.search.length-1)+location.hash;
}

// Zum Nachladen des Framesets OHNE weiteres Nachladen einer Frameseite:
function checkIndex() {
	if (!top.stationoben)
		top.location.href = './';
}

// Zum Nachladen des Framesets plus Nachladen der Ursprungsseite im Hauptframe:
function checkFrameset0() {
	checkFrameset('./');
}
function checkFrameset1() {
	checkFrameset('../');
}
function checkFrameset2() {
	checkFrameset('../../');
}
function checkFrameset3() {
	checkFrameset('../../../');
}
function checkFrameset(index) {
	if (!top.stationoben)
		top.location.href = index+'?'+document.location.pathname+document.location.search+document.location.hash;
}

// Veraltet! Bitte stattdessen 'checkFrameset0()' benutzen!
function checkEnvironment() {
	checkFrameset0();
}
// Veraltet! Bitte stattdessen 'checkFrameset(index)' oder 'checkFrameset1()' o.ä. benutzen!
function checkEnvironment2(index) {
	checkFrameset(index);
}

// Zum Umwandeln einer @-Domain in eine gültige URL.
// Bsp.: http://...@www.gaystation.info -> http://www.gaystation.info/...
function checkAtDomain() {
	var url = window.location.href;

	if (url.charAt(url.length-1) != '/')
		url = url+ '/';

	var s = url.indexOf("//") + 2;
	var e = url.indexOf("@");

	if (e > 0) {
		var prot   = url.substring(0,s);
		var atpart = url.substring(s,e);
		url        = url.substring(e+1);
		window.location.href = prot + url + atpart;
	}
}

function mailto(ziel, subject, body) {
	if (subject) {
		if (body)
			location.href = "mailto:"+ziel+"@"+"gaystation.info?subject="+subject+"&body="+body;
		else
			location.href = "mailto:"+ziel+"@"+"gaystation.info?subject="+subject;
	} else {
		if (body)
			location.href = "mailto:"+ziel+"@"+"gaystation.info?body="+body;
		else
			location.href = "mailto:"+ziel+"@"+"gaystation.info";
	}
}

function sendmail(name, domain) {
	location.href = "mailto:"+name+"@"+domain;
}

function writeMail(name) {
	document.write(name+'@'+'gaystation.info');
}

function noRightMouse() {
}

function addNetscapePanel(title, url) {
	// hack: work around http://bugzilla.mozilla.org/show_bug.cgi?id=99808
	window.onerror = function() {
		alert('Hinzufügen fehlgeschlagen. Mozilla und Netscape haben einen Bug, '+
			'daher bitte erst die Sidebar öffnen <F9> und nochmal probieren!');
	};

	if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) {
		window.sidebar.addPanel(title, url, "");
	} else {
		var rv = window.confirm("Dies ist eine Zusatzfunktion für Netscape 6/7 und Mozilla. "
		+ "Möchtest du Netscape 7 mal testen? Wir können es nur empfehlen!");
		if (rv)
			window.open("http://www.netscape.de/netscapeprodukte/netscape71/download.html","_blank");
	}
}
