var overlay;
var imageOverlay;
var overlayVis = false;

function initOverlay() {
	if(document.all && !document.getElementById) {
		overlay = document.all['overlay'];
		imageOverlay = document.all['imageOverlay'];
	}
	else {
		overlay = document.getElementById('overlay');
		imageOverlay = document.getElementById('imageOverlay');
	}
}

function maximizeOverlay(tmpN) {
	overlayVis = true;
	overlay.style.left = getScrollLeft()+'px';
	overlay.style.top = getScrollTop()+'px';
	overlay.style.width = getScreenWidth()+'px';
	overlay.style.height = getScreenHeight()+'px';
	imageOverlay.style.left = Math.round(getScrollLeft() + getScreenWidth()/2 - 298)+'px';
	imageOverlay.style.top = Math.round(getScrollTop() + getScreenHeight()/2 - 248)+'px';
	overlay.style.visibility = 'visible';
	imageOverlay.style.visibility = 'visible';
}

function minimizeOverlay() {
	overlay.style.visibility = 'hidden';
	imageOverlay.style.visibility = 'hidden';
	overlayVis = false;
	overlay.style.left = '0px';
	overlay.style.top = '-1px';
	overlay.style.width = '1px';
	overlay.style.height = '1px';
	imageOverlay.style.left = '-1000px';
	imageOverlay.style.top = '0px';
}

function redrawOverlay() {
	if(overlayVis) {
		overlay.style.left = '0px';
		overlay.style.top = '0px';
		overlay.style.width = getScreenWidth()+'px';
		overlay.style.height = getScreenHeight()+'px';
		imageOverlay.style.left = Math.round(getScreenWidth()/2 - 298)+'px';
		imageOverlay.style.top = Math.round(getScreenHeight()/2 - 248)+'px';
	}
}

function overlayIsScrolled() {
	if(overlayVis) {
		overlayVis = false;
		overlay.style.visibility = 'hidden';
		imageOverlay.style.visibility = 'hidden';
		overlayVis = false;
		overlay.style.left = '0px';
		overlay.style.top = '-1px';
		overlay.style.width = '1px';
		overlay.style.height = '1px';
		imageOverlay.style.left = '-1000px';
		imageOverlay.style.top = '0px';
	}
}

function getScreenWidth() {
	if(document.all && !document.getElementById) {
		return window.innerWidth;
	}
	else {
		return document.body.clientWidth;
	}
}

function getScreenHeight() {
	if(document.all && !document.getElementById) {
		return window.innerHeight;
	}
	else {
		var ret = 0;

		if(ret < document.documentElement.clientHeight) {
			ret = document.documentElement.clientHeight;
		}

		if(ret < window.innerHeight) {
			ret = window.innerHeight;
		}

		return ret;
	}
}

function getScrollTop() {
	if(document.all && !document.getElementById) {
		return window.scrollTop;
	}
	else {
		var ret = 0;

		if(ret < document.body.scrollTop) {
			ret = document.body.scrollTop;
		}

		if(ret < document.documentElement.scrollTop) {
			ret = document.documentElement.scrollTop;
		}

		if(ret < window.scrollTop) {
			ret = window.scrollTop;
		}

		return ret;
	}
}

function getScrollLeft() {
	var ret = 0;

	return 0;
}

function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName]
    }
    else {
        return document[movieName]
    }
}

function writeOverlay() {
	var str;

str = '<object name="mediaplayerL" id="mediaplayerL" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" height="496" width="596"><param name="movie" value="mediaplayer_large.swf"> <param name="quality" value="high"> <param name="wmode" value="opaque"> <param name="allowScriptAccess" value="always"> <embed name="mediaplayerL" id="mediaplayerL" src="mediaplayer_large.swf" quality="high" wmode="opaque" pluginspage="http://www.macromedia.com/go/getflashplayer" allowscriptaccess="always" type="application/x-shockwave-flash" height="496" width="596"></object>';

	document.write(str);
}

function writeMediaplayer() {
	var str;

str = '<object name="mediaplayerS" id="mediaplayerS" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" height="334" width="373"><param name="movie" value="mediaplayer_small.swf"> <param name="quality" value="high"> <param name="wmode" value="opaque"> <param name="allowScriptAccess" value="always"> <embed name="mediaplayerS" id="mediaplayerS" src="mediaplayer_small.swf" quality="high" wmode="opaque" pluginspage="http://www.macromedia.com/go/getflashplayer" allowscriptaccess="always" type="application/x-shockwave-flash" height="334" width="373"></object>';

	document.write(str);
}

function writeMediaplayerTall() {
	var str;

str = '<object name="mediaplayerTall" id="mediaplayerTall" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" height="426" width="373"><param name="movie" value="mediaplayerTall.swf"> <param name="quality" value="high"> <param name="wmode" value="opaque"> <param name="allowScriptAccess" value="always"> <embed name="mediaplayerTall" id="mediaplayerTall" src="mediaplayerTall.swf" quality="high" wmode="opaque" pluginspage="http://www.macromedia.com/go/getflashplayer" allowscriptaccess="always" type="application/x-shockwave-flash" height="426" width="373"></object>';

	document.write(str);
}


function writeMediaplayerTwoColumns() {
	var str;

str = '<object name="mediaplayerTwo" id="mediaplayerTwo" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" height="298" width="767"><param name="movie" value="mediaplayer_twocolumns.swf"> <param name="quality" value="high"> <param name="wmode" value="opaque"> <param name="allowScriptAccess" value="always"> <embed name="mediaplayerTwo" id="mediaplayerTwo" src="mediaplayer_twocolumns.swf" quality="high" wmode="opaque" pluginspage="http://www.macromedia.com/go/getflashplayer" allowscriptaccess="always" type="application/x-shockwave-flash" height="298" width="767"></object>';

	document.write(str);
}

function writeProgram() {
	var str;

str = '<object name="program" id="program" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" height="341" width="373"><param name="movie" value="program.swf?_xml=%2Fkalenderpost%2Fxml.php"> <param name="quality" value="high"> <param name="wmode" value="opaque"> <param name="allowScriptAccess" value="always"> <embed name="program" id="program" src="program.swf?_xml=%2Fkalenderpost%2Fxml.php" quality="high" wmode="opaque" pluginspage="http://www.macromedia.com/go/getflashplayer" allowscriptaccess="always" type="application/x-shockwave-flash" height="341" width="373"></object>';

	document.write(str);
}

function writeProgramSmall() {
	var str;

str = '<object name="programSmall" id="programSmall" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" height="146" width="268"><param name="movie" value="programSmall.swf?_xml=%2Fkalenderpost%2Fxml.php"> <param name="quality" value="high"> <param name="wmode" value="opaque"> <param name="allowScriptAccess" value="always"> <embed name="programSmall" id="programSmall" src="programSmall.swf?_xml=%2Fkalenderpost%2Fxml.php" quality="high" wmode="opaque" pluginspage="http://www.macromedia.com/go/getflashplayer" allowscriptaccess="always" type="application/x-shockwave-flash" height="146" width="268"></object>';

	document.write(str);
}

function writeAktueltSmall() {
	var str;

str = '<object name="aktueltSmall" id="aktueltSmall" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" height="146" width="268"><param name="movie" value="aktueltSmall.swf?_xml=%2Fnyhet%2Fxml.php"> <param name="quality" value="high"> <param name="wmode" value="opaque"> <param name="allowScriptAccess" value="always"> <embed name="aktueltSmall" id="aktueltSmall" src="aktueltSmall.swf?_xml=%2Fnyhet%2Fxml.php" quality="high" wmode="opaque" pluginspage="http://www.macromedia.com/go/getflashplayer" allowscriptaccess="always" type="application/x-shockwave-flash" height="146" width="268"></object>';

	document.write(str);
}


function writeHistory() {
	var str;

str = '<object name="mediaplayerTwo" id="mediaplayerTwo" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" height="240" width="766"><param name="movie" value="/historie.swf?_xml=%2Fhistorie%2Fxml.php"> <param name="quality" value="high"> <param name="wmode" value="opaque"> <param name="allowScriptAccess" value="always"> <embed name="mediaplayerTwo" id="mediaplayerTwo" src="/historie.swf?_xml=%2Fhistorie%2Fxml.php" quality="high" wmode="opaque" pluginspage="http://www.macromedia.com/go/getflashplayer" allowscriptaccess="always" type="application/x-shockwave-flash" height="240" width="766"></object>';
	document.write(str);
}

// function popMediaplayer(tmpCur, dir1, dir2, xml) {
//     newWindow = window.open('/mediaplayer_large_popup.html?cur=' + escape(tmpCur) + '&dir1=' + escape(dir1) + '&dir2=' + escape(dir2) + '&xml=' + escape(xml),
//                             'Mediaspiller',"height=516,width=616,status=no,toolbar=no,menubar=no,location=no,resizable=no");
// }

function popMediaplayer(tmpCur, dir1, dir2, xml, lang) {
    newWindow = window.open('/mediaplayer_large_popup.html?cur=' + escape(tmpCur) + '&dir1=' + escape(dir1) + '&dir2=' + escape(dir2) + '&xml=' + escape(xml) + '&_lang=' + escape(lang),'Mediaspiller',"height=516,width=616,status=no,toolbar=no,menubar=no,location=no,resizable=no");
}


