var newwindow;
var wheight = 0, wwidth = 0;

function openNewWindow(url, iwidth, iheight, title, description, windowFeatures) {
var pwidth, pheight;

if ( !newwindow || newwindow.closed ) {
pwidth=iwidth;
pheight=iheight;
newwindow=window.open('','htmlname','width=' + pwidth +',height=' +pheight + ',' + windowFeatures);
wheight=iheight;
wwidth=iwidth;
}

if (wheight!=iheight || wwidth!=iwidth ) {
pwidth=iwidth;
pheight=iheight;
newwindow.resizeTo(pwidth, pheight);
wheight=iheight;
wwidth=iwidth;
}

newwindow.document.clear();
newwindow.focus();
newwindow.document.writeln('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">');
newwindow.document.writeln('<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">');
newwindow.document.writeln('<head>');
newwindow.document.writeln('    <title>' + description + '</title>');
newwindow.document.writeln('    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />');
newwindow.document.writeln('    <style type="text/css" media="all">@import "css/base.css";</style>');
newwindow.document.writeln('</head>');
newwindow.document.writeln('<body>');
newwindow.document.writeln('	<div id="outerwrapper">');
newwindow.document.writeln('		<img src="' + url + '" width="' + iwidth + '" height="' + iheight + '" alt="" />');
newwindow.document.writeln('	</div>');
newwindow.document.writeln('</body>');
newwindow.document.writeln('</html>');
newwindow.document.close();
newwindow.focus();

}

// Routines to tidy up popup windows when page is left
// Call with an onUnload="tidy()" in body tag

function tidy() {
if (newwindow && !newwindow.closed) { newwindow.close(); }
}