function changeImage(img) {
document.getElementById('popup').innerHTML="<img src=\""+ img +"\" id=\"mainimage\" border=\"0\" align=\"middle\" vspace=\"0\" >";
}

function ResizeToFit(dlg, picHeight, picWidth) {
 var imgWidth;
 var imgHeight;
 
 imgWidth = 560; 
 imgHeight = picHeight + 195;
 dlg.resizeTo(imgWidth, imgHeight);
}

function popupImage(img, name, width, height){

 features = 
    "toolbar=no,location=no,directories=no,status=no,menubar=no," +
    "scrollbars=no,resizable=no,width=" + width + ",height=" + height;
 dlg = window.open ("","Details",features);
 dlg.document.write("<html><head><title></title><link type=\"text/css\" rel=\"stylesheet\" href=\"http://yst.britchesnstitches.com/css/style.css\" /></head>");

 dlg.document.write("<body onLoad=\"javascript:opener.ResizeToFit(self, picImg.height, picImg.width);\"><center>");
 dlg.document.write("<table width=\"550\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">  <tr>    <td align=\"left\" valign=\"top\" class=\"enlarge-main-area\"><table width=\"526\" border=\"0\" align=\"left\" cellpadding=\"0\" cellspacing=\"0\"><tr>  <td align=\"left\" valign=\"top\"><a href=\"javascript:window.close();\"><img src=\"http://yst.britchesnstitches.com/images/btn-close.jpg\" alt=\"\" width=\"60\" height=\"19\" border=\"0\" class=\"btn-close\" /></a><img src=\"http://yst.britchesnstitches.com/images/enlarge-logo.jpg\" alt=\"\" width=\"248\" height=\"56\" border=\"0\" /></td></tr><tr>  <td align=\"left\" valign=\"top\"><table width=\"526\" border=\"0\" align=\"left\" cellpadding=\"0\" cellspacing=\"0\">    <tr><td width=\"4\" align=\"left\" valign=\"top\" class=\"heading-lft-crv-bg-clr\"><img src=\"http://yst.britchesnstitches.com/images/enlarge-pro-name-lft-crv.jpg\" alt=\"\" width=\"4\" height=\"30\" border=\"0\" /></td><td align=\"right\" valign=\"top\" class=\"enlarge-heading\">" + name + "</td>    </tr>  </table></td></tr><tr>  <td align=\"left\" valign=\"top\"><img src=\"http://yst.britchesnstitches.com/images/spacer.gif\" alt=\"\" width=\"1\" height=\"1\" border=\"0\" class=\"float-lft\" /></td></tr><tr>  <td  align=\"center\" valign=\"middle\" class=\"enlarge-main-img\"><img name=\"picImg\" src=" + img + " id=\"mainimage\"/></span></td></tr>    </table></td>  </tr></table></body></html>");


 dlg.document.close();
}