var aWindow="";

function showImage(imageName,imageWidth,imageHeight)
 {
  var winX=0; var winY=0;

  // if parameters are zero, use full screen
  if (imageWidth==0)
   {
    imageWidth=window.screen.width-10;
   }
  else
   {
    imageWidth=imageWidth+16;
   }
  if (imageHeight==0)
   {
    imageHeight=window.screen.height-70;
   }
  else
   {
    imageHeight=imageHeight+30;
   }

  if (parseInt(navigator.appVersion)>3)
   {
    if (navigator.appName=="Netscape")
     {
      // position image in centre of physical screen
      winX=(window.screen.width-imageWidth)/2;
      winY=(window.screen.height-imageHeight)/2;
     }
    if (navigator.appName.indexOf("Microsoft")!=-1)
     {
      // position image in centre of physical screen
      winX=(window.screen.width-imageWidth)/2;
      winY=(window.screen.height-imageHeight)/2;
     }
   }

  // drag X position left slightly as it looks better
  winX=winX-10;
  // if X position is off the screen, default to zero
  if (winX<0)
   {
    winX=0;
   }

  // lift Y position slightly as it looks better
  winY=winY-80;
  // if Y position is off the screen, default to zero
  if (winY<0)
   {
    winY=0;
   }

  if (aWindow && !aWindow.closed)
   {
    aWindow.close();
   }
  aWindow = window.open(imageName,"imagewindow",
          "left="+winX+",top="+winY+",width="+imageWidth+",height="+imageHeight+
          ",toolbar=no,status=no,scrollbars=no,resizable=yes,menubar=no");
 }
