

var isIE = (navigator.appName.indexOf("Microsoft")!=-1)?true:false;

function GetElement(strElement) {
	if (document.getElementById) {
		// IE5+, Netscape 6, Mozilla
		return (document.getElementById(strElement));
	} else if (document.all) {
		// IE4
		return (eval("document.all." + strElement));
	} else if (document.layers) {
		// Netscape 4
		return (eval("document." + strElement));
	} else {
		// Crap!
		return (null);
	}
}


function dkOver() {
	GetElement("dkTable").style.backgroundColor="#E2E7D8";
}

function dkOut() {
	GetElement("dkTable").style.backgroundColor="transparent";
}

function WorldOver() {
	GetElement("worldTable").style.backgroundColor="#E2E7D8";
}

function WorldOut() {
	GetElement("worldTable").style.backgroundColor="transparent";
}

function changedist() {
	var selectChosen = GetElement("selectm").options[GetElement("selectm").selectedIndex].value;
	
	window.location.href="korssting.asp?pagesize="+selectChosen+"&page=1";
}

function changedistm(grp) {
	var selectChosen = GetElement("selectk").options[GetElement("selectk").selectedIndex].value;
	
	window.location.href="produkter.asp?step=2&pagesize="+selectChosen+"&Varegrp="+grp+"&page=1";
}

function changedistg() {
	var selectChosen = GetElement("selectg").options[GetElement("selectg").selectedIndex].value;
	
	window.location.href="produkter.asp?step=44&pagesize="+selectChosen+"&page=1";
}

function popWin(file,name){
	var winleft = (screen.width - 500) / 2;
	var winUp = (screen.height - 300) / 2;

	winProp = 'width=800,height=300,left='+winleft+',top='+winUp+',status=off,resizable=yes'

	newWin=window.open("","ResizeBillede",winProp);
	txt='<ht'+'ml><he'+'ad><ti'+'tle>'+name+'<\57ti'+'tle><scri';
	txt+='pt language="javascript" type="text/javascript">';
	txt+='function resPic(){h=parseInt(document.images[0].scrollHeight)-parseInt(8);';
	txt+='w=document.images[0].scrollWidth;window.resizeTo(w+8,h+65);}<\57scri';
	txt+='pt><\57he'+'ad><bo'+'dy style="overflow:hidden;';
	txt+='border:0px;margin:0px"><a onclick="window.close();" alt="Luk vindue"><i'+'mg src="'+file+'" style="top:0px;left:0px;border:0px;';
	txt+='" onload="resPic();"><\57a><\57bo'+'dy><\57ht'+'ml>';
	newWin.document.write(txt);
	newWin.document.close();
}

function Thumbnaillist(pImageURL,maxX,maxY,picID) {
	var img=new Image();
    img.src=pImageURL;
    var w = img.width;
    var h = img.height;
	var maxW = maxX;
	var maxH = maxY;
	
	if(w < maxW && h < maxH) {
		document.getElementById(picID).style.width = w+'px';
		document.getElementById(picID).style.height = h+'px';
	}else{
		var NewH = parseFloat((h*maxW)/w);
		var NewW = parseFloat(w*(maxH/h));
		
		if(NewH > maxH){
			document.getElementById(picID).style.width = NewW+'px';
			document.getElementById(picID).style.height = h+'px';
		}else{
			document.getElementById(picID).style.width= w+'px';
			document.getElementById(picID).style.height = NewH+'px';
		}
	}
    return false;
}

function fixImgs() {
	var maxW = 176;
	var maxH = 99;
	var pix=document.getElementsByTagName('img');
	var _resizeClass = 'iepic';
	
	for (i=0; i<pix.length; i++) {
		var imgObj = pix[i];
		if ( imgObj.className == _resizeClass ) {
		   w=imgObj.width;
		   h=imgObj.height;
		
			if(w < maxW && h < maxH) {
				imgObj.style.width = w + 'px';
				imgObj.style.height = h + 'px';
			}else{
				if(h > maxH){
					f=1-((h - maxH) / h);
					imgObj.style.width = parseInt(w * f) + 'px';
					imgObj.style.height = parseInt(h * f) + 'px';
				}else{
					f=1-((w - maxW) / w);
					imgObj.style.width = parseInt(w * f) + 'px';
					imgObj.style.height = parseInt(h * f) + 'px';
				}
			}
		}
	}
}

function fixImgs2() {
	var maxW = 200;
	var maxH = 200;
	var pix=document.getElementsByTagName('img');
	var _resizeClass = 'iepic';
	
	for (i=0; i<pix.length; i++) {
		var imgObj = pix[i];
		if ( imgObj.className == _resizeClass ) {
		   w=imgObj.width;
		   h=imgObj.height;
		
			if(w < maxW && h < maxH) {
				imgObj.style.width = w + 'px';
				imgObj.style.height = h + 'px';
			}else{
				if(w > maxW){
					f=1-((w - maxW) / w);
					imgObj.style.width = parseInt(w * f) + 'px';
					imgObj.style.height = parseInt(h * f) + 'px';
				}else{
					f=1-((h - maxH) / h);
					imgObj.style.width = parseInt(w * f) + 'px';
					imgObj.style.height = parseInt(h * f) + 'px';
				}
			}
		}
	}
}

function Thumbnail(pImageURL,maxX,maxY) {
	var img=new Image();
    img.src=pImageURL;
    var w = img.width;
    var h = img.height;
	var maxW = maxX;
	var maxH = maxY;
	
	if(w < maxW && h < maxH) {
		img.width = w;
		img.height = h;
	}else{
		var NewH = parseFloat((h*maxW)/w);
		var NewW = parseFloat(w*(maxH/h));
		
		if(NewH > maxH){
			img.width = NewW;
			img.height = h;
		}else{
			img.width = w;
			img.height = NewH;
		}
	}
    return false;
}


function changepro() {
	GetElement("propic").style.display="block";
	GetElement("produktion").style.backgroundImage="url(gfx/produktion-dk.gif)";
}

function changeout() {
	GetElement("propic").style.display="none";
	GetElement("produktion").style.backgroundImage='none';
}

function changeprok() {
	GetElement("prokpic").style.display="block";
	GetElement("produkter").style.backgroundImage="url(gfx/produkter-dk.gif)";
}

function changeout2() {
	GetElement("prokpic").style.display="none";
	GetElement("produkter").style.backgroundImage='none';
}

function changeforh() {
	GetElement("forhpic").style.display="block";
	GetElement("forhandler").style.backgroundImage="url(gfx/forhandler-dk.gif)";
}

function changeout3() {
	GetElement("forhpic").style.display="none";
	GetElement("forhandler").style.backgroundImage='none';
}

function changeinfo() {
	GetElement("infopic").style.display="block";
	GetElement("information").style.backgroundImage="url(gfx/information-dk.gif)";
}

function changeout4() {
	GetElement("infopic").style.display="none";
	GetElement("information").style.backgroundImage='none';
}

function changekors() {
	GetElement("korspic").style.display="block";
	GetElement("korssting").style.backgroundImage="url(gfx/korssting-dk.gif)";
}

function changeout5() {
	GetElement("korspic").style.display="none";
	GetElement("korssting").style.backgroundImage='none';
}