var sections = new Array() ;
// -------------------------------------------------------------------------------
function oDeroul(titre,lien){
	this.titre	= titre.replace(/( )/g,"&nbsp;") ; ;
	this.lien	= lien ;
}
// -------------------------------------------------------------------------------
function oS_section(titre,lien){
	this.titre	= titre.replace(/( )/g,"&nbsp;") ; ;
	this.lien	= lien ;
	this.deroul	= new Array() ;
}
// -------------------------------------------------------------------------------
function oSection(titre){
	this.titre	= titre.replace(/( )/g,"&nbsp;") ;
	this.s_sec	= new Array() ;
}
// -------------------------------------------------------------------------------
var largeurPortail = 750 ;
var hauteurCellules = 12 ;
var positionY = 188 ;
var positionX = 102 ;
var popActif = null ;
var celActive = null ;
var chrono = 0 ;
var usr = navigator.userAgent.toUpperCase() ;
var mac = (usr.lastIndexOf("MAC") >= 0 )? true : false ;
var exp = (usr.lastIndexOf("MSIE") >= 0 && usr.lastIndexOf("OPERA") < 0)? true : false ;
var net = (usr.lastIndexOf("NETSCAPE") >= 0 )? true : false ;
var ope = (usr.lastIndexOf("OPERA") >= 0 )? true : false ;
// -------------------------------------------------------------------------------
// Position verticale des menus selon le fureteur :

var indice  = 2 ;
var espaceSection = 28 ;
if(ope){positionY -= 5 ; indice = 1 ;}
if(mac && exp){positionY -= 20 ; indice = 1 ;}
// -------------------------------------------------------------------------------
function calculLargeur(){
/*************************************************
 calcul l'endroit où se trouve le rebord gauche du portail
 de manière à positionner le menu DHTML
*************************************************/
	var largeurTotale = document.body.offsetWidth ;
	var emplacement = positionX ;
	if(largeurPortail < largeurTotale) emplacement += (largeurTotale - largeurPortail)/2 ;
	return parseInt(emplacement) ; 
}
// -------------------------------------------------------------------------------
function mOv(oTD){
	oTD.background="../img/cotebg2.jpg";
	//oTD.style.background-color='0xc6bfaf';
	if(navigator.userAgent.indexOf("MSIE 5.5") < 0) oTD.style.cursor="pointer";}//c2bab4
// -------------------------------------------------------------------------------
function mOt(oTD){
	if(oTD != null){
		oTD.background="../img/cotebg1.jpg";
		//oTD.style.background-color='0x3b7b19b';
		if(navigator.userAgent.indexOf("MSIE 5.5") < 0)oTD.style.cursor="pointer";
	}
}
// -------------------------------------------------------------------------------
function setLargeur(){
	for(var i = 0 ; i < sections.length ; i++){
		for(var j = 0 ; j < sections[i].s_sec.length ; j++){
			if(sections[i].s_sec[j].deroul.length > 0){
				var oDiv = document.getElementById("d"+ i +"_"+ j).style ;
				oDiv.left = calculLargeur() ;
			}
		}
	}
}
// -------------------------------------------------------------------------------
function ecritDIV(){
	for(var i = 0 ; i < sections.length ; i++){
		for(var j = 0 ; j < sections[i].s_sec.length ; j++){
			if(sections[i].s_sec[j].deroul.length > 0){
				document.write('<div id="d'+ i +'_'+ j +'" style="border: solid black 1px;position:absolute;top:'+ positionY +'px;left:0px;visibility:hidden" onMouseOver="ouvre()" onMouseOut="ferme()">') ;
				document.write('<table border="0" cellspacing="0" cellpadding="0" background="../img/cotebg1.jpg" bgcolor="#b7b19b" style="z-index:1;">');
				for(var k = 0 ; k < sections[i].s_sec[j].deroul.length ; k++){
					var xDeroulant = sections[i].s_sec[j].deroul[k] ;
					document.write('<tr><td class="tabBleu" onMouseOver="mOv(this);" onMouseOut="mOt(this);"><a href="'+ xDeroulant.lien +'" class="menu">'+ xDeroulant.titre +'</a></td></tr>') ;
				}
				document.write('</table></div>') ;
			}
			positionY += hauteurCellules+indice+13;/////////////////////////////////
		}
		positionY += espaceSection ;
	}
}
// -------------------------------------------------------------------------------
function ecritMenu(){
	for(var i = 0 ; i < sections.length ; i++){
		document.write('<tr valign="top" height="8"><td></td></tr>') ;
		document.write('<tr valign="top"><td class="section">'+ sections[i].titre +'</td></tr>') ;
		document.write('<tr valign="top" height="4"><td></td></tr>') ;
		for(var j = 0 ; j < sections[i].s_sec.length ; j++){
			document.write('<tr valign="top" height="'+ (hauteurCellules) +'"><td class="tabBleu" onMouseOver="mOv(this);POP(\'d'+ i +'_'+ j +'\',this);"  onMouseOut="ferme();">') ;
			document.write('<a href="'+ sections[i].s_sec[j].lien +'" class="menu">'+ sections[i].s_sec[j].titre +'</a></td></tr>') ;
		}
		//document.write('<tr><td height="4" class="tabBleu"></td></tr>');
	}
}
// -------------------------------------------------------------------------------
function POP(p1,p2){
	clearTimeout(chrono) ;
	var oDiv = document.getElementById(p1) ;
	if(popActif != null) popActif.visibility = "hidden" ;
	if(oDiv != null){
		oDiv = oDiv.style ;
		oDiv.left = calculLargeur() ;
		oDiv.visibility = "visible" ;
		
	}
	if(celActive != null) mOt(celActive) ;
	celActive = p2 ;
	mOv(celActive) ;
	popActif = oDiv ;
	
}
// -------------------------------------------------------------------------------
function clairTout(){
	if(celActive!= null) mOt(celActive) ;
	if(popActif != null) popActif.visibility = "hidden" ;
}
// -------------------------------------------------------------------------------
function ferme() {
	chrono = setTimeout("clairTout()",400) ;
}
// -------------------------------------------------------------------------------
function ouvre() {
	clearTimeout(chrono) ;
}
// -------------------------------------------------------------------------------
document.onclick = clairTout ;
