/* Scripte fuer schwedenplatte.de */


/* Anzeige in Frames verhindern */
if (self != top) {
	top.location = self.location;
}


/* Dokument initialisieren */
function initDoc (options) {
	
	if (options == 'setlang' && navigator.cookieEnabled == true) {
		var ahref = document.getElementsByTagName("a")[1].getAttributeNode("href").value;
		var lang = ahref.slice(7, 9);
		var exp = new Date();
		var in2Years = exp.getTime() + (730 * 24 * 60 * 60 * 1000);
		exp.setTime(in2Years);
		document.cookie = "lang=" + lang + ";path=/; domain=.schwedenplatte.de; expires=" + exp.toGMTString();
	}
		
	loadBackground();
	return 1;
}


/* Hintergrundbild laden */
function loadBackground() {
	var winWidth = detectWinWidth();
	var winHeight = detectWinHeight();
	var domPath = false;
	if (document.all) {
		domPath = document.getElementById ('www-schwedenplatte-de');
	} else {
		domPath = document.getElementsByTagName ("html")[0];
	}
	if (winWidth < 650 && winHeight < 488) {
		domPath.style.background = 'url("http://www.schwedenplatte.de/xtra/background0650.jpg") top left repeat fixed';
	} else if (winWidth < 800 && winHeight < 600) {
		domPath.style.background = 'url("http://www.schwedenplatte.de/xtra/background0800.jpg") top left repeat fixed';
	}  else if (winWidth < 1024 && winHeight < 768) {
		domPath.style.background = 'url("http://www.schwedenplatte.de/xtra/background1024.jpg") top left repeat fixed';
	}  else if (winWidth < 1280 && winHeight < 1024) {
		domPath.style.background = 'url("http://www.schwedenplatte.de/xtra/background1280.jpg") top left repeat fixed';
	}  else if (winWidth < 1600 && winHeight < 1200) {
		domPath.style.background = 'url("http://www.schwedenplatte.de/xtra/background1600.jpg") top left repeat fixed';
	}  else if (winWidth < 3200 && winHeight < 2400) {
		domPath.style.background = 'url("http://www.schwedenplatte.de/xtra/background3200.jpg") top left repeat fixed';
	}  else {
		domPath.style.background = 'url("http://www.schwedenplatte.de/xtra/background7680.jpg") top left repeat fixed';
	}
}


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


/* Fensterhöhe messen */
function detectWinHeight() {
	if (window.innerHeight) {
		return window.innerHeight;
	} else if (document.body && document.body.offsetHeight) {
		return document.body.offsetHeight;
	} else {
		return 0;
	}
}

/* Fenster mit Webcam öffnen */
function openWebcam() {
	window.open ('http://www.schwedenplatte.de/video/webcam.php', 'Schwedenplatte Webcam', 'width=1024,height=800,resizable=yes,scrollbars=yes,status=yes');
}