var isNav4, isNav6, isIE4, is3Browser;
    if (navigator.appVersion.charAt(0) == "4") {
        if (document.all) isIE4 = true
        if (document.layers) isNav4 = true
    } else {
	if (navigator.appVersion.charAt(0) > "4" && document.getElementById) {isNav6 = true} else {is3Browser = true}
	}

var l_bracket="['";
var r_bracket="']";
var sty = ".style";
var txt = "";
var doc = "document.all";
var vsbl = "visible";
var hdn = "hidden";

if(isNav4) {doc = "document"; sty = ""; txt = ".document"; vsbl="show"; hdn="hide";}
if(isNav6) {doc = "document.getElementById"; l_bracket="('"; r_bracket="')";}

//if(screen.width<=1024){st_sff='_s'}else{st_sff='_l'}
var styles_= '<link rel="stylesheet" href="'+out_path+'lib/ev.css" type="text/css">';

var buttonNameArray = new Array ();
buttonNameArray[0] = new Array ("menu","home","about","solutions","rd","partners","services","portfolio","project");
buttonNameArray[0].crd = new Array ("","157,2,198,18","155,2,198,18","132,2,198,18","46,2,198,18","139,2,198,18","139,2,198,18","118,2,198,18");
buttonNameArray[0].crd_ = new Array ("","122,2,198,18","118,2,198,18","76,2,198,18","132,2,198,18","84,2,198,18","84,2,198,18","38,2,198,18");
buttonNameArray[1] = new Array ("home");
buttonNameArray[1].url = new Array ("ru/main.html");
buttonNameArray[2] = new Array ("about","whatnew","philosophy","mission","partners","contactus");
buttonNameArray[2].url = new Array ("ru/main.html","ru/whatnew.html","ru/philosophy.html","ru/mission.html","ru/partners.html","ru/contactus.jsp");
buttonNameArray[3] = new Array ("solutions", "dataextraction", "csa", "ebusiness", "ecommerce", "b2b", "b2c", "datamining");
buttonNameArray[3].url = new Array ("ru/main.html", "ru/dataextraction.html", "ru/csa.html", "ru/ebusiness.html", "ru/ecommerce.html", "ru/b2b.html", "ru/b2c.html", "ru/datamining.html");
buttonNameArray[4] = new Array ("rd","knowledge","optimization","datamining","classification", "builder");
buttonNameArray[4].url = new Array ("ru/main.html", "ru/knowledge.html","ru/optimization.html","ru/datamining.html","ru/classification.html", "ru/builder.html");
buttonNameArray[5] = new Array ("services");
buttonNameArray[5].url = new Array ("ru/main.html");
buttonNameArray[6] = new Array ("portfolio","b2b","ecommerce","financial_applications","corporate","entertainment_other");
buttonNameArray[6].url = new Array ("ru/main.html","ru/b2b.html","ru/ecommerce.html","ru/financial_applications.html","ru/corporate.html","ru/entertainment_other.html");
buttonNameArray[7] = new Array ("project");
buttonNameArray[7].url = new Array ("ru/main.jsp");

var layers_ = new Array ();

var main_bar = "";
var tool_bar = "";
var folder_path = "";

//if(isNav4) {main_bar += '<LAYER id="m_" left="200" top="'+top_+'" visibility="show" z-index="9">';
//		} else {main_bar += '<div id="m_" style="position:absolute; left:200; top:'+top_+'; visibility:visible; z-index:9;">'}

//---------------------------------- MAIN TOOL BAR ---------------------------------------//
main_bar += '<table border="0" cellpadding="0" cellspacing="0">';
						for (i=1; i<buttonNameArray.length; i++){
folder_path = buttonNameArray[i][0]+'/';
if(i==1)folder_path='';
if(buttonNameArray[i][0]==page){sff = "_over";crds=buttonNameArray[0].crd_[i];}else{sff="_out";crds=buttonNameArray[0].crd[i];}

main_bar += '<tr><td width="198" height="22">';
if(i==1)main_bar += '<img src="'+out_path+'images/_white.gif" width="198" height="1" border="0" hspace="0" vspace="0"><br>';
main_bar += '<img id="'+buttonNameArray[i][0]+'" name="'+buttonNameArray[i][0]+'" src="'+buttons_path+buttonNameArray[i][0]+sff+'.gif" width="198" height="20" border="0" usemap="#m_'+buttonNameArray[i][0]+'"></td></tr>';
main_bar += '<map name="m_'+buttonNameArray[i][0]+'"><area href="'+out_path+folder_path+buttonNameArray[i].url[0]+'" shape="rect" coords="'+crds+'" onmouseover="show_('+i+'); return false;" onmouseout="hide_('+i+'); return false;"></map>';
																}
main_bar += '</table>';
//if(isNav4) {main_bar += '</LAYER>'} else {main_bar += '</div>'};
//-------------------------------- MAIN TOOL BAR END -------------------------------------//
						for (i=1; i<buttonNameArray.length; i++){
//-------------------------------- DROP TOOL BAR OUT -------------------------------------//
folder_path = buttonNameArray[i][0]+'/';
if(i==1)folder_path='';
if(buttonNameArray[i].length>1){
if(isNav4) {tool_bar += '<LAYER id="m_'+i+'" left="396" top="'+(top_+22*(i-1))+'" visibility="hide" z-index="10" onmouseover="show_('+i+'); return false;" onmouseout="hide_('+i+'); return false;">';
		} else {tool_bar += '<div id="m_'+i+'" style="position:absolute; left:396; top:'+(top_+22*(i-1))+'; visibility:hidden; z-index:10;" onmouseout="hide_('+i+'); return false;" onmouseover="show_('+i+'); return false;">'}

tool_bar += '<table border="0" cellpadding="0" cellspacing="0" width="156">';
tool_bar += '<tr>';
tool_bar += '<td rowspan="'+(buttonNameArray[i].length+3)+'" width="1" background="'+buttons_path+'i_vg.gif" valign="top"><img src="'+buttons_path+'i_v_.gif" width="1" height="21" border="0"></td>';
tool_bar += '<td rowspan="'+(buttonNameArray[i].length+3)+'" width="2" background="'+buttons_path+'m_wh.gif" valign="top"><img src="'+buttons_path+'m_wh.gif" width="1" height="21" border="0"></td>';
tool_bar += '<td width="180" background="'+buttons_path+'i_g.gif"><img src="'+buttons_path+'spacer.gif" width="180" height="1" border="0"></td>';
tool_bar += '<td rowspan="'+(buttonNameArray[i].length+3)+'" width="2" background="'+buttons_path+'m_wh.gif" valign="top"><img src="'+buttons_path+'m_wh.gif" width="1" height="21" border="0"></td>';
tool_bar += '<td rowspan="'+(buttonNameArray[i].length+3)+'" width="1" background="'+buttons_path+'i_vg.gif"><img src="'+buttons_path+'spacer.gif" width="1" height="18" border="0"></td>';
tool_bar += '</tr>';
tool_bar += '<tr><td width="180"><img src="'+buttons_path+'m_wh.gif" width="180" height="2" border="0"></td></tr>';

						for (j=1; j<buttonNameArray[i].length; j++){
tool_bar += '<tr><td><a href="'+out_path+folder_path+buttonNameArray[i].url[j]+'" onmouseover="over_('+i+','+j+'); return false;" onmouseout="out_('+i+','+j+'); return false;">';
tool_bar += '<img src="'+buttons_path+''+buttonNameArray[i][j]+'_out.gif" width="180" height="16" border="0"></a></td></tr>';
																	}

tool_bar += '<tr><td width="180"><img src="'+buttons_path+'m_wh.gif" width="180" height="2" border="0"></td></tr>';
tool_bar += '<tr><td width="180" background="'+buttons_path+'i_g.gif"><img src="'+buttons_path+'spacer.gif" width="180" height="1" border="0"></td></tr>';
tool_bar += '</table>';
//------------------------------- DROP TOOL BAR OUT END -----------------------------------//
//-------------------------------- DROP TOOL BAR OVER -------------------------------------//
						for (j=1; j<buttonNameArray[i].length; j++){
if(isNav4) {tool_bar += '<LAYER id="m_'+i+'_'+j+'" left="3" top="'+(3+16*(j-1))+'" visibility="hide" z-index="11">';
		} else {tool_bar += '<div id="m_'+i+'_'+j+'" style="position:absolute; left:3; top:'+(3+16*(j-1))+'; visibility:hidden; z-index:11;">'}
tool_bar += '<a href="'+out_path+folder_path+buttonNameArray[i].url[j]+'" onmouseover="over_('+i+','+j+'); return false;" onmouseout="out_('+i+','+j+'); return false;">';
tool_bar += '<img src="'+buttons_path+''+buttonNameArray[i][j]+'_over.gif" width="180" height="16" border="0"></a>';
if(isNav4) {tool_bar += '</LAYER>'} else {tool_bar += '</div>'};
																	}
//------------------------------ DROP TOOL BAR OVER END -----------------------------------//
if(isNav4) {tool_bar += '</LAYER>'} else {tool_bar += '</div>'};
}
															}
//---------------------------------- LINES LAYER ---------------------------------------//
if(isNav4){tool_bar += '<LAYER ID="li_nes" left="0" top="'+top_+'" visibility="hide" z-index="0">'}
else{tool_bar += '<div id="li_nes" style="position:absolute; left:0; top:'+top_+'; visibility:hidden; z-index:0;">'}
tool_bar += '<table border="0" cellpadding="0" cellspacing="0">';
tool_bar += '<tr><td width="198" height="1"><img src="'+buttons_path+'m_hi.gif" width="198" height="1" border="0"></td></tr>';
tool_bar += '<tr><td width="198" height="20"><img src="'+buttons_path+'spacer.gif" width="198" height="20" border="0"></td></tr>';
tool_bar += '<tr><td width="198" height="1"><img src="'+buttons_path+'m_hi.gif" width="198" height="1" border="0"></td></tr>';
tool_bar += '</table>';
if(isNav4){tool_bar += '</LAYER>'}else{tool_bar += '</div>'}
//-------------------------------- LINES LAYER END -------------------------------------//


function over_(i_,j_){if(buttonNameArray[i_][j_].length>1)layers_[i_][j_].object.visibility = vsbl;}
function out_(i_,j_){if(buttonNameArray[i_][j_].length>1)layers_[i_][j_].object.visibility = hdn;}

function show_(i_){if(loaded){if(buttonNameArray[i_].length>1)layers_[i_][0].object.visibility = vsbl;
					lines_.object.top = top_+22*(i_-1); lines_.object.visibility = vsbl;}}
function hide_(i_){if(loaded){if(buttonNameArray[i_].length>1)layers_[i_][0].object.visibility = hdn;
					lines_.object.visibility = hdn;}}

function layer_(layer_id) {
this.object = eval(doc + l_bracket + layer_id  + r_bracket + sty);
this.content = eval(doc + l_bracket + layer_id  + r_bracket + txt);
}

function measure_layer(layer_id){
this.object = eval(doc + l_bracket + layer_id  + r_bracket + sty);
this.content = eval(doc + l_bracket + layer_id  + r_bracket + txt);
if(isNav4){this.object.left_=this.object.left; this.object.top_=this.object.top;
			this.object.width_=this.content.width; this.object.height_=this.content.height;}
if(isIE4){this.object.left_=this.object.posLeft; this.object.top_=this.object.posTop;
			this.object.width_=this.content.clientWidth; this.object.height_=this.content.clientHeight;}
}

function child_layer_(layer_id,child_id) {
if(isNav4) this.object = eval(doc + l_bracket + layer_id  + r_bracket + txt + l_bracket + child_id  + r_bracket);
if(isIE4 || isNav6) this.object = eval(doc + l_bracket + child_id  + r_bracket + sty);
}

function resize_layer(layer_to,wid_th,hei_ght){
if(isNav4){layer_to.resizeTo(wid_th,hei_ght)} else {layer_to.width = wid_th; layer_.height = hei_ght;}
}

function common_(){
lines_ = new layer_("li_nes")
under_ = new layer_("under");
header_ = new layer_("header");
main_ = new layer_("main");

			for (i=1; i<buttonNameArray.length; i++){
if(buttonNameArray[i].length<=1) continue;
			layers_[i] = new Array ();
			layers_[i][0] = new layer_("m_"+i);
			for (j=1; j<buttonNameArray[i].length; j++){
			layers_[i][j] = new child_layer_("m_"+i,"m_"+i+"_"+j);
														}
													}

if(isNav4 || isNav6){work_width=window.innerWidth;
					}else{work_width=document.body.clientWidth;}
if(work_width<780)work_width=780;
if(!isNav6)resize_layer(under_.object,work_width,60);

if(isNav4 && window.innerHeight<main_.content.height) d_left=(screen.width/1152)*20
if((work_width-780)/2-d_left >= 0){left_ = (work_width-780)/2-d_left}else{left_ = 0}
main_.object.left = header_.object.left = lines_.object.left = left_;

for (i=1; i<buttonNameArray.length; i++) {
						if(buttonNameArray[i].length>1){
						layers_[i][0].object.left = left_+196
						layers_[i][0].object.top = top_+22*(i-1)
													}
											}
loaded=true;
}