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 changeClass(id,newClass) {
	getRef(id).className = newClass;
}

function changeImage(id,imageUrl) {
	document.images[id].src = 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 openWindow(URL) {
	window.open(URL);
}

var activeMn2Id = "";
var activeMn3Id = "";
var activeSublayer = "";
var activeSubimg = "";

function changeMn2Color(id, newColor) {
	if (id != activeMn2Id) {
		changeColor(id, newColor);
	}
}

function changeMn2(id,sublayer,subimg) {
	if (id != activeMn2Id) { //hvis det nye kald er fra en anden menuknap
		if (activeMn2Id != "") { //hvis den aktive menuknap eksisterer, luk den
			changeColor(activeMn2Id,'');
			hideMenuLayer(activeSublayer);
			changeImage(activeSubimg,'images/menu_arrow_close.gif');
		}	
		showMenuLayer(sublayer);
		changeImage(subimg,'images/menu_arrow_open.gif');
		activeMn2Id = id;
		activeSublayer = sublayer;
		activeSubimg = subimg;
	} else { //hvis det er fra den samme menuknap, luk menuen
		hideMenuLayer(activeSublayer);
		changeImage(activeSubimg,'images/menu_arrow_close.gif');
		activeMn2Id = "";
		activeSublayer = "";
		activeSubimg = "";
	}		
}

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 kurvAddProduct(thisid) {
	var antalSelect = "antalKolli"+thisid;
	var antal = document.produktform.elements[antalSelect].value;
	document.produktform.produktid.value = thisid;
	document.produktform.produktantal.value = antal;
	document.produktform.submit();
}

function kurvAddProductTop(thisid) {
	var antalSelect = "antalKolli"+thisid+"Top";
	var antal = document.produktform.elements[antalSelect].value;
	document.produktform.produktid.value = thisid;
	document.produktform.produktantal.value = antal;
	document.produktform.submit();
}

function kurvEmpty() {
	if (confirm("Dette vil fjerne alle varer fra indkøbskurven.")) {
		document.location.href = "kurv_empty_ver.asp";	
	}
}

function kurvSetProduct(thisid,groupid) {
	var antalSelect = "antalKolli"+thisid;
	var antal = document.produktform.elements[antalSelect].value;
	document.produktform.produktid.value = thisid;
	document.produktform.produktantal.value = antal;
	if (groupid != null) {
		document.produktform.placeringsid.value = groupid;
	}
	document.produktform.submit();
}

function kurvRemoveProduct(thisid) {
	if (confirm("Dette vil fjerne denne vare fra kurven.")) {
		document.location.href = "kurv_removeitem_ver.asp?id="+thisid;
	}
}

function kurvSubmit() {
	if (confirm("Dette vil afsende din bestilling.")) {
		document.kurvform.submit();
	}	
}

function onloadFunctionNlPreview() {
	var dato = opener.document.cmsForm.dato.value;
	var tekst = opener.document.cmsForm.tekst.value;
	document.all.datoLayer.innerHTML = dato.substr(0, 10);
	document.all.tekstLayer.innerHTML = tekst;
}

function rotateImage(intIndex) {
	if(!arr_Images.length) return
	var int_Index;
	if (intIndex == -1) {
		intCurrent++;
		int_Index = intCurrent;
		if (int_Index >= arr_Images.length) {
			int_Index = 0;
			intCurrent = 0;
		}
	} else {
		int_Index = intIndex;
	}
	if (findBrowser() == "ie") {
		document.getElementById(strIDName).filters[0].apply();
	}
	document.images[strIDName].src = arr_Images[int_Index].src;
	if (findBrowser() == "ie") {
		document.getElementById(strIDName).filters[0].play();
	}
}

function ViewSpecific(intIndex) {
	clearInterval(itvChange);
	setTimeout('rotateImage(' + intIndex + ');', 50);
	intCurrent = intIndex;
}

function StartStandardInterval() {
	itvChange = setInterval('rotateImage(-1)', 5000);
}

function Preload(arr_Image) {	
	if(!arr_Image.length) return
	for(i=0; i< arr_Image.length; i++) {
		var obj_Image = new Image();

		obj_Image.src = arr_Image[i];
		arr_Image[i] = obj_Image;
	}
}

function openImage(imageURL,billedewidth,billedeheight) {
	var myNewWindow = window.open('gallery_popup.asp?image='+imageURL,'viewimage','height='+billedeheight+', width='+billedewidth+', resizable=yes, scrollbars=no');
	myNewWindow.resizeTo(billedewidth,billedeheight)
	myNewWindow.moveTo((window.screen.availWidth -  billedewidth) / 2, (window.screen.availHeight - billedeheight) / 2);
	myNewWindow.focus();
}

function popupImage(id,billedewidth,billedeheight) {
	var myWindowHeight = billedeheight + 65;
	var myWindowWidth = billedewidth + 4 + 18 + 20;
	if (myWindowHeight > window.screen.availHeight) {
		myWindowHeight = window.screen.availHeight;
	/*} else {
		myWindowHeight = document.body.scrollHeight;*/
	}
	var myNewWindow = window.open('popup_image.asp?id='+id,'popupimage','height='+myWindowHeight+', width='+myWindowWidth+', resizable=yes, scrollbars=yes');	
	//myNewWindow.resizeTo(myWindowWidth,myWindowHeight);
	myNewWindow.moveTo((window.screen.availWidth -  myWindowWidth) / 2, (window.screen.availHeight - myWindowHeight) / 2);
	myNewWindow.focus();
}

/*
<span style='cursor:pointer;' onmouseup="openImage('');"></span>
*/





















