var viewimage = null ;

function browserVersion() {
  // Get the version of the browser.
  var BVer = navigator.appVersion.substring(0,3) ;
  return parseFloat(BVer) ;
}

function showpic(picName,picWidth,picHeight) {

   // Check that this will work.
   if (browserVersion() < 3) {
      exit ;
   }

   // Define offsets from main window.
   xOffset = 0 ;
   yOffset = 0 ;

   if (!picWidth) {
      picWidth = 400 ;
   } else {
	  picWidth = picWidth + 20 ;
   }

   if (!picHeight) {
      picHeight = 480 ;
   } else {
	  picHeight = picHeight + 20 ;
   } 

   pageName = 'viewpic.php?pic=' + picName ;

   // (Re)open the window at the correct size.
   if (!viewimage) {
   	viewimage = window.open(pageName,"viewimage", "height=" + picHeight + ",width=" + picWidth + ",screenX=" + xOffset + ", screenY=" + yOffset + ", top=" + yOffset + ",left=" + xOffset + ",scrollbars=no") ;
   } else {
      viewimage.close() ;
   	  viewimage = window.open(pageName,"viewimage", "height=" + picHeight + ",width=" + picWidth + ",screenX=" + xOffset + ", screenY=" + yOffset + ", top=" + yOffset + ",left=" + xOffset + ",scrollbars=no") ;
   }
}
