timeoutLength = 1500;   // time in ms
timeoutFlag = 0;

DOM = (document.getElementById)? 1: 0;

Opera = (navigator.userAgent.indexOf('Opera') > -1)? 1: 0;
Opera5 = (navigator.userAgent.indexOf('Opera 5') > -1 || navigator.userAgent.indexOf('Opera/5') > -1)? 1: 0;
Opera6 = (navigator.userAgent.indexOf('Opera 6') > -1 || navigator.userAgent.indexOf('Opera/6') > -1)? 1: 0;
Opera56 = Opera5 || Opera6;

IE = (navigator.userAgent.indexOf('MSIE') > -1)? 1: 0;
IE = IE && !Opera;
IE6 = IE && DOM;

w = window;
d = w.document;
ie_ = w.VBArray;
ie_6 =(ie_ && d.implementation);
ie_7 = (ie_ && w.XMLHttpRequest);



function propVisible(obj_id) {
    if (DOM) {
        return document.getElementById(obj_id);
    } else {
        return document.all[obj_id];
    }
}

function setLMTO() {
	timeoutFlag = setTimeout('mnuHideAll()', timeoutLength);
}

function clearLMTO() {
	clearTimeout(timeoutFlag);
}

function mnuHideAll() {
	var div_elem= document.getElementsByTagName('div');
	for (var i=0; i<div_elem.length; i++) {
		if ( div_elem[i].className == 'menu_2lvl' ) {
			div_elem[i].style.visibility='hidden';
		}
	}
}






function mnuShow(id) {
	mnuHideAll();
  document.getElementById('val_menu').value="0";
	var smenu= propVisible('hormenu2L'+id);
	smenu.style.visibility= 'visible';
}

function mnuShowEn(id) {
	endMenuShow();
}

function endMenuShow(){
  document.getElementById('val_menu').value="1";
  setTimeout("changemenu()", 600);
}
function changemenu(){
  if  (document.getElementById('val_menu').value==1){
    mnuHideAll();
  }
}



// глюканый иксплорер

function getInternetExplorerVersion() {
	var rv = -1; // Return value assumes failure.
	if (navigator.appName == 'Microsoft Internet Explorer') {
			var ua = navigator.userAgent;
			var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
			if (re.exec(ua) != null)
					rv = parseFloat(RegExp.$1);
	}
	return rv;
}

ver_ = getInternetExplorerVersion();
if (ver_ > -1) {
	if (ver_ < 8.0){
		if ( ie_6 || ie_7 )  {
		// фикс положения подменю
			document.write('<style>div#hormenu2L1 { margin-left:-92px; margin-top:22px; }</style>');
			document.write('<style>div#hormenu2L2 { margin-left:-98px; margin-top:22px; }</style>');
			document.write('<style>div#hormenu2L4 { margin-left:-116px; margin-top:22px; }</style>');
		// фикс отступа 1 уровня меню
			document.write('<style>a.bigblack { padding-right:20px; }</style>');
		}
	}
}