var newwindow;
var wheight = 0, wwidth = 0;
function open_img_popup(url, title, iwidth, iheight, colour) {
	var pwidth, pheight;
	
	var newwindow=window.open('','htmlname','width=' + 200 +',height=' +200 + ','  ,'resizable=1,top=50,left=10,buttom=100');
	newwindow.document.clear();
	newwindow.focus();
	newwindow.document.writeln('<html> <head> <title>' + title + '<\/title> ');
	newwindow.document.writeln(' <script>');
	newwindow.document.writeln("function reloadSize() {");
	newwindow.document.writeln(" var theImg = document.getElementById('imagePopUp');");
	newwindow.document.writeln(' window.resizeTo(theImg.width + 30, theImg.height + 150);');
	newwindow.document.writeln('}');
	newwindow.document.writeln(' function onLoadHandler(){');
	newwindow.document.writeln(' reloadSize();');
	newwindow.document.writeln(' }');
	newwindow.document.writeln('window.onLoad = onLoadHandler;');
	newwindow.document.writeln(' <\/script><\/head>'); 
	newwindow.document.writeln('<body onLoad=' + '\'reloadSize()\' ' +  ' bgcolor= \'' + colour + '\'> <center>');
	newwindow.document.writeln('<img id="imagePopUp" src=' + url + ' title=\"' + title + '\" alt=\"' + title + '\" >');
	newwindow.document.writeln('<p>' + title + '</p>');
	newwindow.document.writeln('<\/center>');
	
	newwindow.document.writeln('<\/body> <\/html>');
	newwindow.document.close();
	newwindow.focus();
	var theImg = newwindow.document.getElementById('imagePopUp');
	newwindow.resizeTo(theImg.width + 30, theImg.height + 150);
	wheight=iheight;
	wwidth=iwidth;
}

// Routines to tidy up popup windows when page is left
// Call with an onUnload="tidy5()" in body tag

function img_popup() {
	if (newwindow && !newwindow.closed) { newwindow.close(); }
}
	

