var win;

function ViewImagef(ifile,ix,iy,ititle,frame) {
var win;
var wWidth;
var wHeight;
var reduce = 1;
var aH = screen.availHeight-75, aW = screen.availWidth-75;
var lx=ix+33;
var by=iy+33;
if (aH < iy + 100 || aW < ix + 100) {
	reduce = aH / (iy + 100.0);
	if ((aW / (ix + 100.0 ) ) < reduce ) {
		reduce = aW / (ix + 100.0);
	}
	ix = reduce * ix;
	ix = ix - ix%1;
	iy = reduce * iy;
	iy = iy - iy%1;
}
wHeight=iy+96;  // these sizes are the smallest which works for IE6 on Windows
wWidth=ix+96;
win = window.open("","imageviewer","width="+wWidth+",height="+wHeight+",menubar=no,toolbar=no");
win.window.resizeTo(wWidth,wHeight);
win.document.open();
win.document.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\n\"http://www.w3.org/TR/html4/loose.dtd\">\n<html><head><title>"+ititle+"</title>");
win.document.write("</head>\n<body style=\"margin: 0 0 0 0;\">\n");
//win.document.write("<style><!-- body { margin: 0 0 0 0; } --></style>");

win.document.write("<div style=\"position: absolute; left: 0px; top: 0px; width: 33px; height: 33px\"><img src=\""+frame+"_ul.jpg\" width=33 height=33></div>\n");
win.document.write("<div style=\"position: absolute; left: 33px; top: 0px; width: "+ix+"px; height: 33px\"><img src=\""+frame+"_t.jpg\" width="+ix+" height=33></div>\n");
win.document.write("<div style=\"position: absolute; left: "+lx+"px; top: 0px; width: 33px; height: 33px\"><img src=\""+frame+"_ur.jpg\" width=33 height=33></div>\n");

win.document.write("<div style=\"position: absolute; left: 0px; top: 33px; width: 33px; height: "+iy+"px\"><img src=\""+frame+"_l.jpg\" width=33 height="+iy+"></div>\n");
win.document.write("<div style=\"position: absolute; left: 33px; top: 33px; width: "+ix+"px; height: "+iy+"px\"><img src=\""+ifile+"\" width="+ix+" height="+iy+"></div>\n");
win.document.write("<div style=\"position: absolute; left: "+lx+"px; top: 33px; width: 33px; height: "+iy+"px\"><img src=\""+frame+"_r.jpg\" width=33 height="+iy+"></div>\n");

win.document.write("<div style=\"position: absolute; left: 0px; top: "+by+"px; width: 33px; height: 33px\"><img src=\""+frame+"_ll.jpg\" width=33 height=33></div>\n");
win.document.write("<div style=\"position: absolute; left: 33px; top: "+by+"px; width: "+ix+"px; height: 33px\"><img src=\""+frame+"_b.jpg\" width="+ix+" height=33></div>\n");
win.document.write("<div style=\"position: absolute; left: "+lx+"px; top: "+by+"px; width: 33px; height: 33px\"><img src=\""+frame+"_lr.jpg\" width=33 height=33></div>\n");
win.document.close();
var oW=ix+81, oH = iy+83;  // do not ask why this is 81 and not 66
var myW = 0, myH = 0, d = win.document.documentElement, b = win.document.body;
if( win.innerWidth ) {
	myW = win.innerWidth; myH = win.innerHeight;
}
else if( d && d.clientWidth ) {
	myW = d.clientWidth; myH = d.clientHeight;
}
else if( b && b.clientWidth ) {
	myW = b.clientWidth; myH = b.clientHeight;
}
if( window.opera && !document.childNodes ) {
	myW += 16;
}
win.resizeTo( 2*oW - myW , 2*oH - myH ); 
win.window.focus();
}

function ViewImage(ifile,ix,iy,ititle) {
   ViewImagef(ifile,ix,iy,ititle,'frame043')
}

