/*Submenu function Begins | Debut de la fonction des sous-menus*/
var picroot = '/app/templaterepository/Evolutra_new_site_2010/images/';
var imgList = new Array();
imgList['menu_01']		= picroot+'top_01_hover_en.jpg';
imgList['menu_02']		= picroot+'top_02_hover_en.jpg';
imgList['menu_03']		= picroot+'top_03_hover_en.jpg';
imgList['menu_04']		= picroot+'top_04_hover_en.jpg';
imgList['menu_05']		= picroot+'top_05_hover_en.jpg';
imgList['menu_06']		= picroot+'top_06_hover_en.jpg';
imgList['menu_07']		= picroot+'top_07_hover_en.jpg';
imgList['menu_08']		= picroot+'top_08_hover_en.jpg';

imgList['menu_01f']		= picroot+'top_01_hover_fr.jpg';
imgList['menu_02f']		= picroot+'top_02_hover_fr.jpg';
imgList['menu_03f']		= picroot+'top_03_hover_fr.jpg';
imgList['menu_04f']		= picroot+'top_04_hover_fr.jpg';
imgList['menu_05f']		= picroot+'top_05_hover_fr.jpg';
imgList['menu_06f']		= picroot+'top_06_hover_fr.jpg';
imgList['menu_07f']		= picroot+'top_07_hover_fr.jpg';
imgList['menu_08f']		= picroot+'top_08_hover_fr.jpg';

var idList = new Array();
idList['0']		= 'menu_01';
idList['183']	= 'menu_02';
idList['184']	= 'menu_03';
idList['185']	= 'menu_04';
idList['186']	= 'menu_05';
idList['187']	= 'menu_06';
idList['188']	= 'menu_07';
idList['189']	= 'menu_08';

var lang = "";

function Ajaxify(url, CompleteFunction, InProgressFunction)
{
	
	var xmlhttp;
	if (window.XMLHttpRequest)
	{
		xmlhttp = new XMLHttpRequest();
	}
	else
	{
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	
	xmlhttp.onreadystatechange=function()
	{
		
		if(xmlhttp.readyState == 4 && CompleteFunction != null)
		{			
			CompleteFunction(xmlhttp.responseText);			
		}
		else if(xmlhttp.readyState != 4 && InProgressFunction != null)
		{
			InProgressFunction();
		}	
	}
	
	
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}

function GetPageID()
{
	var querystring = window.location.search.substring(1).split('&');
	
	var i;
	for (i = 0; i < querystring.length; ++i)
	{
		var parameter = querystring[i].split('=');

		if (window.location.pathname.indexOf("_e.aspx") != -1)
		{
			lang = "en"
		} else
		{
			lang = "fr"
		}

		if (parameter[0].toLowerCase() == "detailid" || parameter[0].toLowerCase() == "articleid" || parameter[0].toLowerCase() == "categoryid")
		{
		    //HighlightMenuItem(parameter[1])		   
		    Ajaxify("/app/templaterepository/Evolutra_new_site_2010/GetRootCategory.aspx?" + querystring[i].toLowerCase(), HighlightMenuItem);
			break;
		}
	}
	
	if ("" == querystring)
	{
		HighlightMenuItem("0");
	}
}

function HighlightMenuItem(val)
{
	//alert
	(val)
	var id = idList[val];
	if (id)
	{
		var pic = document.getElementById(id);
 
		if (pic != null)
		{
			//alert(lang);
			if (lang == "en")
			{
				pic.setAttribute('src', imgList[id]);
				pic.setAttribute('onmouseover', null);
				pic.setAttribute('onmouseout',  null);
			} else
			{
				//alert(imgList[id + "f"]);
				pic.setAttribute('src', imgList[id + "f"]);
				pic.setAttribute('onmouseover', null);
				pic.setAttribute('onmouseout',  null);
			}
		} else {}
	}
}
