var NewWindow=null;

function ShowImage(ImgSource,ImgWidth,ImgHeight,ImgAlt) { 
   var divWidth=ImgWidth;
   var divHeight=ImgHeight;
   window.status='Click Here';
      if (NewWindow!=null && !NewWindow.closed) {
      NewWindow.close();
   }
   
   if(ImgWidth>(screen.width-80))
   { 
      divWidth=screen.width - 80;
   }
   if(ImgHeight>(screen.height-120))
   { 
      divHeight = screen.height - 120;
      if(divWidth<(screen.width - 80)) divWidth+=17;
   }
   else
   {
      if(divWidth==(screen.width - 80)) divHeight+=17;
   }

   var WinLeft=Math.floor((screen.width-divWidth)/2);
   var WinTop=Math.floor((screen.height-divHeight)/2) - 30;
   var WinAppearence;
   
   if(divWidth==(screen.width - 80) || divHeight==(screen.height - 120))
   {
       WinAppearence = 'scrollbars=yes, toolbar=no, resizable=no, menubar=no, status=no, width='+(divWidth)+',height='+(divHeight)+',top='+WinTop+',left='+WinLeft;
   }
   else
   {
       WinAppearence = 'scrollbars=no, toolbar=no, resizable=no, menubar=no, status=no, width='+(divWidth)+',height='+(divHeight)+',top='+WinTop+',left='+WinLeft;
   }
   
   var Hypertext = '<html><head><title></title></head><body style="background-color:#000000; margin:0;">';
   
   Hypertext += '<table border="0" cellspacing="0" cellpadding="0" style="width:'+(ImgWidth)+'px; height:'+(ImgHeight)+'px;"><tbody><tr><td onContextMenu="window.close(); return false;" onClick="window.close(); return false;"><img src="' + ImgSource + '" width="' + ImgWidth + 'px" height="' + ImgHeight + 'px" alt="' + ImgAlt + '" /></td></tr></tbody></table></body></html>'

   NewWindow=window.open('','NewWindow',WinAppearence);
   NewWindow.document.writeln(Hypertext);
   NewWindow.focus();
}