/*
function changeClass(calc,clas)
{
	 document.getElementById(calc).className=clas;
}
*/
// browser test:
var B_Name=navigator.appName;
B_Ver=parseInt(navigator.appVersion);
if ((B_Name == "Microsoft Internet Explorer" || B_Name == "Netscape") && B_Ver >= 3) var version = "1";
else version = "0";

//positionner les calques de navigation
//------ RAFRAICHIR LA PAGE ---//
function regenerate()
{
	//window.location.reload();
}

//------POSITIONNER LES CALQUES---------//
function positionner(calque, posL, posH, larg)
{
	if(navigator.appName.substring(0,3)=="Net")
	{
		var leftL=(window.innerWidth)/2;
		setTimeout("window.onresize=regenerate",400);
	}
	else
	{
		var leftL=(document.body.clientWidth)/2;
		setTimeout("window.onresize=regenerate",400);
	}

	//largeur des tableaux et des calques
	var tabL=(larg/2);

	var margeL = (leftL-tabL);
	if (margeL < 0)
	{
		margeL=0;
	}

	
	var posGauche;
	if(navigator.appName.substring(0,3)=="Net") var posGauche=posL-9;
	else var posGauche=posL;

	if (document.getElementById)
	{
		// si on est sur la homepage, pas d'ascenceur
		if (currentPage == "hom")
		{
			if(navigator.appName.substring(0,3)=="Net")
			{
				var ajustL = 8;
				var ajustH = 0;
			}
			else
			{
				var ajustL = 0;
				var ajustH = 4;
			}
		}
		else
		{
			if(navigator.appName.substring(0,3)=="Net")
			{
				var ajustL = 0;
				var ajustH = 0;
			}
			else
			{
				var ajustL = 0;
				var ajustH = 0;
			}
		}
		var layerObj=document.getElementById(calque);
		layerObj.style.left=margeL+posGauche+ajustL+'px';
		layerObj.style.top=posH+ajustH+'px';
		return;
	}
}

//-- POSITIONNER LES MENUS --//
function posMenuHome()
{
	positionner('sous1',50,187,955);
	positionner('sous2',124,187,955);
	positionner('sous3',247,187,955);
	positionner('sous4',355,187,955);
	positionner('sous5',517,187,955);
}

function posMenuInt()
{
	positionner('sous1',0,203,955);
	positionner('sous2',74,203,955);
	positionner('sous3',197,203,955);
	positionner('sous4',305,203,955);
	positionner('sous5',467,203,955);
	positionner('sous6',571,203,955);	
}

function posMenuPress()
{
	positionner('sous1',8,179,776);
	positionner('sous2',75,179,776);
	positionner('sous3',198,179,776);
	positionner('sous4',305,179,776);
	positionner('sous5',468,179,776);
	positionner('sous6',660,179,955);		
}



//Define global variables
var timerID = null;
var timerOn = false;
var timecount = 4000;
var what = null;
var newbrowser = true;
var check = false;

		
//temps d'affichage des menus non en cours
function startTime_fr()
{
	if (timerOn == false)
	{
		if(currentPage != "hom")
			timerID=setTimeout("hideAll('fr'); liteImgMenu(currentPage,'fr');",timecount);
		else
			timerID=setTimeout("hideAll('fr');",timecount);
		timerOn = true;	
	}
}
function startTime_en()
{
	if (timerOn == false)
	{
		if(currentPage != "hom")
			timerID=setTimeout("hideAll('en'); liteImgMenu(currentPage,'en');",timecount);
		else
			timerID=setTimeout("hideAll('en');",timecount);
		timerOn = true;	
	}
}
function startTime_ru()
{
	if (timerOn == false)
	{
		if(currentPage != "hom")
			timerID=setTimeout("hideAll('ru'); liteImgMenu(currentPage,'ru');",timecount);
		else
			timerID=setTimeout("hideAll('ru');",timecount);
		timerOn = true;	
	}
}

function stopTime()
{
	if (timerOn)
	{
		clearTimeout(timerID);
		timerID = null;
		timerOn = false;
	}
}


function chemin()
{
	var chemin;
	if(currentPage != "hom")
		var chemin = "../"
	else
		var chemin = "";

	return chemin;
}

// preload images:
if (version == "1")
{
	var drapeau_fr = new Image();
	drapeau_fr.src = chemin() + "img/drapeau_fr.gif";
	
	var drapeau_fr_2 = new Image();
	drapeau_fr_2.src = chemin() + "img/drapeau_fr_2.gif";
	
	var drapeau_us = new Image();
	drapeau_us.src = chemin() + "img/drapeau_us.gif";
	
	var drapeau_us_2 = new Image();
	drapeau_us_2.src = chemin() + "img/drapeau_us_2.gif";
	
	var drapeau_ru = new Image();
	drapeau_ru.src = chemin() + "img/drapeau_ru.gif";
	
	var drapeau_ru_2 = new Image();
	drapeau_ru_2.src = chemin() + "img/drapeau_ru_2.gif";

	var menu = new Array();
	var menu_2 = new Array();
	
	for (z=1; z<6; z++)
	{
		menu[z] = new Image();
		menu[z].src = chemin() + "img/fr_menu_"+ z +".gif";
		menu_2[z] = new Image();
		menu_2[z].src = chemin() + "img/fr_menu_"+ z +"_2.gif";
	}
	
	var flesh1 = new Image();
	flesh1.src = chemin() + "img/bout_rech.gif";
	
	var flesh2 = new Image();
	flesh2.src = chemin() + "img/bout_rech_2.gif";
        
}

//Allumer-éteindre les drapeaux des langues
function Lite(imgname,imgsrc)
{	
	if (version == "1")
	{
		eval('document.' + imgname + '.src = "' + chemin() + 'img/' + imgsrc + '.gif"');
	}
}

//Allumer-éteindre le sous menu courant
function on(lien)
{
	var quelien = document.getElementById(lien);
	quelien.className="submenuActive";
}
function of(lien)
{
	var quelien = document.getElementById(lien);
	quelien.className="submenu";
}

//allumer le titre du menu - afficher le calque du sous-menu
function hiLite(num,langue)
{
	//eval("document.getElementById('sous" + num + "').style.backgroundColor = '#F92E0E'");
	eval('document.menu_' + num + '.src = "' + chemin() + 'img/' + langue + '_menu_' + num + '_2.gif"');
	//showLayer('sous'+ num);
}
function liteImgMenu(num,langue)
{
	//eval("document.getElementById('sous" + num + "').style.backgroundColor = '#F92E0E'");
	eval('document.menu_' + num + '.src = "' + chemin() + 'img/' + langue + '_menu_' + num + '_2.gif"');
}

//éteindre tous les titres du menu et effacer tous les sous-menus
function  hideAll(x,langue)
{
	eval('document.menu_' + x +'.src = "' + chemin() + 'img/' + langue + '_menu_' + x + '.gif"');
	
	/*var num = new Array();
	var nbreMenu;
	
	nbreMenu = 5;
		
	for (x=1; x<=nbreMenu; x++) 
	{
		//eval("document.getElementById('sous" + x + "').style.backgroundColor = '#453015'");
		
		//on affiche pas la boutique dans la navigation en anglais
		//l'image "boutique" porte le numéro 6
		if(x == 5)
		{
			if(langue == 'fr')
			{
				eval('document.menu_' + x +'.src = "' + chemin() + 'img/' + langue + '_menu_' + x + '.gif"');
			}
		}
		else
		{
			eval('document.menu_' + x +'.src = "' + chemin() + 'img/' + langue + '_menu_' + x + '.gif"');
		}
		hideLayer('sous'+ x +'');
	}*/
}


function homepageOn(langue,x)
{
	//eval("document.getElementById('sous" + x + "').style.backgroundColor = '#F92E0E'");
	eval('document.menu_' + x +'.src = "' + chemin() + 'img/' + langue + '_menu_' + x + '_2.gif"');
}
function homepageOf(langue,x)
{
	//eval("document.getElementById('sous" + x + "').style.backgroundColor = '#453015'");
	eval('document.menu_' + x +'.src = "' + chemin() + 'img/' + langue + '_menu_' + x + '.gif"');
}


var activeSub=0;
var SubNum=0;

/*function reDo(){ window.location.reload() }
window.onresize = reDo;*/

function init()
{
	//  alert ("Running Init");
	if (document.layers)
	{
		//  alert ("Running Netscape 4");
		layerRef="document.layers";
		styleSwitch="";
		visibleVar="show";
		screenSize = window.innerWidth;
		what ="ns4";
	}
	else if(document.all)
	{
		//  alert ("Running IE");
		layerRef="document.all";
		styleSwitch=".style";
		visibleVar="visible";
		screenSize = document.body.clientWidth + 18;
		what ="ie";
	}
	else if(document.getElementById)
	{
		//  alert ("Running Netscape 6");
		layerRef="document.getElementByID";
		styleSwitch=".style";
		visibleVar="visible";
		what="moz";
	}
	else
	{
		//alert("Older than 4.0 browser.");
		what="none";
		newbrowser = false;
	}
	
	window.status=''; //status bar text to go here
	check = true;
}


// Turns the layers on and off
function showLayer(layerName)
{
	if (document.getElementById)
	{
		var layerHome=document.getElementById(layerName);
		layerHome.style.visibility='visible';
	}

	else if (document.all)
	{
		ie='document.all.'+ layerName +'.style.visibility=\'visible\'';
		eval (ie);
	}

	else if (document.layers)
	{
		ns='document.layers.'+ layerName +'.visibility=\'show\'';
		eval (ns);
	}
}

function hideLayer(layerName)
{
	if (document.getElementById)
	{
		var layerHome=document.getElementById(layerName);
		layerHome.style.visibility='hidden';
	}

	else if (document.all)
	{
		ie='document.all.'+ layerName +'.style.visibility=\'hidden\'';
		eval (ie);
	}

	else if (document.layers)
	{
		ns='document.layers.'+ layerName +'.visibility=\'hide\'';
		eval (ns);
	}
}




function neutre()
{
	hiLite('menu1');
	hiLite('menu2');
	hiLite('menu3');
	hiLite('menu4');
	hiLite('menu5');
	hiLite('menu6');
}

function onLoad(){
	init();
}
function ouvre(dest1,larg,haut)
{
	dest = open(dest1,"fenetre","toolbar=0,directories=0,menubar=0,scrollbars=no,status=0,resizable=yes,width="+larg+",height="+haut);
	dest.focus();
}