
function ImgShwDyn( ID, width, height, alt )
{
   var scroll;
   scroll="no";
   var top=10, left=10;

   var sUrl = ID;

   width = Math.min(width, screen.width-10);
   height = Math.min(height, screen.height-28);

   var wnd = window.open( "","","scrollbars="+scroll+",resizable=yes,width="+width+",height="+height+",left="+left+",top="+top);
   wnd.document.write(
   "<html><head>"+
   "<"+"script type=\"text/javascript\">"+
   "function KeyPress(e)"+
   "{"+
   " if ( window.event ) {"+
   "   if (window.event.keyCode == 27) "+
   "     window.close();"+
   " } else if ( e.keyCode == 27 ) {" +
   "   window.close(); }" +
   "}"+

   "function CheckImg()"+
   "{ "+
   "   var nW, nH, oEl;" +
   "   oEl = document.getElementById('img_zzzz'); "+
   "   nW = (oEl.width <= 790) ? oEl.width : 790; "+
//   "   nH = (oEl.height <= 570) ? oEl.height : 570; "+
   "   oEl.style.width  = nW+'px';"+
   "} "+

   "</"+"script>"+
   "<title>"+(alt == ""? "''":alt)+"</title>"+
   "<style>"+
   "  body { "+
   "    padding : 0;" +
   "    margin  : 0;" +
   "    text-align: center;" +
   "  } "+
   "</style>"+
   "</head>"+
//   "<body topmargin=\"0\" leftmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" onLoad=\";try{window.sizeToContent(this);window.sizeToContent(this);} catch(ex){}\" onKeyPress=\"KeyPress(event)\">"+
   "<body topmargin=\"0\" leftmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" onLoad=\"\" onKeyPress=\"KeyPress(event)\">"+

   "<img id='img_zzzz' src='"+sUrl+"' border=\"0\" alt=\""+alt+"\" onload=\"CheckImg();\"/>"+

   "<scri"+"pt type='text/javascript'>"+
//   " if (navigator.userAgent.indexOf('MSIE') != -1 )" +
   " {"+
   "    oImg = new Image(); oImg.src = '"+sUrl+"';"+

   "    oImg.onload = function() { "+
   "        nW = (oImg.width <= 790) ? oImg.width : 790; "+   // 800
   "        nH = (oImg.height <= 570) ? oImg.height : 570; "+ // 600
   "        window.resizeTo( nW + 10, nH + 50 ); "+
   "      } "+
   " }"+

   "</script>"+

   "</body></html>"
   );
   wnd.document.close();
}


function ShowDynamicImage( ID, width, height, alt )
{
   var scroll;
   scroll="no";
   var top=10, left=10;
   var sUrl = '/img/' + ID + '.jpg';

/*
   if(width > screen.width-10 || height > screen.height-28) scroll = "yes";
   if(height < screen.height-28) top = Math.floor((screen.height - height)/2-14);
   if(width < screen.width-10) left = Math.floor((screen.width - width)/2-5);
*/

   width = Math.min(width, screen.width-10);
   height = Math.min(height, screen.height-28);

   var wnd = window.open( "","","scrollbars="+scroll+",resizable=yes,width="+width+",height="+height+",left="+left+",top="+top);
   wnd.document.write(
   "<html><head>"+
   "<"+"script type=\"text/javascript\">"+
   "function KeyPress(e)"+
   "{"+
   " if ( window.event ) {"+
   "   if (window.event.keyCode == 27) "+
   "     window.close();"+
   " } else if ( e.keyCode == 27 ) {" +
   "   window.close(); }" +
   "}"+
   "</"+"script>"+
   "<title>"+(alt == ""? "''":alt)+"</title>"+
   "<style>"+
   "  body { "+
   "    padding : 0;" +
   "    margin  : 0;" +
   "    text-align: center;" +
   "  } "+
   "</style>"+
   "</head>"+
   "<body topmargin=\"0\" leftmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" onLoad=\";try{window.sizeToContent(this);window.sizeToContent(this);} catch(ex){}\" onKeyPress=\"KeyPress(event)\">"+
   "<scri"+"pt type='text/javascript'>"+
   " if (navigator.userAgent.indexOf('MSIE') != -1 )" +
   " {"+
   "    oImg =  new Image(); oImg.src = '"+sUrl+"';"+
   "    oImg.onload = function() { "+
   "        nW = oImg.width; "+
   "        nH = oImg.height; "+
   "        window.resizeTo( nW + 10, nH + 30 ); "+
   "      } "+
   " }"+
   "</script>"+
   "<img id='img_zzzz' src=\""+sUrl+"\" border=\"0\" alt=\""+alt+"\" />"+
   "</body></html>"
   );
   wnd.document.close();
}
