function image1(name, pic){
		if (document.images){
			document.images[name].src="images/upload/" + pic;
		}
	}
	
function image2(name, pic){
	if (document.images){
		document.images[name].src="images/upload/" + pic;
	}
}

function MM_preloadImages() { //v3.0
		var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
  		var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function calcHeight(){
	topCellHeight = 0;
	if(document.all.topCell){
		topCellHeight = document.all.topCell.offsetHeight;
	}		
	bottomCellHeight = 0;
	if(document.all.bottomCell){
		bottomCellHeight = document.all.bottomCell.offsetHeight;
	}			
	if(document.all.contentCell){		
		height = document.body.clientHeight - topCellHeight - bottomCellHeight;			
		document.all.contentCell.style.height = height;		
	}
}

function resize () {	
	calcHeightWidth();	
}
window.onresize = resize;

function cm_bwcheck(){
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent.toLowerCase()
	this.dom=document.getElementById?1:0
	this.ff =(this.agent.indexOf("firefox")>-1)
	this.op5=(this.agent.indexOf("opera 5")>-1 || this.agent.indexOf("opera/5")>-1) && window.opera 
	this.op6=(this.agent.indexOf("opera 6")>-1 || this.agent.indexOf("opera/6")>-1) && window.opera   
	this.op7=(this.agent.indexOf("opera 7")>-1 || this.agent.indexOf("opera/7")>-1) && window.opera   
	this.op8=(this.agent.indexOf("opera 8")>-1 || this.agent.indexOf("opera/8")>-1) && window.opera   
	this.op9=(this.agent.indexOf("opera 9")>-1 || this.agent.indexOf("opera/9")>-1) && window.opera 
	this.ie5 = (this.agent.indexOf("msie 5")>-1 && !this.op5 && !this.op6)
	this.ie55 = (this.ie5 && this.agent.indexOf("msie 5.5")>-1)
	this.ie6 = (this.agent.indexOf("msie 6")>-1 && !this.op5 && !this.op6)
	this.ie7 = (this.agent.indexOf("msie 7")>-1 && !this.op5 && !this.op6)
	this.ie4=(this.agent.indexOf("msie")>-1 && document.all &&!this.op5 &&!this.op6 &&!this.ie5&&!this.ie6)
	this.ie = (this.ie4 || this.ie5 || this.ie6 || this.ie7)
	this.mac=(this.agent.indexOf("mac")>-1)
	this.ns6=(this.agent.indexOf("gecko")>-1 || window.sidebar)
	this.ns4=(!this.dom && document.layers)?1:0;
	this.bw=(this.ie7 || this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.op5 || this.op6 || this.ff)
	this.usedom= this.ns6 || this.ff //Use dom creation
	this.reuse = this.ie||this.usedom //Reuse layers
	this.px=this.dom&&!this.op5?"px":""
	return this
}
var bw=new cm_bwcheck()

function TjekSearchField(form,text){	
	if ((eval('document.forms.' + form + '.searchStr.value==""')) || (eval('document.forms.' + form + '.searchStr.value.length < 2'))) {
		alert(text);
		return false;		
		}		
	}	
		
function ViewImage(name, width, height) {
	html =  '<html><head><title>Billede</title></head>' +
		'<body style="margin-top:0px; margin-left:0px; margin-right:0px; margin-bottom:0px;" onClick=\'self.close()\' bgcolor=black><table width=100% border=0 cellspacing=0 cellpadding=0><tr><td align="center">' +
		'<img src="../images/upload/' + name + '"></td></tr><tr><td align=center><a href="javascript:self.close();"><font face="Verdana,Geneva,Arial,Helvetica,sans-serif" size="2" color=white>Luk vindue</font></a></td></tr></table></body></html>';
	
   	var isNav4, isIE4;
	if (parseInt(navigator.appVersion.charAt(0)) >= 4) {
		isNav4 = (navigator.appName == "Netscape") ? 1 : 0;				
		isIE4 = (navigator.appName.indexOf("Microsoft") != -1) ? 1 : 0;
	}
	var settings;	
	if (isNav4) {
		settings = 'width=' + (width + 18) + ',height=' + (height + 25) + ',scrollbars=no,status=no,resizable=no,menubar=no';				
	}
	else {
	settings = 'width=' + width + ',height=' + (height + 20) + ',scrollbars=no,status=no,resizable=no,menubar=no';
	}	
	
	var imgWin = window.open('', 'imgWindow', settings);
	
	imgWin.document.open();
	imgWin.document.write(html);
	imgWin.document.close();	
}
function PrintPopUpWin(servername,title,pagename){									
	var content = document.getElementById("divcontent").innerHTML	
	var html = '<html>' +
		'<head>' + 
		'<link href="http://' + servername + '/_css/normal.css" rel="stylesheet" type="text/css">' +
		'<link href="http://' + servername + '/_css/print.css" rel="stylesheet" type="text/css">' +		
		'<title>' + title + ' | ' + pagename + '</title>' +
		'</head>' +
		'<body style="margin-top:10px; margin-left:10px">' + content + '</body>' + 
		'</html>';
	var settings = 'width=800,height=600,scrollbars=1,status=no,resizable=1,menubar=no';
	var win = window.open('', 'imgWindow', settings);
	win.document.open();
	win.document.write(html);
	win.print();
	win.document.close();
}

