function findBrowser() {
	var browser; 
	if (navigator.appName == 'Netscape' && document.layers != null) {
		browser = "ns";
	} else if (document.all != null) {
		browser = "ie"
	} else if (navigator.appName == 'Netscape' && document.layers == null && navigator.appVersion.substring(0,1) > 4) {
		browser = "ns6";
	} 
	return browser;
}

function getRef(id) {
	if (findBrowser() == "ns") {
		return document.layers[id];
	} else if (findBrowser() == "ie") {
		return document.all[id];
	} else if (findBrowser() == "ns6") {
		return document.getElementById(id);
	}
}

function changeColor(id,color) {
	if (findBrowser() == "ns") {
		getRef(id).bgcolor = color;
	}
	else if (findBrowser() == "ie" || findBrowser() == "ns6") {
		getRef(id).style.backgroundColor = color;
	}	
}

function changeBorderColor(id,color) {
	if (findBrowser() == "ns") {
		getRef(id).style.borderColor = color;
	}
	else if (findBrowser() == "ie" || findBrowser() == "ns6") {
		getRef(id).style.borderColor = color;
	}	
}

function changeClass(id,newClass) {
	getRef(id).className = newClass;
}

function changeImage(id,imageUrl) {
	document.images[id].src = imageUrl;
}

function changeBackground(id,imageUrl) {
	document.getElementById(id).style.backgroundImage = "url(" + imageUrl + ")";	
}

function hideLayer(id) {
	if (findBrowser() == "ns") {
		if (getRef(id).visibility == "show") {
			getRef(id).visibility = "hide";
		}
	}
	else if (findBrowser() == "ie" || findBrowser() == "ns6") {
		if (getRef(id).style.visibility == "visible") {
			getRef(id).style.visibility = "hidden";			
		}
	}		
}

function showLayer(id) {
	if (id) {
		if (findBrowser() == "ns") {
			if (getRef(id).visibility == "hide") {
				getRef(id).visibility = "show";
			}
		}
		else if (findBrowser() == "ie" || findBrowser() == "ns6") {
			if (getRef(id).style.visibility == "hidden") {
				getRef(id).style.visibility = "visible";			
			}
		}
	}
}

function changeLocation(mn1,mn2,mn3,sid,aid,pid,pmn1) {
	if (pid == "" || pid == null) {
		pid = "0";
	}
	if (pmn1 == "" || pmn1 == null) {
		pmn1 = "0";
	}
	if (aid != "" && aid != null) {
		document.location.href = "default.asp?mn1="+mn1+"&mn2="+mn2+"&mn3="+mn3+"&sid="+sid+"&pid="+pid+"&pmn1="+pmn1+"#"+aid;
	} else {
		document.location.href = "default.asp?mn1="+mn1+"&mn2="+mn2+"&mn3="+mn3+"&sid="+sid+"&pid="+pid+"&pmn1="+pmn1;
	}
}

function changeURL(URL) {
	document.location.href = URL;
}

function changeTopURL(URL) {
	top.document.location.href = URL;
}

function openWindow(URL) {
	window.open(URL);
}


function showMenuLayer(layerid) {
	if (document.all) { //IS IE 4 or 5 (or 6 beta) 
		eval( "document.all." + layerid + ".style.display = 'block'");
	} 
	
	if (document.layers) { //IS NETSCAPE 4 or below 
		document.layers[layerid].display = 'block'; 
	} 
	
	if (document.getElementById &&!document.all) { 
		hza = document.getElementById(layerid); 
		hza.style.display = 'block'; 
	} 	
}

function hideMenuLayer(layerid) {
	if (document.all) { //IS IE 4 or 5 (or 6 beta) 
		eval( "document.all." + layerid + ".style.display = 'none'");
	} 
	
	if (document.layers) { //IS NETSCAPE 4 or below 
		document.layers[layerid].display = 'none'; 
	} 
	
	if (document.getElementById &&!document.all) { 
		hza = document.getElementById(layerid); 
		hza.style.display = 'none'; 
	} 	
}

function showhide(layer_ref) { 
	var state = "";
	
	if (document.all) { //IS IE 4 or 5 (or 6 beta) 
		state = getRef(layer_ref).style.display;
	} 
	
	if (document.layers) { //IS NETSCAPE 4 or below 
		state = document.layers[layer_ref].display; 
	} 
	
	if (document.getElementById &&!document.all) { 
		hza = document.getElementById(layer_ref); 
		state = hza.style.display; 
	}
	
	if (state == 'block') { 
		state = 'none'; 
	} else { 
		state = 'block'; 
	} 
	
	if (document.all) { //IS IE 4 or 5 (or 6 beta) 
		eval( "document.all." + layer_ref + ".style.display = state");
	} 
	
	if (document.layers) { //IS NETSCAPE 4 or below 
		document.layers[layer_ref].display = state; 
	} 
	
	if (document.getElementById &&!document.all) { 
		hza = document.getElementById(layer_ref); 
		hza.style.display = state; 
	} 
}

function sendMeALetter(part1,part2,part3) {
	window.open('ma' + 'il' + 'to' + ':' + part3 + '@' + part2 + '.' + part1);
}

function setCookie(name, value, expiredays) {
	var exdate=new Date()
	exdate.setTime(exdate.getTime()+(expiredays*24*3600*1000))
	var curCookie = name + "=" + escape(value) + ((expiredays==null) ? "" : "; expires="+exdate);
	document.cookie = curCookie;
}

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
// 	alert(unescape(dc.substring(begin + prefix.length, end)));
 	return unescape(dc.substring(begin + prefix.length, end));
}

function berlingske_popup_pictueregallery(id) {
	window.open('http://www.berlingske.dk/grid/picturegallery:aid='+ id +':show=index','','width=750,height=540,toolbar=0');	
}

function berlingske_popup_pictueregallery_new(url) {
	var thePopup = window.open(url, '', 'top=' + ((screen.availHeight - 601) / 3) + ',left=' + ((screen.availWidth - 960) / 2) + ',width=960,height=601,resizable=1,toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0');	
	thePopup.focus();
}

















