
// Auto center Pop-up window script - Same Popup size for all
var win = null;
function ExternalWindow(mypage,myname){
LeftPosition = (screen.width) ? (screen.width-550)/2 : 0;
TopPosition = (screen.height) ? (screen.height-400)/2 : 0;
settings =
'height='+400+',width='+550+',top='+TopPosition+',left='+LeftPosition+',scrollbars,location,resizable'
win = window.open(mypage,myname,settings)
}

// Javascript of menus Top and Left start here below 

// return the name of the sub menu (from the title string)
function getSubMenu(){
var fulltitle = parent.document.title;
//alert ("check menu" + fulltitle );	
	titleArray = fulltitle.split(" - ");
	arrayLength=titleArray.length;
//alert ("menu length " + arrayLength );

if (arrayLength >= 3) {
thisMenuStr = titleArray[2];
//alert ("thisMenuStr " + thisMenuStr );

thisMenuidList=thisMenuStr.split(" "); 

thisMenu=thisMenuidList[0];

//alert ("the menu" + thisMenu);

	if (arrayLength >= 2) {
mainSection = titleArray[1];
//alert ("mainSection" + mainSection);}
}
}else {
//alert ("NO sub menu!");
return 0;
}
	return thisMenu;
}

// return the name of the main section (from the title string)
function getMainSection(){
var fulltitle = parent.document.title;
//alert ("check menu" + fulltitle );	
	titleArray = fulltitle.split(" - ");
	arrayLength=titleArray.length;
//alert ("menu length " + arrayLength );

	if (arrayLength >= 2) {
mainSection = titleArray[1];
}
//alert ("mainSection" + mainSection);}
else {
//alert ("NO sub menu!");
return 0;
}
	return mainSection;
}

// hilite the top menu
function hiliteTopMenu(){
// get the name of the main section
thisMainSection=getMainSection();
if (thisMainSection != 0) {
//alert ("thisMainSection" + thisMainSection);
if ((thisMainSection == "Bienvenue!") || (thisMainSection == "Qui sommes-nous?") || (thisMainSection == "Nos services") || (thisMainSection == "Impliquez-vous!") || (thisMainSection == "Communications / Publications")){
// -- top menu
// get the element with the id = thisMainSection
var obj=getElementID(thisMainSection);

obj.style.visibility= "visible";
textColor=getColorForSection(thisMainSection);
//alert ("text color" + textColor);		
obj.style.color=textColor;

obj.style.visibility= "visible";
textBackgroundColor=getBackgroundColorForSection(thisMainSection);
//alert ("text Background color" + textColor);		
obj.style.background=textBackgroundColor;
}

}
}

// return the appropriate color of the hilite depending on the section
function getColorForSection(mainSection){
if (mainSection == "Bienvenue!") {return "#ffffff";}
if (mainSection == "Qui sommes-nous?") {return "#ffffff";}
if (mainSection == "Nos services") {return "#ffffff";}
if (mainSection == "Impliquez-vous!") {return "#ffffff";}
if (mainSection == "Communications / Publications") {return "#ffffff";}
}

// return the appropriate background color of the hilite depending on the section
function getBackgroundColorForSection(mainSection){
if (mainSection == "Bienvenue!") {return "#626f68";}
if (mainSection == "Qui sommes-nous?") {return "#626f68";}
if (mainSection == "Nos services") {return "#626f68";}
if (mainSection == "Impliquez-vous!") {return "#626f68";}
if (mainSection == "Communications / Publications") {return "#626f68";}
}


// hilite the submenu on the left of the page
function hiliteLeftMenu(){
// get the submenu name
thisMenu = getSubMenu();
// get the main section name : we need it for the color of the menu
thisMainSection=getMainSection();
if (thisMenu != 0) {
//alert (thisMenu);/
//alert ("thisMenu == " + thisMenu);
var id = thisMenu;

//alert(document.getElementById);
obj = getElementID(id)

obj.style.visibility= "visible";
textColor=getColorBySection(thisMainSection);
//alert ("text color" + textColor);		
obj.style.color=textColor;

obj.style.visibility= "visible";
textBackgroundColor=getBackgroundColorBySection(thisMainSection);
//alert ("text Background color" + textColor);		
obj.style.background=textBackgroundColor;

}
}

// return the appropriate color of the hilite depending on the section
function getColorBySection(mainSection){
if (mainSection == "Qui sommes-nous?") {return "#865758";}
if (mainSection == "Nos services") {return "#865758";}
if (mainSection == "Impliquez-vous!") {return "#865758";}
if (mainSection == "Communications / Publications") {return "#865758";}
}

// return the appropriate background color of the hilite depending on the section
function getBackgroundColorBySection(mainSection){
if (mainSection == "Qui sommes-nous?") {return "#F4D6D8";}
if (mainSection == "Nos services") {return "#F4D6D8";}
if (mainSection == "Impliquez-vous!") {return "#F4D6D8";}
if (mainSection == "Communications / Publications") {return "#F4D6D8";}
}


// return element id 
function getElementID(id) {
if (document.layers) {
//alert("document.layers");
		var obj = document.layers[id];
		obj.visibility= "visible";
	}
	
	else if (document.getElementById) {
//alert("document.getElementById");
			var obj = document.getElementById(id);
//alert("I am a " + obj.tagName + " element");
	}
else if (document.all && !window.opera) {
//alert("document.all window.opera");
		var obj = document.all[id];
		obj.style.visibility= "visible";
	}
return obj;
}