var newWin;
   
function openNewWin(file, winWidth, winHeight, picWidth, picHeight) {
   	if (newWin != null)
   		newWin.close();
   	
   	var screenLeft, screenTop;
   	//screenLeft = Math.floor(screen.width/2 - width/2);
   	//screenTop =  Math.floor(screen.height/2 - height/2);   	 
   	screenLeft = 50;
   	screenTop =  50;   	 
   	newWin = window.open("", "largeImage", "width="+winWidth+",height="+winHeight+",left="+screenLeft+",top="+screenTop);
	
   	newWin.focus();
   	//alert("ok")
   	//alert(newWin.document.getElementById("popup").src);
   	finishWin(file, winWidth, winHeight, picWidth, picHeight)
}
	
function finishWin(file, winWidth, winHeight, picWidth, picHeight) {
	var content;
	content = '<\?xml version="1.0" encoding="ISO-8859-1"?>';
	content += '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">';
	content += '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="da">';
	content += '	<head>';
	content += '		<title>Gorm den gamle</title>';
	content += '	</head>';
	content += '	<body>';
	content += '	<div>';
	content += '		<img src="'+file+'" id="popup" alt="popup billede" height="'+picHeight+'" width="'+picWidth+'" style="position:absolute; top: '+((winHeight-picHeight)/2)+'px; left: '+((winWidth-picWidth)/2)+'px"/>';
	content += '	</div>';
	content += '	</body>';
	content += '</html>';
	newWin.document.write(content);
}
