function OpenPhoto(img,x,y,wtitle) {
  // path, width, height and title as arguments
  var msgWindow = window.open('','','Width=' + String((+x)+25) + ',Height=' + String((+y)+100) + ',scrollbars=yes,resizable=yes');
  doc = msgWindow .document;
  doc.open('text/html');
  doc.write('<HTML><HEAD><TITLE>' + wtitle + '<\/TITLE><\/HEAD><BODY bgcolor="white">');
  doc.write('<IMG SRC="' + img + '">');
  doc.write('<form name="viewn"><input type="button" value="Close Window" onClick="self.close()"><\/form><\/BODY><\/HTML>');
  doc.close();
}
