var win = null;

function ViewImage(ifile,ix,iy,ititle) { 

var newy = iy + 50;

if (win && !win.closed) {
	win.close();
	}

win = window.open("","imageviewer","width="+ix+",height="+newy+",menubar=no,toolbar=no");

win.document.open();
win.document.write("<html><head><title>"+ititle+"</title>");
win.document.write("</head><body>");
win.document.write('<div style="position:absolute;width:'+ix+'px;height:'+iy+'px;left:0px;top:0px">');
win.document.write("<img src="+ifile+"></div>");
win.document.write('<div style="position:absolute;width:'+ix+'px;height:50px;left:0px;top:'+iy+'px">');
win.document.write('<center><form><input type="button" value="Close Window" onClick="window.close()" style="margin-left:auto;margin-right:auto;margin-top:1em"></form>');
win.document.write("</center></div></body></html>");
win.document.close();
}