var newWin; 

function showWin(PicUrl, PicWidth, PicHeight, WinTitle) {
  if (PicWidth>800||PicHeight>800) {
    if (PicWidth>800) { WinWidth=800; }
    else { WinWidth=PicWidth+16; };
    if (PicHeight>800) { WinHeight=800; }
    else { WinHeight = PicHeight+16; };
    WinResize="yes";
    WinScroll="yes";
  }
  else {
    WinWidth = PicWidth; 
    WinHeight = PicHeight; 
    WinResize="no";
    WinScroll="no";
  }
  if (newWin) newWin.close(); 
  newWin=window.open("", "", "resizable="+WinResize+",scrollbars="+WinScroll+",toolbar=no,location=no,directories=no,status=no,menubar=no,width="+WinWidth+",height="+WinHeight); 
  newWin.document.writeln("<html><head><title>"+WinTitle+"</title></head><body leftmargin=0 topmargin=0><img src='"+PicUrl+"' width="+PicWidth+" height="+PicHeight+"></body></html>"); 
  newWin.document.close();
  newWin.focus(); 
}
