/*---------------------------------------------------*/
/* Viper Core File : js_image_popup.js               */
/*                                                   */
/* Popup Image Viewer                                */
/*                                                   */
/* This function displays an image in a popup window */
/*---------------------------------------------------*/
function popimage(dir,imagename,imagesrc,imagewidth,imageheight) {

  winwidth = imagewidth + 30;
  winheight = imageheight + 140;
  
  var winleft = (screen.width - winwidth) / 2;
  var wintop = (screen.height - winheight) / 2;
  
  if (wintop<0) wintop=0;
  if (winleft<0) winleft=0;
  
  var look='top='+wintop+',screenY='+wintop+',left='+winleft+',screenX='+winleft+',width='+winwidth+',height='+winheight+',';
      look=look+',toolbar=0,scrollbars=0,location=0,status=no,menubar=0,resizable=0';
  
  popwin=window.open("","imagepopup",look)
  popwin.document.open()
  popwin.document.write('<html>\n')
  popwin.document.write('<head>\n')
  popwin.document.write('<link rel="stylesheet" type="text/css" href="'+dir+'stylesheets/image_popup.css" />\n')
  popwin.document.write('  <title>'+imagename+'</title>\n')
  popwin.document.write('</head>\n')
  popwin.document.write('<body>\n')
  popwin.document.write('  <p><img src="'+imagesrc+'" alt="'+imagename+'" /><br /><b>'+imagename+'</b></p>\n')
  popwin.document.write('  <p><a href="javascript:self.close()">[Close Popup]</a></p>\n');
  popwin.document.write('</body>\n')
  popwin.document.write('<html>')
  popwin.document.close()
  
  // Just in case width and height are ignored
  popwin.resizeTo(winwidth, winheight);
  // Just in case left and top are ignored
  popwin.moveTo(winleft, wintop);

}

/* Place in IMG tag 
onClick="popimage('name','../images/image.jpg',600,400);return false"
*/