
function ViewImage(ifile,ix,iy,ititle) { 
var win;
var sWidth;
var sHeight;
var NS = (document.layers) ? 1 : 0;

var img = new Image();
img.src = ifile;

var imgHeight = img.height;
var imgWidth = img.width;

//alert("image " + ifile +  "image height = " + imgHeight + ", image width = " + imgWidth);

if (imgHeight == 0 && imgWidth == 0) {
	imgHeight = iy;
	imgWidth = ix;
}

win = window.open("", "imageviewer", "width=" + imgWidth + ",height=" + imgHeight + ",location=no,menubar=no,toolbar=no");
//win = window.open("","imageviewer","width="+ix+",height="+iy+",location=no,menubar=no,toolbar=no");
//if (NS) {
//sWidth = win.innerWidth;
//sHeight = win.innerHeight;
//} else {
//sWidth = win.document.body.clientWidth;
//sHeight = win.document.body.clientHeight;
//}
//if(sWidth!=ix || sHeight!=iy) {
//win.close();
//setTimeout("ViewImage('"+ifile+"',"+ix+","+iy+",'"+ititle+"')", 250);
//return;
//}
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('<div style="position:absolute;width:' + imgWidth + 'px;height:' + imgHeight + 'px;left:0px;top:0px">');
win.document.write("<img src=" + ifile + "></div></body></html>");
win.document.close();
}


