JSVer = (navigator.userAgent.indexOf ("Mozilla") != -1 ? parseInt(navigator.appVersion.substring(0,1)) : 0);
OperaVer = (navigator.userAgent.indexOf ("Opera") != -1 ? parseInt(navigator.appVersion.substring(0,1)) : 0);
JSVer += OperaVer;
MSIE = (navigator.userAgent.indexOf ("MSIE") != -1);

function Tops(url, w, h) {
    if (JSVer < 3) {
        return true;
    }
    var r_w = w, r_h = h, s = '', s_scroll = 'yes';
    if (JSVer >= 3) {
        if (JSVer == 3) {
            r_w += 32; r_h += 32;
        }
        s = 'status=no,scrollbars=' + s_scroll + ',width=' + r_w + ',height=' + r_h;
		var TrueString = '';
		for (var i = 0; i < url.length; i += 1) {
   			var CurrentChar = url.charAt(i);
			if ((CurrentChar != '.') && (CurrentChar != '/') && (CurrentChar != '-') && (CurrentChar != '_') && (CurrentChar != '=') && (CurrentChar != '?'))
				TrueString += CurrentChar;
		}
		WindowName = TrueString + 'SecondWnd';
		window.open(url, WindowName,s);
        return false;
    }
    return true;
}

function ops(img_url, w, h, img_title, tp, lt, cright) {
    if (JSVer < 3) {
        return true;
    }
    var r_w = w, r_h = h, s = '', s_scroll = 'no';
    if (JSVer >= 3) {
        if (JSVer == 3) {
            r_w += 32; r_h += 32;
        }
        if (img_title)  r_h += 18;
        if (screen) {
            if (screen.availWidth < r_w) {
                s_scroll = 'yes';
                r_w = screen.availWidth;
            }
            if (screen.availHeight < r_h) {
                s_scroll = 'yes';
                r_h = screen.availHeight;
            }
        } else
            s_scroll = 'yes';
        s = 'status=no,scrollbars=' + s_scroll + ',width=' + r_w + ',height=' + r_h + ',top=' + tp + ',left=' + lt;
        var secWnd = window.open('', 'SecondWnd', s);
        with (secWnd) {
            document.write("<BODY MARGINWIDTH=0 MARGINHEIGHT=0 LEFTMARGIN=0 TOPMARGIN=0 BGCOLOR='White' onblur='window.close();'>");
			//if (img_url.substr(8,7) == "schemes") {
			//	document.write("<DIV STYLE='position: absolute; left:10px; top:10px; margin:0px 0px 0px 0px; z-index: 1000;'><a href=\"\#\" onclick=\"window.print();\">[напечатать]</a></div>");
			//}
			if (cright) {
				cright = false;
				w_copy = w - 90;
				h_copy = h - 15;
				document.write("<DIV STYLE='position: absolute; left:" + w_copy + "px;top:" + h_copy + "px;margin:0px 0px 0px 0px; z-index: 1000;'><img src='/images/logo_pixel.gif' width='87' height='12' alt='&copy; Statpro' border='0'></div>");
			}
            if (JSVer >= 4 || MSIE) {
                document.write("<DIV STYLE='left:0px;top:0px;margin:0px 0px 0px 0px;'>");
            }
            document.write("<a href='#' onClick='window.close();'><IMG SRC=\""+img_url+"\" WIDTH="+ w +" HEIGHT=" + h + " BORDER=0></a>");
            if (img_title != null) {
                if (JSVer >= 4)
                    document.write("<SPAN STYLE='font-size:8pt;font-family:Tahoma,Arial Cyr,Arial,Helv;'><BR><CENTER>");
                else
                    document.write("<BR><CENTER><FONT SIZE=1 FACE=\"Tahoma,Arial Cyr,Arial,Helv\">");
                document.writeln(img_title);
                if (JSVer >= 4)
                    document.write("</CENTER></SPAN>");
                else
                    document.writeln("</FONT></CENTER>");
            }
            if (JSVer >= 4 || MSIE) {
                document.write("</DIV>");
            }
            document.writeln("</BODY>\n</HTML>");
            document.close();
        }
        return false;
    }
    return true;
}

