function openImage(imageName,imageWidth,imageHeight,imageInfo) {

	var imageInfobarHeight = 50;
	if (imageWidth < 150) {
		imageInfobarHeight = 75;
	}
	var landscape = screen.availWidth > screen.availHeight;
	var imageWidthHeightRatio = imageWidth/imageHeight;
	var windowWidthHeightRatio = screen.availWidth/screen.availHeight;
	
	var windowWidth = imageWidth*0.9;
	var windowHeight = imageHeight*0.9 + imageInfobarHeight;
	
	if (screen.availWidth - imageWidth < screen.availHeight - imageHeight + imageInfobarHeight) {
		if (imageWidth > screen.availWidth) {
			// windowWidth = screen.availWidth;
			// windowHeight = imageWidth*mageWidthHeightRatio + imageInfobarHeight;
		}
		else {
			// windowWidth = imageWidth;
			// windowHeight = imageHeight + imageInfobarHeight;		
		}
	}
	else {
		if (imageHeight + imageInfobarHeight > screen.availHeight) {
			// windowHeight = screen.availHeight;
			// windowWidth = imageHeight*imageWidthHeightRatio;
		} 
		else {
			// windowWidth = imageWidth;
			// windowHeight = imageHeight + imageInfobarHeight;
		}
	}
	
	var newWindow = window.open('','newWindow','resizable=no,scrollbars=no,width='+windowWidth+',height='+windowHeight+',left=100,top=0');
	
	newWindow.document.open();
	newWindow.document.writeln('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
	newWindow.document.writeln('<html xmlns="http://www.w3.org/1999/xhtml">');
	newWindow.document.writeln('<head>');
	newWindow.document.writeln('<title>Hendrik Barth</title>');
	newWindow.document.writeln('<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />');
	newWindow.document.writeln('<style type="text/css">');
	newWindow.document.writeln('.imagetitle {font-family: Arial, Helvetica, sans-serif;font-size: 15px;}');
	newWindow.document.writeln('</style>');
	newWindow.document.writeln('</head>');
	newWindow.document.writeln('<body bgcolor="#CCCCCC" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onblur="self.close()" onclick="self.close()">');
	// newWindow.document.writeln('<body bgcolor="#CCCCCC" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0">');
	newWindow.document.writeln('<img src="'+imageName+'" width="'+windowWidth+'" alt="">');
	newWindow.document.writeln('<table height="50" align="center"><tr><td valign="middle" class="imagetitle"><span class="imagetitle">'+imageInfo+'</span></td></tr></table>');
	newWindow.document.writeln('</body></html>');
	newWindow.document.close();
    newWindow.focus();
}

