function ResizeToFit(dlg, picHeight, picWidth) {

 var imgWidth;
 var imgHeight;

 imgWidth = picWidth + 60; 
 imgHeight = picHeight + 110;
 dlg.resizeTo(imgWidth, imgHeight);
}


function DisplayLargeImage(img, name, width, height){
 newwidth = parseInt(width) + 60;
 newheight = parseInt(height) + 170;

 features = 
    "toolbar=no,location=no,directories=no,status=no,menubar=no," +
    "scrollbars=no,resizable=no,width=" + newwidth + ",height=" + newheight;
 dlg = window.open ("","",features);
// dlg.focus();
 dlg.document.write("<html><head><title>" + name + " Zoom</title><link rel=\"stylesheet\" href=\"/lib/newhorizontoys/styles.css\" type=\"text/css\"></head>");


// dlg.document.write("<body bgcolor=white onLoad=\"javascript:opener.ResizeToFit(self,  parseInt(picImg.height) + 60, picImg.width); this.focus();\"><center>");
 dlg.document.write("<body>");
 dlg.document.write("<div id=popup>");
 dlg.document.write("<table width=100% height=100% align=center>");
 dlg.document.write("<tr><td align=\"center\" ><h1>" + name + "</h1></td></tr>");
 dlg.document.write("<tr><td align=center valign=middle>");
 dlg.document.write("<img name=\"picImg\" src=" + img + ">");
 dlg.document.write("</td></tr>");
 dlg.document.write("<tr><td align=center valign=middle>");
 dlg.document.write("<a href=# onClick=window.close();>");
 dlg.document.write("Click to close</a>");
 dlg.document.write("</td></tr>");
 dlg.document.write("</table></div></body></html>");

// dlg.document.close();

}

