 


//alert("debug menu");


//=======================|````````````\
//========================\  Scripts  ||
//=========================\__________||
var DOM = (navigator.appName != "Microsoft Internet Explorer");
	
var getObj = null;
if(document.getElementById) getObj = function(id) { return document.getElementById(id); }
else if(document.all) getObj = function(id) { return document.all[id]; }
else alert("Error.\nYour browser does not support appropriate DOM.");

function trimSp(s){
	for(var i = 0; i < s.length && s.charAt(i) == " "; i++); 
	for(var j = s.length; j >= 0 && s.charAt(j) == " "; j--);
	return s.slice(i, j);
}

function cutPx(s){
	var r = new RegExp("(.*)(px)");  s.match ( r );
	return parseInt ( trimSp ( RegExp.$1 ) );
}

//=======================|````````````\
//========================\  support  ||
//=========================\__________||
mouseOutDelay = 500;

trial = {}
trial.all = {}

// ececutes the trial - removes hede the element if it was not justified
trial.exec = function(id){
	var o = getObj(id);
	if(trial.all[id]){
			o.style.display = 'none';
	}
}

trial.execAll = function(){
	for(var i in trial.all){
		trial.exec(i);
	}
}

// sets [o] to trial - after the set time the this.exec will be invoked
trial.set = function(ctnr){
	this.all[ctnr.id] = true;
	setTimeout("trial.exec('"+ctnr.id+"')", mouseOutDelay );
}

// removes [o] from trial
trial.rmv = function(o){
	this.all[o.id] = false;
}


// invokes when the mouse is over the [o] menu item
onElementOver = function(o){
	o.className = "menu_L"+getObj(o.ctnr).level+"_Item_o";
	activateContainer( getObj(o.ctnr) );
	if(o.tgt) { 
		trial.rmv(getObj(o.tgt)); 
		getObj(o.tgt).style.display = "block";
		
	}
	
}

// removes all parents from the trial
activateContainer = function(ctnr){
	trial.rmv(ctnr);
	trial.execAll();
	ctnr.style.display = "block";
	if(ctnr.level != 0){ 
		getObj(ctnr.pnt).className = "menu_L"+ (ctnr.level -1)+"_Item_o";
		activateContainer( getObj( getObj(ctnr.pnt).ctnr) ); 
	}
}

// invokes when the mouse is out of the [o] menu item
onElementOut = function(o){


		if(o.tgt) trial.set(getObj(o.tgt));

	if(o.id ==  mm_l0_activeElement){
		o.className = "menu_L"+getObj(o.ctnr).level+"_Item_o";

	}else{
		deactivateContainer( getObj(o.ctnr) );
		o.className = "menu_L"+getObj(o.ctnr).level+"_Item_n";
	}
}

// set all parents to trial
deactivateContainer = function(ctnr){
	if(ctnr.level == 0) return;
	var q = getObj( getObj(ctnr.pnt).ctnr); // parent container
	trial.set(ctnr);
	if(getObj(ctnr.pnt).id !=  mm_l0_activeElement) getObj(ctnr.pnt).className = "menu_L"+ (ctnr.level -1)+"_Item_n";
	deactivateContainer(q);
}

// unwrap the level 0 menu
reClip = function(target){
if(target == 0) return;
	var mm = getObj("mainMenu");
	var div = getObj("mm_div_" + target);
	var l1 = getObj("mm_l1_" + target);
	var a = getObj("mm_a_" + target);
	for(var i = (DOM?1:0); i < mm.childNodes.length; i++){
			mm.childNodes[i].childNodes[1].style.display = "none";
			mm.childNodes[i].childNodes[0].style.backgroundColor = "#E3E3E3";
			mm.childNodes[i].childNodes[0].style.backgroundImage = "";
			mm.childNodes[i].style.height = "1px";
	}
	div.style.height = cutPx(l1.style.height) + 1 + "px";
	a.style.backgroundColor = "#FFFFFF";
	a.style.backgroundImage = "url(/images/menu_bullet.gif)";
	l1.style.display = "block";
	l0ActiveElementId = a.id;
}

//=======================|```````````````\
//========================\  Generation  ||
//=========================\_____________||
var menuItemHeight = 20;

// dobavl'yaet element v menu
mm_addItem = function(id, container, target, content, link, absLink, targetWidth){
	if(absLink && link!="#"){ 
		link = absLink;
	} else if(link) link = link;
	container = getObj(container);
	var o = document.createElement("span");
	container.appendChild(o);
	o.id = id;
	o.ctnr = container.id;
	o.innerHTML = content;
	o.className = "menu_L"+container.level+"_Item_n";
	if(DOM){
		o.addEventListener('mouseover', function(){ onElementOver(this) }, false);
		o.addEventListener('mouseout', function(){ onElementOut(this) }, false);
		if(link)if(link!="#") o.addEventListener('click', function(){ window.location.href = link; }, false);
		else o.addEventListener('click', function(){ window.open(absLink[0], "", absLink[1]); }, false);
	} else {
		o.attachEvent("onmouseover", function() {onElementOver(o); } ); 
		o.attachEvent("onmouseout", function() { onElementOut(o); } ); 
		if(link)if(link!="#") o.attachEvent("onclick", function() { window.location.href = link; } ); 
		else o.attachEvent("onclick", function() { window.open(absLink[0], "", absLink[1]) } ); 
	}
	o.style.cursor = (link ? "pointer" : "default");

	if(!container.itemsCounter){ container.itemsCounter = 0; }
	container.style.height = menuItemHeight * ( container.itemsCounter + 1 ) + 1 + "px";
	o.style.top = menuItemHeight * container.itemsCounter + "px";
	if(target){
		o.tgt = target;
		o.style.backgroundImage = "url(/images/menu_bullet.gif)";
		var tgt = document.createElement("DIV");
		getObj("bodyFake").appendChild(tgt);
		tgt.itemsCounter = 0;
		tgt.id = target;
		tgt.pnt = id;
		tgt.level = container.level + 1;
		tgt.className = "menuContainer";
		tgt.style.width = (targetWidth ? targetWidth : 109) + "px";

		var tgtLeft = cutPx(container.style.left) + cutPx(container.style.width);
		if(tgt.level<1) tgtLeft += cutPx(getObj("mainMenu").style.left);
		if(DOM){
			tgtLeft += 0;
			if(tgt.level > 1) tgt.left += 10;
		}
		if(tgt.level == 3) {
		}
		tgt.style.left = tgtLeft + "px";
		tgt.style.top = cutPx(o.style.top) + cutPx(container.style.top) + (tgt.level < 2?( cutPx(getObj("mainMenu").style.top) + l0ElementHeight * (l0ElementsCounter -1) ):0)  + 0 + "px";
	}
	container.itemsCounter ++;

// siteMap

	if(isHomePage == "sitemap" | "" || (isHomePage == "click" && id.match("^3_7") ) ){
		var menuElement = document.createElement("DIV");
		getObj("sitemapContainer").appendChild(menuElement);
		switch(container.level){
			case 0 : { menuElement.className = "titlebd"; } break;
			case 1 : { menuElement.className = "message"; } break;
			case 2 : { menuElement.className = "title_news"; } break;
			case 3 : { menuElement.className = "title4"; } break;
		}

		if(DOM){
			menuElement.addEventListener('mouseover', function(){ sitemapElementOver(this); }, false);
			menuElement.addEventListener('mouseout', function(){ sitemapElementOut(this); }, false);
			if(link) menuElement.addEventListener('click', function(){ window.location.href = link; }, false);
		} else {
			menuElement.attachEvent("onmouseover", function() { sitemapElementOver(menuElement); } ); 
			menuElement.attachEvent("onmouseout", function() { sitemapElementOut(menuElement); } ); 
			if(link) menuElement.attachEvent("onclick", function() { window.location.href = link; } ); 
		}


		menuElement.style.paddingLeft = 0 + "px";
		menuElement.style.backgroundPosition =  ((container.level + 1) * 30) -8 + "px 4px";
		menuElement.style.backgroundRepeat = "no-repeat";
		
		if(link){ menuElement.style.cursor = "pointer"; }
		menuElement.innerHTML = content;
	}

}


sitemapElementOver = function(o){
	o.style.backgroundImage = "url(/images/ul_bullet.gif)"; 
	o.style.backgroundColor = "whiteSmoke"; 
}

sitemapElementOut = function(o){
	o.style.backgroundImage = "none"; 
	o.style.backgroundColor = "white"; 
}



var l0ElementsCounter = 0;
var l0ElementHeight = 0;
var l0ActiveElementId
mm_add_l0Item = function(id, name, link){
	var mm = getObj("mainMenu");
	var div, a, l1;

	div = document.createElement("DIV");
	mm.appendChild(div);
	div.id = "mm_div_" + id;

	a = document.createElement("DIV");
	div.appendChild(a);
	a.id = "mm_a_" + id;
	a.className = "l0_item";
	if(DOM){
		a.addEventListener('click', function(){ reClip(id); }, false);
		a.addEventListener('mouseover', function(){ a.style.backgroundColor = "#FFFFFF";  }, false);
		a.addEventListener('mouseout', function(){ if(a.id != l0ActiveElementId){ a.style.backgroundColor = "#900000" } }, false);
	} else {
		a.attachEvent("onclick", function() { reClip(id); if(link){ window.location.href = link; } } ); 
		a.attachEvent("onmouseover", function() { a.style.backgroundColor = "#022545"; } ); 
		a.attachEvent("onmouseout", function() { if(a.id != l0ActiveElementId){ a.style.backgroundColor = "#900000" }  } ); 
	}
	a.innerHTML = name;

	l1 = document.createElement("DIV");
	div.appendChild(l1);
	l1.id = "mm_l1_" + id;
	l1.level = 0;
	l1.style.position = "absolute";
	l1.style.left = "0px";
	l1.style.top = l0ElementHeight + "px";
	l1.style.width = (DOM?"109px":"109px");
	l1.style.height = 0 + "px";
	l1.style.display = "none";
	l1.l0 = true;

	l0ElementsCounter++;

// steMap code

	if(isHomePage == "sitemap"){
		var menuElement = document.createElement("DIV");
		getObj("sitemapContainer").appendChild(menuElement);
		menuElement.className = "title";
		menuElement.innerHTML = name;
	}


}


//=======================|```````````````\
//========================\  Generation  ||
//=========================\_____________||

var mainMenu = getObj("mainMenu");
mainMenu.style.position = "absolute";
mainMenu.style.left = "0px";
mainMenu.style.top = "16px";
if(isHomePage == true) mainMenu.style.top = "16px";
mainMenu.style.width = "109px";
mainMenu.style.height = "300px";


//=======================|````````````````````\
//========================\  SIMPLIFIED MENU  ||
//=========================\__________________||



mm_add_l0Item("1", "<img border=0 src=/images/1px.gif WIDTH=1 height=1>");

	mm_addItem("1_1", "mm_l1_1", null, "<img border=0 src=/images/menu/en_CA/home1.gif WIDTH=109 height=20 onmouseover=this.src='/images/menu/en_CA/home2.gif' onmouseout=this.src='/images/menu/en_CA/home1.gif'>", "/bodyframe2.jsp");
	
	mm_addItem("1_2", "mm_l1_1", "1_2_", "<img border=0 src=/images/menu/en_CA/company1.gif WIDTH=109 height=20 onmouseover=this.src='/images/menu/en_CA/company2.gif' onmouseout=this.src='/images/menu/en_CA/company1.gif'>", null, null, 210);
		mm_addItem("1_2_1", "1_2_", null, "<img border=0 src=/images/menu/en_CA/comp_ove1.gif WIDTH=131 height=20 onmouseover=this.src='/images/menu/en_CA/comp_ove2.gif' onmouseout=this.src='/images/menu/en_CA/comp_ove1.gif'>", "/pub/company/overview.jsp");
		mm_addItem("1_2_2", "1_2_", null, "<img border=0 src=/images/menu/en_CA/comp_hist1.gif WIDTH=131 height=20 onmouseover=this.src='/images/menu/en_CA/comp_hist2.gif' onmouseout=this.src='/images/menu/en_CA/comp_hist1.gif'>", "/pub/company/history.jsp");
		mm_addItem("1_2_3", "1_2_", null, "<img border=0 src=/images/menu/en_CA/comp_mis1.gif WIDTH=131 height=20 onmouseover=this.src='/images/menu/en_CA/comp_mis2.gif' onmouseout=this.src='/images/menu/en_CA/comp_mis1.gif'>", "/pub/company/mission.jsp");
		mm_addItem("1_2_4", "1_2_", null, "<img border=0 src=/images/menu/en_CA/comp_aw1.gif WIDTH=131 height=20 onmouseover=this.src='/images/menu/en_CA/comp_aw2.gif' onmouseout=this.src='/images/menu/en_CA/comp_aw1.gif'>", "/pub/company/awards.jsp");
		mm_addItem("1_2_5", "1_2_", null, "<img border=0 src=/images/menu/en_CA/comp_part1.gif WIDTH=131 height=20 onmouseover=this.src='/images/menu/en_CA/comp_part2.gif' onmouseout=this.src='/images/menu/en_CA/comp_part1.gif'>", "/pub/company/partner.jsp");
		mm_addItem("1_2_6", "1_2_", null, "<img border=0 src=/images/menu/en_CA/comp_inv1.gif WIDTH=131 height=20 onmouseover=this.src='/images/menu/en_CA/comp_inv2.gif' onmouseout=this.src='/images/menu/en_CA/comp_inv1.gif'>", "/pub/company/investor.jsp");
	
	mm_addItem("1_3", "mm_l1_1", "1_3_", "<img border=0 src=/images/menu/en_CA/products1.gif WIDTH=109 height=20 onmouseover=this.src='/images/menu/en_CA/products2.gif' onmouseout=this.src='/images/menu/en_CA/products1.gif'>", null, null, 210);
		mm_addItem("1_3_1", "1_3_", null, "<img border=0 src=/images/menu/en_CA/prod_eva1.gif WIDTH=251 height=20 onmouseover=this.src='/images/menu/en_CA/prod_eva2.gif' onmouseout=this.src='/images/menu/en_CA/prod_eva1.gif'>", "/pub/solutions/overview.jsp");
		mm_addItem("1_3_2", "1_3_", null, "<img border=0 src=/images/menu/en_CA/prod_obp1.gif WIDTH=251 height=20 onmouseover=this.src='/images/menu/en_CA/prod_obp2.gif' onmouseout=this.src='/images/menu/en_CA/prod_obp1.gif'>", "/pub/solutions/msoutlook.jsp");
		mm_addItem("1_3_3", "1_3_", null, "<img border=0 src=/images/menu/en_CA/prod_spn1.gif WIDTH=251 height=20 onmouseover=this.src='/images/menu/en_CA/prod_spn2.gif' onmouseout=this.src='/images/menu/en_CA/prod_spn1.gif'>", "/pub/solutions/smartnumber.jsp");
		mm_addItem("1_3_4", "1_3_", null, "<img border=0 src=/images/menu/en_CA/prod_sfn1.gif WIDTH=251 height=25 onmouseover=this.src='/images/menu/en_CA/prod_sfn2.gif' onmouseout=this.src='/images/menu/en_CA/prod_sfn1.gif'>", "/pub/solutions/SmartFax.jsp");

	mm_addItem("1_4", "mm_l1_1", "1_4_", "<img border=0 src=/images/menu/en_CA/customapp1.gif WIDTH=109 height=20 onmouseover=this.src='/images/menu/en_CA/customapp2.gif' onmouseout=this.src='/images/menu/en_CA/customapp1.gif'>", null, null, 249);
		mm_addItem("1_4_1", "1_4_", null, "<img border=0 src=/images/menu/en_CA/CustomApps_AppMod1.gif WIDTH=250 height=20 onmouseover=this.src='/images/menu/en_CA/CustomApps_AppMod2.gif' onmouseout=this.src='/images/menu/en_CA/CustomApps_AppMod1.gif'>", "/pub/products/appmodules.jsp");
		mm_addItem("1_4_2", "1_4_", null, "<img border=0 src=/images/menu/en_CA/CustomApps_Dev1.gif WIDTH=250 height=20 onmouseover=this.src='/images/menu/en_CA/CustomApps_Dev2.gif' onmouseout=this.src='/images/menu/en_CA/CustomApps_Dev1.gif'>", "/pub/products/platform.jsp");
		mm_addItem("1_4_3", "1_4_", null, "<img border=0 src=/images/menu/en_CA/CustomApps_ProfServ1.gif WIDTH=250 height=25 onmouseover=this.src='/images/menu/en_CA/CustomApps_ProfServ2.gif' onmouseout=this.src='/images/menu/en_CA/CustomApps_ProfServ1.gif'>", "/pub/solutions/services.jsp");

	mm_addItem("1_5", "mm_l1_1", "1_5_", "<img border=0 src=/images/menu/en_CA/product_demo1.gif WIDTH=109 height=20 onmouseover=this.src='/images/menu/en_CA/product_demo2.gif' onmouseout=this.src='/images/menu/en_CA/product_demo1.gif'>", null, null, 210);
		mm_addItem("1_5_1", "1_5_", null, "<img border=0 src=/images/menu/en_CA/prod_demo_overview1.gif WIDTH=163 height=20 onmouseover=this.src='/images/menu/en_CA/prod_demo_overview2.gif' onmouseout=this.src='/images/menu/en_CA/prod_demo_overview1.gif'>", "#",["/pub/demo/en_CA/intro1.htm", "location=0,resizable=0,toolbar=0,scrollbars=1,menubar=0,toolbar=0,fullscreen=1"]);

	mm_addItem("1_6", "mm_l1_1", null, "<img border=0 src=/images/menu/en_CA/download1.gif WIDTH=109 height=20 onmouseover=this.src='/images/menu/en_CA/download2.gif' onmouseout=this.src='/images/menu/en_CA/download1.gif'>", "/pub/doc/download.jsp");
	mm_addItem("1_7", "mm_l1_1", null, "<img border=0 src=/images/menu/en_CA/news1.gif WIDTH=109 height=20 onmouseover=this.src='/images/menu/en_CA/news2.gif' onmouseout=this.src='/images/menu/en_CA/news1.gif'>", "/pub/news/index.jsp");
	mm_addItem("1_8", "mm_l1_1", "1_8_", "<img border=0 src=/images/menu/en_CA/careers1.gif WIDTH=109 height=20 onmouseover=this.src='/images/menu/en_CA/careers2.gif' onmouseout=this.src='/images/menu/en_CA/careers1.gif'>", null, null, 210);
		mm_addItem("1_8_1", "1_8_", null, "<img border=0 src=/images/menu/en_CA/career_corp1.gif WIDTH=151 height=20 onmouseover=this.src='/images/menu/en_CA/career_corp2.gif' onmouseout=this.src='/images/menu/en_CA/career_corp1.gif'>", "/pub/hr/index.jsp");
		mm_addItem("1_8_2", "1_8_", null, "<img border=0 src=/images/menu/en_CA/career_cur1.gif WIDTH=151 height=20 onmouseover=this.src='/images/menu/en_CA/career_cur2.gif' onmouseout=this.src='/images/menu/en_CA/career_cur1.gif'>", "/pub/hr/search.jsp");

	mm_addItem("1_9", "mm_l1_1", null, "<img border=0 src=/images/menu/en_CA/faq1.gif WIDTH=109 height=20 onmouseover=this.src='/images/menu/en_CA/faq2.gif' onmouseout=this.src='/images/menu/en_CA/faq1.gif'>", "/pub/faq/index.jsp");	
	mm_addItem("1_10", "mm_l1_1", null, "<img border=0 src=/images/menu/en_CA/contacts_us.gif WIDTH=109 height=20 onmouseover=this.src='/images/menu/en_CA/contacts_us_1.gif' onmouseout=this.src='/images/menu/en_CA/contacts_us.gif'>", "/pub/company/contact.jsp");
	

if(mmActiveElement[0] != 0){
	reClip(mmActiveElement[0]);
	var mm_l0_activeElement = mmActiveElement[0] + "_" + mmActiveElement[1];
	if(mmActiveElement[1]!= 0) getObj(mm_l0_activeElement).className = "menu_L0_Item_o";

}







// probel
