// JavaScript Document
// Author:			T. J. Houzet - Digital dialects (www.digitaldialects.co.za)
// Date Created:	27 July 2004
// Last Updated:	07 October 2004
// Description:		Opens a window to display an image of an unknown resolution.
var imageFile = '';
var imageWidth = 0;
var imageHeight = 0;
var imageName = '';
var textCellHeight = 0;
var windowHeight = 0;
var imageWindow;
var windowOpen = false;

function openImage(imageFile, imageWidth, imageHeight, imageDescription, windowName) {
	
	if(document.all) {
	imageHeight = parseInt(imageHeight) + 100;
	}
	windowHeight = imageHeight  + textCellHeight;
	left = (imageWidth - 80)/2;
	upper = (imageHeight - 30)/2;
	
	imageWindow = window.open('', 'DDBC', 'resizable=0,top=0,left=0');
	imageWindow.resizeTo(imageWidth, imageHeight);
	imageWindow.innerWidth = imageWidth;
	imageWindow.innerHeight = imageHeight;
	imageWindow.focus();
	
	imageWindow.document.open();
	imageWindow.document.writeln('<html>');
	imageWindow.document.writeln('<head>');
	imageWindow.document.write('<title>');
	imageWindow.document.write(imageDescription + ' - ' + imageWidth + 'x' + (imageHeight - 25) + ' - ' + windowName);
	imageWindow.document.writeln('</title>');
	imageWindow.document.writeln('<meta http-equiv="pragma" content="no-cache">');
	imageWindow.document.writeln('</head>');
	imageWindow.document.writeln('<body leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0" bgcolor="">');
	imageWindow.document.writeln('<div id="loader" style="position:absolute;left:' + left + 'px; top:' + upper + 'px;z-index:1">');
	imageWindow.document.writeln('<img src="resources/graphics/gif/loader.gif">');
  	imageWindow.document.writeln('</div >');
	imageWindow.document.writeln('<table align="center" border="0" cellpadding="0" cellspacing="0">');
	imageWindow.document.writeln('<tr>');
	imageWindow.document.writeln('<td>');
	imageWindow.document.writeln('<div id="image" style="position:absolute;left:0px;top:0px;z-index:2">');
	imageWindow.document.writeln('<img alt="' + imageFile + '" title="' + imageDescription + '" src="' + imageFile + '">');
	imageWindow.document.writeln('</div >');
	imageWindow.document.writeln('</td>');
	imageWindow.document.writeln('</tr>');
	imageWindow.document.writeln('</table>');
	imageWindow.document.writeln('</body>');
	imageWindow.document.writeln('</html>');
	imageWindow.document.close();
}

function openWin(page, winName, xWidth, yHeight) {
	infoWindow = window.open('', 'DDBC', 'width='+xWidth+',height='+yHeight+',toolbar=no,location=no,status=no,menubar=no,resizable=0,top=0,left=0');
	infoWindow.document.location = page;
	//window.open(page,winName,'width='+xWidth+',height='+yHeight+',toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no,top=0,left=0');
}