var navV=navigator.appVersion;
var navA=navigator.userAgent;
var dom=document.getElementById?1:0;
var op=(navA.indexOf("Opera")>-1 && dom)?1:0;
var ie4=(document.all && !dom && !op)?1:0;
var ie5=(navV.indexOf("MSIE 5")>-1)?1:0;
var ie6=(navV.indexOf("MSIE 6")>-1)?1:0;
ie5=((ie5||ie6) && dom && !op)?1:0;
var ns4=(document.layers && !op)?1:0;
var ns5=(parseInt(navV)>= 5 && dom && !op)?1:0;
var win=navA.indexOf("Win")>-1?1:0;
var mac=navA.indexOf("Mac")>-1?1:0;
var useable=(dom||ie4||ie5||ie6||ns4||ns5||op)?1:0;
	
function preload()
{
//Active button
button1on = new Image();
button1on.src = "/img/menu/1_a.gif";
button2on = new Image();
button2on.src = "/img/menu/2_a.gif";
button3on = new Image();
button3on.src = "/img/menu/3_a.gif";
button4on = new Image();
button4on.src = "/img/menu/4_a.gif";
button5on = new Image();
button5on.src = "/img/menu/5_a.gif";
button6on = new Image();
button6on.src = "/img/menu/6_a.gif";
button7on = new Image();
button7on.src = "/img/menu/7_a.gif";
button8on = new Image();
button8on.src = "/img/menu/8_a.gif";
button9on = new Image();
button9on.src = "/img/menu/9_a.gif";
button10on = new Image();
button10on.src = "/img/menu/10_a.gif";
//Non active button
button1off = new Image();
button1off.src = "/img/menu/1.gif";
button2off = new Image();
button2off.src = "/img/menu/2.gif";
button3off = new Image();
button3off.src = "/img/menu/3.gif";
button4off = new Image();
button4off.src = "/img/menu/4.gif";
button5off = new Image();
button5off.src = "/img/menu/5.gif";
button6off = new Image();
button6off.src = "/img/menu/6.gif";
button7off = new Image();
button7off.src = "/img/menu/7.gif";
button8off = new Image();
button8off.src = "/img/menu/8.gif";
button9off = new Image();
button9off.src = "/img/menu/9.gif";
button10off = new Image();
button10off.src = "/img/menu/10.gif";
}

function show(x, y)
{
if (x == ActiveButton) return false;
if(document.images)
    if(document.readyState == "complete")
    { document.images[x].src=eval(y+'.src');}
    if (navigator.appName == "Netscape") 
    { document.images[x].src=eval(y+'.src');}
}

var ActiveButton

function Section()
{
	if (ActiveButton == 'btn1') document.images[ActiveButton].src=eval('button1on.src');
	if (ActiveButton == 'btn2') document.images[ActiveButton].src=eval('button2on.src');
	if (ActiveButton == 'btn3') document.images[ActiveButton].src=eval('button3on.src');
	if (ActiveButton == 'btn4') document.images[ActiveButton].src=eval('button4on.src');
	if (ActiveButton == 'btn5') document.images[ActiveButton].src=eval('button5on.src');
	if (ActiveButton == 'btn6') document.images[ActiveButton].src=eval('button6on.src');
	if (ActiveButton == 'btn7') document.images[ActiveButton].src=eval('button7on.src');
	if (ActiveButton == 'btn8') document.images[ActiveButton].src=eval('button8on.src');
	if (ActiveButton == 'btn9') document.images[ActiveButton].src=eval('button9on.src');
	if (ActiveButton == 'btn10') document.images[ActiveButton].src=eval('button10on.src');
}

var browserNamn = navigator.appName;
var browserVersion = parseInt(navigator.appVersion);
var ok="other";

if(browserNamn == "Microsoft Internet Explorer" && browserVersion >= 4)
        ok="ie4";
else if(browserNamn == "Netscape")
{
        if(browserVersion >= 4)
                ok="n4";
        else
                ok="n3";
}
else
        ok="other";

var winOk = 0;

function windowOpener(url,x,y)
{
		if(winOk == 0)
        {

popupWin=window.open(url,'popup','width='+x+',height='+y+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no');
                winOk++;
        }
        else if(popupWin.closed)

popupWin=window.open(url,'popup','width='+x+',height='+y+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no');
        else
        {
                if(ok != "other")
                        popupWin.blur();
                if(ok == "other" || ok == "n3")
                {
                        popupWin.close();

popupWin=window.open(url,'popup','width='+x+',height='+y+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no');
                }
                if(ok == "n4" || ok == "ie4")
                {
                        if(ok == "ie4")
						{		
								y = parseInt(y);
		                		y = y + 30;
						}
						popupWin.resizeTo(x, y);
                        popupWin.location = url;
                }
                if(ok != "other")
                        popupWin.focus();
        }
}

function windowRSOpener(url,x,y)
{
		if(winOk == 0)
        {

popupWin=window.open(url,'popup','width='+x+',height='+y+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no');
                winOk++;
        }
        else if(popupWin.closed)

popupWin=window.open(url,'popup','width='+x+',height='+y+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no');
        else
        {
                if(ok != "other")
                        popupWin.blur();
                if(ok == "other" || ok == "n3")
                {
                        popupWin.close();

popupWin=window.open(url,'popup','width='+x+',height='+y+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no');
                }
                if(ok == "n4" || ok == "ie4")
                {
                        if(ok == "ie4")
						{		
								y = parseInt(y);
		                		y += 30;
						}
						popupWin.resizeTo(x, y);
                        popupWin.location = url;
                }
                if(ok != "other")
                        popupWin.focus();
        }
}
function wopen(imgName, w , h, Title)
{
	var wo = window.open("", "abc", "width = " + w + " , height = " + h + ", scrollbars=0, status=0");
	wo.document.open();
	var win = "";
	win = "<html><head><title>";
	win += Title;
	win += "</title></head>"
	win += "<body bgcolor='#FFFFFF' leftmargin='0' topmargin='0' rightmargin='0' bottommargin='0' marginwidth='0' marginheight='0'>";
	win += "<table cellpadding='0' cellspacing='0' border='0' width='100%' height='100%'><tr><td align='center'>";
	win += "<a href='#' onClick='self.window.close();'><img src='" + imgName + "' width='" + w + "' height='" + h + "' border='0' alt='" + Title + "'></a>";
	win += "</td></tr></table>";
	win += "</body></html>";
	w += 26;
	h += 46;
	wo.window.resizeTo(w, h);
	wo.document.write(win);
	wo.window.focus();
	wo.document.close();	
}
		
var toolX=10;
var toolY=37;
if (navigator.userAgent.indexOf("Opera")>-1) {toolY+=0;toolY+=13;}
if (navigator.userAgent.indexOf("Firefox")>-1) {toolX-=3;toolY-=4;}
function wopen3(imgName) {
	var wo = window.open("", "picture", "width=150px, height=100px, scrollbars=0, status=0" );
	wo.document.open();
	wo.document.writeln("<html><head>");
	wo.document.writeln("<style>body{margin:0;}img{display:block;border:0;cursor:pointer;}</style>");
	wo.document.writeln("<script>");
	wo.document.writeln("function resize(x,y){ self.window.resizeTo(x+"+toolX+",y+"+toolY+");");
	wo.document.writeln("document.getElementById('loading').style.display='none';}");
	wo.document.writeln("function error(){ document.getElementById('loading').innerHTML='Картинка не найдена<br>"+imgName+"'; }");
	wo.document.writeln("</script>");
	wo.document.writeln("</head><body>");
	wo.document.writeln("<div id='loading' style='padding:37px 5px 0 5px; height: 100px; width:150px; text-align:center; font-size:15px;'>Идёт загрузка</div>");
	wo.document.writeln("<div onclick='self.window.close();'><img onload='resize(this.width,this.height);' onerror='error()' src='"+imgName+"' alt=''></div>");
	wo.document.writeln("</body></html>");
	wo.window.focus();
	wo.document.close();
}

						
