function popwin(fil,navn,bred,hoj,scroll,resize)
{
	window.open(fil,navn,eval("'width=" + bred + ",height=" + hoj + ",scrollbars=" + scroll + ",resizable=" + resize + ",status=no,titlebar=no'"));
}

function embedFlash(file, width, height)
{
   document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+ width +'" height="' + height + '" id="'+ file +'" align="middle">\n');
   document.write('<param name="allowScriptAccess" value="sameDomain" />\n');
   document.write('<param name="movie" value="' + file + '.swf" />\n');
   document.write('<param name="quality" value="high" />\n');
   document.write('<param name="bgcolor" value="#ffffff" />\n');
   document.write('<param name="wmode" value="transparent" />\n');
   document.write('<param name="menu" value="false" />\n');
   document.write('<embed wmode="transparent" src="'+ file +'.swf" quality="high" bgcolor="#ffffff" width="'+ width +'" height="'+ height +'" name="' + file + '" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n');
   document.write('</object>\n');
}

function ShiftImageAktivitet(navn, dir) {
	var stort = document.images['stortbillede'].src;
	var name = stort.substr(53);
	document.images['stortbillede'].src = 'http://www.esmarch.dk/gfx/images/' + dir + '/forside/' + navn + '';
}


function ShiftImage(navn, dir) {
	var stort = document.images['stortbillede'].src;
	var name = stort.substr(53);
	document.images['stortbillede'].src = '/' + dir + '/' + navn + ''; // TS20090713
}
function ShiftImage2(navn, dir) {
	var stort = document.images['stortbillede'].src;
	var name = stort.substr(53);
	document.images['stortbillede'].src = '/gfx/' + dir + '/' + navn + '';
}

// show/hide div
function show_hide_div(id) {
	var divElm = document.getElementById(id);
	divElm.style.display = divElm.style.display != 'none' ? 'none' : 'block';
	return false;
}

// show div
function show_div(id) {
	var divElm = document.getElementById(id);
	divElm.style.display = 'block';
	return false;
}

// hide div
function hide_div(id) {
	var divElm = document.getElementById(id);
	divElm.style.display = 'none';
	return false;
}

function loopSelected(id,msg,max)
{
	var selectedArray = new Array();
	var selObj = document.getElementById(id);
	var i;
	var count = 0;
	for (i=0; i<selObj.options.length; i++) {
		if (selObj.options[i].selected) {
			if (count >= max) {
				alert(msg);
				selObj.options[i].selected = false;

			} else {
				count++;
			}
		}
	}
}

// script for showing and hiding div
function show_moving_div(divClass, divText)
{
	domok = document.getElementById;
	if (domok) {

		skn = document.getElementById("movingDivWrapper").style;

		if(navigator.appName.substring(0,3) == "Net")
			document.captureEvents(Event.MOUSEMOVE);
			document.onmousemove = get_mousepos;
		}

		var content ="<div class="+divClass+">" + divText + "</div>";

		if (domok) {
			document.getElementById("movingDivWrapper").innerHTML = content;
			if(document.all) get_mousepos();
			skn.display = "block";
		}
	}

function get_mousepos(e)
{
	domok = document.getElementById;

	if (domok) {
		skn = document.getElementById("movingDivWrapper").style;

		var x = (navigator.appName.substring(0,3) == "Net") ? e.pageX : event.x+document.body.scrollLeft;
		var y = (navigator.appName.substring(0,3) == "Net") ? e.pageY : event.y+document.body.scrollTop;

		skn.left = x + 10 + "px";
		skn.top = y + 10 + "px";
	}
}

function hide_moving_div()
{
	if (domok) skn.display = "none";
}

function showInfoBox(num) {
	numbers = new Array("jul","nytaar");
	if (num == '') {
		$('formInfoBox').hide();
	} else if (numbers.toString().indexOf(num)!==-1) {
		$('formInfoBox').show();
		//new Effect.toggle('formInfoBox','appear', {duration: 0.5});
	} else {
		$('formInfoBox').hide();
	}
}

Event.observe(window, 'load', function() {
	$$('td.tip').each(function(el) {
		new Tip(el, el.title);
		el.title = '';
	});
});

function addtofav(lang) {

	var ua			= navigator.userAgent.toLowerCase();

	var isKonq		= (ua.indexOf('konqueror')	!= -1);
	var isSafari	= (ua.indexOf('webkit')		!= -1);
	var isMac		= (ua.indexOf('mac')		!= -1);

	var key			= (isMac?'Command':'CTRL') + ' + ' + (isKonq?'B':'D');

	var title		= document.title;
	var url			= self.location;

	var string		= '';
	var manually	= '';

	if(lang == 'de') {

		//string	= 'Sie müssen ' + key + ' Klicken, um diese Seite zu bookmarken';
		//manually	= 'Um diese Seite zu bookmarken, müssen Sie dies manuell in Ihrem Browser.';

		string		= 'Zum Einfügen eines Lesezeichens für diese Seite drücken Sie bitte ' + key + '.';
		manually	= 'Benutzen Sie die entsprechende Funktion Ihres Browsers um manuell ein Lesezeichen für diese Seite einzufügen.';

	} else if(lang == 'uk') {

		string		= 'You need to press ' + key + ' to bookmark this page.';
		manually	= 'To bookmark this page you must do so manually through your browser.';

	} else if(lang == 'no') {

		string		= 'Du må trykke ' + key + ' å bokmerke denne siden.';
		manually	= 'For å bokmerke denne siden, må du gjøre det manuelt via browseren din.';

	} else if(lang == 'nl') {

		string		= 'U moet druk op ' + key + ' om bookmark deze pagina.';
		manually	= 'Om bookmark deze pagina, moet u dit handmatig doen via uw browser.';

	} else if(lang == 'se') {

		string		= 'Du måste trycka på ' + key + ' till bokmärke denna sida.';
		manually	= 'Till Bokmärk denna sida, måste du göra det manuellt via din browser.';

	} else if(lang == 'eu') {

		string		= 'You need to press ' + key + ' to bookmark this page.';
		manually	= 'To bookmark this page you must do so manually through your browser.';

	} else {

		string		= 'Du skal trykke på ' + key + ' for at bogmærke denne side.';
		manually	= 'For at bogmærke denne side, skal du gøre det manuelt via din browser.';

	}

	if(document.all) { // IE

		window.external.AddFavorite(url, title);

	} else if(isKonq) { // Konqueror

		//alert('You need to press CTRL + B to bookmark this page');
		alert(string);

	} else if(window.opera) {  // Opera

		//alert('You need to press CTRL + D to bookmark this page');
		alert(string);

	} else if(window.home || isSafari) { // Firefox, Netscape, Safari, iCab

		//alert('You need to press ' + key + ' + D to bookmark this page!');
		alert(string);

	} else if(!window.print || isMac) { // IE5/Mac and Safari 1.0

		//alert('You need to press Command + D to bookmark this page!');
		alert(string);

	} else {

		//alert('To bookmark this page you must do so manually through your browser.');
		alert(manually);

    }

}