var wnd; 

function showWin(PicUrl, PicWidth, PicHeight, WinTitle) {
  PicWidth = PicWidth + 40;
  PicHeight = PicHeight + 40;
  if (PicWidth>screen.width||PicHeight>screen.height) {
    if (PicWidth>screen.width) { WinWidth=screen.width; }
    else { WinWidth=PicWidth+20; };
    if (PicHeight>screen.height) { WinHeight=screen.height; }
    else { WinHeight = PicHeight+20; };
    WinResize="yes";
    WinScroll="yes";
  }
  else {
    WinWidth = PicWidth+20; 
    WinHeight = PicHeight+20; 
    WinResize="no";
    WinScroll="no";
  }
  if (!WinTitle) WinTitle="";
  if (wnd) wnd.close(); 
  wnd=window.open("", "", "resizable="+WinResize+",scrollbars="+WinScroll+",width="+WinWidth+",height="+WinHeight); 
  wnd.document.writeln("<html><title>"+WinTitle+"</title><body leftmargin=0 topmargin=0><p align=center><img src="+PicUrl+" width="+PicWidth+" height="+PicHeight+" border=0></p></body></html>"); 
  wnd.document.close();
  wnd.focus(); 
}
