var flag=0;
function sForm() { fObj=document.fsearch; if (flag==0) { fObj.style.display="inline"; flag=1; } else { fObj.style.display="none"; flag=0; } }

function browse_check() {
this.ver=navigator.appVersion; this.agent=navigator.userAgent; this.dom=document.getElementById?1:0;
this.opera5=(window.opera&&this.dom)?1:0; this.opera6=(this.opera5&&window.print)?1:0; this.opera7=(this.opera5&&document.readyState)?1:0;
this.ie5=(this.ver.indexOf("MSIE 5")>-1&&this.dom&&!this.opera5)?1:0; this.ie6=(this.ver.indexOf("MSIE 6")>-1&&this.dom&&!this.opera5)?1:0;
this.ie4=(document.all&&!this.dom&&!this.opera5)?1:0; this.ie=this.ie4||this.ie5||this.ie6; this.mac=this.agent.indexOf("Mac")>-1;
this.ns6=(this.dom&&parseInt(this.ver)>=5)?1:0; this.ns4=(document.layers&&!this.dom)?1:0;
this.bw=(this.ie6||this.ie5||this.ie4||this.ns4||this.ns6||this.opera5||this.opera6||this.opera7); return this; }
bw=new browse_check();

var m=new Array(); // Меню (1 уровень)
var ms=new Array(); // Меню (2 уровень)
var mf=0; // Индикатор откр. пункта меню (1 уровень)
var fl_active=0; // Индикатор наличия курсора на первом уровне (1 уровень)

var msf=0; // Индикатор откр. пункта меню (2 уровень)
var tID, dID;
var delay_time = 500;
var nm=0;

function init(num) { nm=num;
	for (i=1;i<=num;i++) {
		m[i]=bw.dom?document.getElementById("m"+i):!bw.dom&&bw.ie?document.all["m"+i]:null;
		if (m[i]!=null&&m[i]!="undefined") { m[i].onmouseover=sMenu_time; m[i].onmouseout=hMenu_time; } // 1 уровень
		ms[i]=bw.dom?document.getElementById("ms"+i):!bw.dom&&bw.ie?document.all["ms"+i]:null;
		if (ms[i]!=null&&ms[i]!="undefined") { sPos(i); ms[i].onmouseover=clTime; ms[i].onmouseout=hsMenu; } // 2 уровень
	}
}

function sPos(num) { x=0; y=0; var el,temp; el=m[num];
pagew=bw.dom?document.getElementById("all-box"):!bw.dom&&bw.ie?document.all["all-box"]:null; ms[num].style.width=(pagew.offsetWidth-339)+"px";}

function sMenu_time() {
   id=this.id.substring(1);
   if( mf == 0 ) { 
      VisMenu(id);
   } else {
      fl_active = id;
      clearTimeout(dID);
      dID=setTimeout("VisMenu("+id+")",delay_time);
   }
}

function hMenu_time() { 
   fl_active = 0;
   id=this.id.substring(1);
   clearTimeout(dID);
   dID=setTimeout("HidMenu("+id+")",delay_time);
}

function clTime() { 
   clearTimeout(tID); 
   clearTimeout(dID); 
}

function hsMenu() { 
   clearTimeout(tID); 
   tID=setTimeout("HidMenu()",500); 
}

function HidMenu() { 
   if( mf > 0 ) {
      m[mf].className="off"; 
      mf=0; 
      (msf>0)?HidSubMenu():null; 
   }
}

function VisMenu(id) { 
   if(mf!=id&&mf>0) { HidMenu(); } 
   if( id > 0 ) {
      m[id].className="on"; 
      mf=id; 
      VisSubMenu(id); 
   }
}

function HidSubMenu() { 
   if( msf > 0 ) {
      ms[msf].style.visibility="hidden"; 
      msf=0; 
   }
}

function VisSubMenu(id) { 
   if( id > 0 ) {
      ms[id].style.visibility="visible"; 
      msf=id; 
   }
}

onresize=function() { for (i=1;i<=nm;i++) { if (ms[i]!=null&&ms[i]!="undefined") { sPos(i); } } }

function ClientBrowse() { this.w=0; this.h=0;
if (self.screen) { this.w=screen.width; this.h=screen.height; }
else if (self.java) { var jkit=java.awt.Toolkit.getDefaultToolkit(); var scrsize=jkit.getScreenSize(); this.w=scrsize.width; this.h=scrsize.height; } }
function OpenWin(url,nwin,widthWin,heightWin,sbar) { p=new ClientBrowse();
if (widthWin) { leftPos=(p.w-widthWin)/2; } else { widthWin=p.w-100; leftPos=(p.w-widthWin)/2; }
if (heightWin) { topPos=(p.h-heightWin)/2; } else { heightWin=p.h-100; topPos=10; }
(sbar==1)?null:sbar=0; (nwin)?null:nwin="win"; var property="left="+leftPos+",top="+topPos+",width="+widthWin+",height="+heightWin+",scrollbars="+sbar;
window.open (url,nwin,property); }
