//IE5+, Mozilla 1.0+, Opera 7+
function getClientWidth()
{
  return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;
}

function getClientHeight()
{

  a = document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;
  if (a<550)a=550;
  if (a>780)a=700;
  if (window.opera) a=a+20
  return a
}

function ImgShw(ID, width, height, alt)
{
        var scroll = "no";
        var top=0, left=0;
        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()"+
                "{"+
                "        if(window.event.keyCode == 27) "+
                "                window.close();"+
                "}"+
                "</"+"script>"+
                "<title>"+(alt == ""? "Картинка":alt)+"</title></head>"+
                "<body topmargin=\"0\" leftmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" onKeyPress=\"KeyPress()\">"+
                "<img src=\""+ID+"\" border=\"0\" alt=\""+alt+"\" />"+
                "</body></html>"
        );
        wnd.document.close();
}

