// JavaScript Document


function pagecontent(url, containerid)
{
	var aXmlHttp = createXMLHttp();
	aXmlHttp.onreadystatechange = function(){
		afficherContenu(aXmlHttp, containerid);
	}	
	aXmlHttp.open("get", url, true);
	aXmlHttp.send(null);
	

}
function createXMLHttp() {
	if(typeof XMLHttpRequest != "undefined") {
		return new XMLHttpRequest();				
	} else if(window.ActiveXObject) {
		var aVersions = ["MSXML2.XMLHttp.5.0","MSXML2.XMLHttp.4.0", "MSXML2.XMLHttp.3.0", "MSXML2.XMLHttp", "Microsoft.XMLHttp"];
		
		for(var i= 0; i<aVersions.length; i++) {
			try {
				var aXmlHttp = new ActiveXObject(aVersions[i]);
				return aXmlHttp;
				
			} catch (oError) {
				
			}				
		}			
	}
}


function afficherContenu(aXmlHttp, containerid)
{
	if (aXmlHttp.readyState == 4 && aXmlHttp.status==200)
	{
		
		document.getElementById(containerid).innerHTML=aXmlHttp.responseText;
		}
}

function goTop(containerid){

document.getElementById(containerid).scrollTop= 0;}
	

/******* for the sub menu ****/
function afficheMenu(indiceMenu, page){
	/*5 = number of menus*/
	var indiceMenus = indiceMenu;
	
	for(var i=1; i<=5; i++) {	
		if(indiceMenus == i){
			document.getElementById('M'+i).style.display = 'block';
			document.getElementById("a"+indiceMenu).setAttribute("class", "active");
			document.getElementById("a"+indiceMenu).setAttribute("className", "active");
	
			for(var n=0; n < 10; n++) {
				var thisLink = document.getElementById("menu"+indiceMenu+"_"+n);
				if(thisLink != null) {
					thisLink.setAttribute("class", "submenu");
					thisLink.setAttribute("className", "submenu");
				} else {
					break;	
				}
				
			}
		} else {
			document.getElementById("M"+i).style.display = 'none';
			if(page == "index")
			{document.getElementById("a"+i).setAttribute("class", "linkI");
			document.getElementById("a"+i).setAttribute("className", "linkI");}
			else{
			document.getElementById("a"+i).setAttribute("class", "link");
			document.getElementById("a"+i).setAttribute("className", "link");}		
		}
			
				
		if (navigator.appName.substring(0,9) == "Microsoft") {
			for(var n=1; n<=5; n++) {
				var thisCadre = document.getElementById('cadre'+n);
				if(thisCadre != null) thisCadre.style.marginTop = '-10px';
			}
		}
	}
}
	
/*****for the styles of the links of the submenus **************************/
function styleLink(ssmenu, tag, numLinks){
	//appliquer les styles aux menus niveau 1

	for(var i=0; i < numLinks; i++) {
		var thisLink = 	document.getElementById(tag + "_" + i);
		
		if(i == ssmenu) {
			thisLink.setAttribute("class", "submenuActive");
			thisLink.setAttribute("className", "submenuActive");
		} else {
			thisLink.setAttribute("class", "submenu");
			thisLink.setAttribute("className", "submenu");
		}
	}
	
	if (navigator.appName.substring(0,9) == "Microsoft") {
		var thisMenu = Number(tag.substr(4)) + 1;
		if(thisMenu < 5) {document.getElementById('cadre'+thisMenu).style.marginTop = '-10px';}
	}
}




function styleLinkTitle(ssmenu, page){
	//appliquer les styles aux menus niveau 1

	for(var i=1; i <= 5; i++) {
		var thisLink = 	document.getElementById("a" + i);
		
		if(i == ssmenu) {
			thisLink.setAttribute("class", "active");
			thisLink.setAttribute("className", "active");
		} else {
			if(page=='index'){thisLink.setAttribute("class", "linkI");
			thisLink.setAttribute("className", "linkI");}
			else{thisLink.setAttribute("class", "link");
			thisLink.setAttribute("className", "link");}
			
		}
	}
}



