function winopen(sURL, sName, sFeatures, bReplace)
{
    var win = window.open(sURL, sName, sFeatures, bReplace);

    with (win.document) {
        open("text/html", "replace");
        write('<head><title></title><script language="javascript" type="text/javascript" src="/jslocal/winopen.js"></script></head>');
        write('<body style="margin-left: 0; margin-top: 0; margin-right: 0; margin-bottom: 0; background-color: #929486;">');
        write("<center>");
        write('<img style="margin: 0px 0px 0px 0px;" border=0 src="' + sURL + '" onClick="window.close()" onLoad="FitPic()" title="Закрыть"><br>');
        write("</center>");
        write("</body>");
        close();
    }

    return win;
}

function FitPic()
{ 
    var NS = (navigator.appName == "Netscape") ? true : false;
    var iWidth = (NS) ? window.innerWidth : document.body.clientWidth; 
    var iHeight = (NS) ? window.innerHeight : document.body.clientHeight; 

    iWidth = document.images[0].width - iWidth; 
    iHeight = document.images[0].height - iHeight; 

    window.resizeBy(iWidth, iHeight); 
    self.focus(); 
}

