// ----------  MenuLib (Module client)
// © Copyright M-tech Industries
// Author       : Hervˇ JUGE
// Version      : 3.45
// Last updated : 06/02/08
// Require		: dhtml_lib.js

// Upgrade 2.xx -> 3.0 :
// - rajouter [var MoveOnScroll=false;] et [var BulletsOn=false;] dans def_menus.js
// - rajouter tous ce qui est apres la ligne [function CreateLayer] dans dhtml_lib.js

// -- Remarques :
// - mettre wmode="transparent" pour toute animation Flash sous les menus [Ref] Kalori [HJ 25/01/08]
var CurrentOver=null,LastOver=null,CloseTimer=null;
var NavAgent  = window.navigator.userAgent;
var NavVers = parseInt(NavAgent.charAt(NavAgent.indexOf("/")+1),10);

var IE4 = (document.all && !document.getElementById) ? true : false;
var IE5 = (document.all && document.getElementById) ? true : false;
var NS6 = (document.getElementById && !document.all) ? true : false;
var OP5 = (navigator.userAgent.indexOf("Opera 5")!=-1) ||(navigator.userAgent.indexOf("Opera/5")!=-1);
var OP6 = (navigator.userAgent.indexOf("Opera 6")!=-1) ||(navigator.userAgent.indexOf("Opera/6")!=-1);
// var isMinNS4, isMinIE4, NS6 : dans dhtml_lib.js
var NavAg = NavAgent.toLowerCase();
var NavMajor = parseInt(navigator.appVersion);
var NavIE = ((NavAg.indexOf("msie") != -1) && (NavAg.indexOf("opera") == -1));
var IE7 = (NavIE && (NavMajor == 4) && (NavAg.indexOf("msie 7") != -1));

var pathTemp =""; // HJ 21/02/02
var theActivePath =""; // HJ 06/03/02
var displayActiveItems = true; // HJ 09/09/03 - Pour marquer le chemin en cours

// Pour position souris
var tempX = 0
var tempY = 0

// HJ 07/03/04
//window.onload = initMenus; //ATTENTION : si body onload ds la page, mettre aussi initMenus avec !

	// [AF] Detection onload existant 10/01/07
	// Cf /Data_MTI/Projets/Web_Locadif/Pages Locadif/config/include/common/bibjs/menutext_lib.js
// 	var AgntUsr=navigator.userAgent.toLowerCase();
// 	var DomYes=document.getElementById?1:0;
// 	var NavYes=AgntUsr.indexOf('mozilla')!=-1&&AgntUsr.indexOf('compatible')==-1?1:0;
// 	var ExpYes=AgntUsr.indexOf('msie')!=-1?1:0;
// 	var Opr=AgntUsr.indexOf('opera')!=-1?1:0;
// 	var DomNav=DomYes&&NavYes?1:0;
//  	var DomExp=DomYes&&ExpYes?1:0;
// 	var Nav4=NavYes&&!DomYes&&document.layers?1:0;
// 	var Exp4=ExpYes&&!DomYes&&document.all?1:0;
// 	var PosStrt=(NavYes||ExpYes)&&!Opr?1:0;
// 
// 	// Trigger contient l'objet Body de la fenetre soit qui contient les frames soit celle en cours si pas de frame
// 	var Par=parent.frames[0]&&FirstLineFrame!=SecLineFrame?parent:window;
// 	var Doc=Par.document;
// 	var Bod=Doc.body;
// 	var Trigger=NavYes?Par:Bod;
// alert(Trigger);
// 	if(Trigger.onload)Dummy=Trigger.onload;
// 	if(DomNav&&!Opr)Trigger.addEventListener('load',initMenus,false);
// 	else Trigger.onload=Go;
//function Dummy(){return} // A appele apres chargement body -> Dummy();


// http://css.alsacreations.com/Tutoriels-JavaScript/bonnes-pratiques-javascript#event
// function addLoadEvent(func)
// {
//    var oldonload = window.onload;
//    if(typeof window.onload != 'function')
//    {
//       window.onload = func;
//    }
//    else
//    {
//       window.onload = function()
//       {
//          oldonload();
//          func();
//       }
//    }
// }
// //alert(window.onload);
// addLoadEvent(initMenus);
// //addLoadEvent(oO.method2);

//*****************************************************************************
// Objet Menus (Collection de toutes les barres de menus)
//*****************************************************************************

function Menus(ID) {

  this.ID = ID;
  this.menuBars = new Array(); // Collection de MenuBars
  this.IDMB = new Array(); // Collection des ID de MenuBars
  this.IDMI = new Array(); // Collection des ID de MenuItems
  this.Names = new Array(); // Collection des Name de MenuItems
//this.Parents = new Array(); // Collection des Parents de MenuItems

  // Define methods.
  this.addMenu       = MenusAddMenu;
  this.addIDMB       = MenusAddIDMB;
  this.addIDMI       = MenusAddIDMI;
  this.addNames      = MenusAddNames;
//this.addParents    = MenusAddParents;
  this.setParents    = MenusSetParents;
  
  this.getMenuBar    = MenusGetMenuBar;
  this.getMenuItem   = MenusGetMenuItem;
  this.getMenuItemID = MenusGetMenuItemID;
  this.findMenuPath  = MenusFindMenuPath;
  
  this.buildMap      = MenusBuildSiteMap;
  this.buildMapTable = MenusBuildSiteMapTable;
  this.buildMapCSS   = MenusBuildSiteMapCSS;

  // Add to the list.
  this.index = Menus.length;
  Menus[this.index] = this;
}

//*****************************************************************************
// Methodes de Menus
//*****************************************************************************

function MenusAddMenu(menu) {
	this.menuBars[this.menuBars.length] = menu;
}

function MenusAddIDMB(theVal) {
	this.IDMB[this.IDMB.length] = theVal;
}

function MenusAddIDMI(theVal) {
	this.IDMI[this.IDMI.length] = theVal;
}

function MenusAddNames(theVal) {
	this.Names[this.Names.length] = theVal;
}

/*function MenusAddParents(theVal) {
	this.Parents[this.Parents.length] = theVal;
}*/

function MenusSetParents() {
// Set the .Parent property in MenuBars
// Pour trouver tous les menus top level ou le parent d'une MenuBar
	for (mb = 0; mb < this.menuBars.length; mb++) {
		menuBar=this.menuBars[mb];
		FoundMenu = false;
		i=0;
		while(FoundMenu == false && i < this.menuBars.length) {
			j=0;
			while (FoundMenu == false && j < this.menuBars[i].menuItems.length) {
				if (this.menuBars[i].menuItems[j].Child==menuBar.Name) {
					theParent=this.menuBars[i].Name;
					FoundMenu=true;
				}
				j++
			}
			i++
		}
		if (FoundMenu) {
			menuBar.Parent=theParent;
		}
	}
}


function MenusGetMenuBar(menubar) {
// menubar = Nom [.Name] de la barre (texte), renvoie objet
	temp = 0;
	FoundMenu = false;
	j=0;
	while (FoundMenu == false && j < this.menuBars.length) {
		if (this.menuBars[j].Name==menubar) {
			temp=this.menuBars[j];
			FoundMenu=true;
		}
		j++
	}
	return temp;
}

function MenusGetMenuItem(menuItemName) {
// menuItemName = Nom du menu (texte), renvoie objet MenuItem
	FoundMenu = false;
	i=0;
	theElt=null;
	while(FoundMenu == false && i < this.menuBars.length) {
		j=0;
		while (FoundMenu == false && j < this.menuBars[i].menuItems.length) {
			if (this.menuBars[i].menuItems[j].Name==menuItemName) {
				FoundMenu=true;
				theElt=this.menuBars[i].menuItems[j];
			}
			j++
		}
		i++
	}
	return theElt;
}


function MenusGetMenuItemID(menuitem) {
// menuitem = Nom du menu (texte), renvoie ID MenuBar et ID MenuItem
	MIID = 0;
	MBID = 0;
	FoundMenu = false;
	jj=0;
	while (FoundMenu == false && jj < this.Names.length) {
		if (this.Names[jj]==menuitem) {
			MIID=this.IDMI[jj];
			MBID=this.IDMB[jj];
			FoundMenu=true;
		}
		jj++
	}
	return "" + MBID + ";" + MIID;
}


function MenusFindMenuPath(theMenuBar,theMenuItem,thePath) {
// Trouve le chemin d'acces (renvoie tableau d'ID de MenuBars)
// Renvoie un tableau de paires : [(IDMenuBar1;IDMenuItem1),(,)...]
// thePath = pour recursion, sinon, passer ""
	if (typeof theMenuItem != 'undefined') {
		if (thePath=='') {
			temp=new Array();
			temp[temp.length]=theMenuBar.ID + ";" + theMenuItem.ID;
		} else {
			temp=thePath;
		}
		var FoundMenu = false;
		var i=0;
		var j=0;
		while(FoundMenu == false && i < this.menuBars.length) {
			//if (this.menuBars[i].Level < theMenuBar.Level) {
				j=0;
				while (FoundMenu == false && j < this.menuBars[i].menuItems.length) {
					if (this.menuBars[i].menuItems[j].IDChild==theMenuBar.Name) {
						//tmp=temp.shift(this.menuBars[i].ID);
						temp[temp.length]=this.menuBars[i].ID + ";" + this.menuBars[i].menuItems[j].ID;
						this.findMenuPath(this.menuBars[i],this.menuBars[i].menuItems[j],temp);
						//MenusFindMenuPath(this.menuBars[i],temp);
						FoundMenu=true;
					}
					j++
				}
			//}
			i++
		}
	} else {
		temp="";
	}
	return temp;
}


function MenusBuildSiteMap(theMenuBars,Level,HTMLStr) {
// Affiche l'arborescence des menus avec liens
// var MenusOn=new Array("LMenu_02");
// Appel : document.write(theMenus.buildMap("MainBarTop",0,""));
	var k,j,arrMB,strTmp,theMenuBar,blankStr;

	arrMB = theMenuBars.split(";");
	strTmp=HTMLStr;
	if (Level == 0) {
		//strTmp=strTmp + "<a href='" + homePath + "'>Accueil</a><br>" ;
	}
	for (k = 0; k < arrMB.length; k++) {
		theMenuBar=this.getMenuBar(arrMB[k]);
		for (j = 0; j < theMenuBar.menuItems.length; j++) {
			blankStr="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
			if (theMenuBar.menuItems[j].Title != "" || theMenuBar.menuItems[j].Alt_txt != ""){			
				strTmp=strTmp + blankStr.substr(0,Level*6*4);
				if (theMenuBar.menuItems[j].Link != "") {
					if (theMenuBar.menuItems[j].Link.substr(0,1) == " ") {
						strTmp=strTmp + (theMenuBar.menuItems[j].Title != "" ? theMenuBar.menuItems[j].Title : "<font size='1'>Nouvelle page</font>") + " <font size='1' color='#2d4492'>(Bient&ocirc;t disponible)</font><br>";
					} else {
						strTmp=strTmp + "<a href='" + homePath + theMenuBar.menuItems[j].Link + "'>" + (theMenuBar.menuItems[j].Title != "" ? theMenuBar.menuItems[j].Title : theMenuBar.menuItems[j].Name) + "</a><br>";
					}
				} else {
					if (theMenuBar.menuItems[j].Title != "" || theMenuBar.menuItems[j].Alt_txt != "") {
						strTmp=strTmp + (theMenuBar.menuItems[j].Title != "" ? theMenuBar.menuItems[j].Title : theMenuBar.menuItems[j].Name) + "<br>";
					} else {
						strTmp += "<br>";
					}
				}
			}
			if (theMenuBar.menuItems[j].Child != "") {
				//Recurse
				Level=Level+1;
				strTmp=this.buildMap(theMenuBar.menuItems[j].Child,Level,strTmp);
				Level=Level-1;
			}
		}
	}
	return strTmp;
}

function MenusBuildSiteMapTable(theMenuBars,Level,NbLevel,HTMLStr) {
// Affiche l'arborescence des menus avec liens dans un tableau
// Appel : document.write(theMenus.buildMapTable("MainBarTop",0,3,""));
// Styles : tm1, tm2,... tm[NbLevel] + tm pour <a ...>
	var k,j,arrMB,strTmp,theMenuBar;

	arrMB = theMenuBars.split(";");
	strTmp=HTMLStr;
	if (Level == 0) {
		strTmp=strTmp + "<table border='0' cellspacing='0' cellpadding='0' width='280'>\n" ;
	}
	for (k = 0; k < arrMB.length; k++) {
		theMenuBar=this.getMenuBar(arrMB[k]);
		for (j = 0; j < theMenuBar.menuItems.length; j++) {
			if (theMenuBar.menuItems[j].Title != "" || theMenuBar.menuItems[j].Alt_txt != ""){			
				
				strTmp=strTmp + "<tr>\n";
				for (n = 1; n < (Level+1); n++) {
					strTmp=strTmp + "<td width='15'></td>\n";
				}

				strTmp=strTmp + "<td class='tm" + (Level+1) + "'" + (NbLevel-Level>1?" colspan='" + (NbLevel-Level) + "'":"") + ">";
				
				if (theMenuBar.menuItems[j].Link != "") {
					if (theMenuBar.menuItems[j].Link.substr(0,1) == " ") {
						strTmp=strTmp + (theMenuBar.menuItems[j].Title != "" ? theMenuBar.menuItems[j].Title : "<font size='1'>Nouvelle page</font>") + " <font size='1' color='#2d4492'>(Bient&ocirc;t disponible)</font>";
					} else {
						strTmp=strTmp + "<a href='" + homePath + theMenuBar.menuItems[j].Link + "' class='tm'>" + (theMenuBar.menuItems[j].Title != "" ? theMenuBar.menuItems[j].Title : theMenuBar.menuItems[j].Name) + "</a>";
					}
				} else {
					if (theMenuBar.menuItems[j].Title != "" || theMenuBar.menuItems[j].Alt_txt != "") {
						strTmp=strTmp + (theMenuBar.menuItems[j].Title != "" ? theMenuBar.menuItems[j].Title : theMenuBar.menuItems[j].Name);
					}
				}
				strTmp=strTmp + "</td>\n</tr>\n";
			}
			if (theMenuBar.menuItems[j].Child != "") {
				//Recurse
				if ((Level+1)<NbLevel) {
					Level=Level+1;
					strTmp=this.buildMapTable(theMenuBar.menuItems[j].Child,Level,NbLevel,strTmp);
					Level=Level-1;
				}
			}
		}
	}
	if (strTmp.indexOf('</table>')==-1 && (Level == 0)) strTmp+="</table>\n" ;
	return strTmp;
}

function MenusBuildSiteMapCSS(theMenuBars,Level,HTMLStr) { // HJ 071001
// Affiche l'arborescence des menus avec liens et styles CSS : h1, h2, h3...
// Styles a definir dans styles_adm.css, section "Bloc SiteMap" : .sitemap h1 { ... }
// Appel : document.write(theMenus.buildMapCSS("MainBarTop",0,""));
	var k,j,arrMB,strTmp,theMenuBar;
	arrMB = theMenuBars.split(";");
	strTmp=HTMLStr;
	deltaLev=3;
	//if (Level == 0) { }
	for (k = 0; k < arrMB.length; k++) {
		theMenuBar=this.getMenuBar(arrMB[k]);
		for (j = 0; j < theMenuBar.menuItems.length; j++) {
			if ((theMenuBar.menuItems[j].Title != "" || theMenuBar.menuItems[j].Alt_txt != "")&&(theMenuBar.menuItems[j].MapOnly != 2)){			
				strTmp+="<h"+(Level+deltaLev)+">";
				theTxt=(theMenuBar.menuItems[j].Title != "" ? theMenuBar.menuItems[j].Title : (theMenuBar.menuItems[j].Alt_txt != "" ? theMenuBar.menuItems[j].Alt_txt : theMenuBar.menuItems[j].Name))
				theAlt=((theMenuBar.menuItems[j].Alt_txt != "" && theMenuBar.menuItems[j].Title != "") ? theMenuBar.menuItems[j].Alt_txt : "");
				if (theMenuBar.menuItems[j].Link != "") {
					if (theMenuBar.menuItems[j].Link.substr(0,1) == " ") {
						strTmp+=(theMenuBar.menuItems[j].Title != "" ? theMenuBar.menuItems[j].Title : "<font size='1'>Nouvelle page</font>") + " <font size='1' color='#2d4492'>(Bient&ocirc;t disponible)</font></h"+(Level+deltaLev)+">\r";
					} else {
						theLinkTest=theMenuBar.menuItems[j].Link.toLowerCase();
						if (theLinkTest.indexOf('javascript:')!=-1) {
							strTmp+="<a href='#' onclick=\"" + theMenuBar.menuItems[j].Link + "\">" + theTxt + "</a></h"+(Level+deltaLev)+">\r";
						} else {
							strTmp+="<a href='" + homePath + theMenuBar.menuItems[j].Link + "' title='"+theAlt+"'>" + theTxt + "</a></h"+(Level+deltaLev)+">\r";
						}
					}
				} else {
					if (theMenuBar.menuItems[j].Title != "" || theMenuBar.menuItems[j].Alt_txt != "") {
						strTmp+=theTxt + "</h"+(Level+deltaLev)+">\r";
					} else {
						strTmp+="</h"+(Level+deltaLev)+">\r";
					}
				}
			}
			if (theMenuBar.menuItems[j].Child != "") { //Recurse
				Level=Level+1;
				strTmp=this.buildMapCSS(theMenuBar.menuItems[j].Child,Level,strTmp);
				Level=Level-1;
			}
		}
	}
	return strTmp;
}



//*****************************************************************************
// Objet MenuBar (Une zone de menu = un calque DHTML)
//*****************************************************************************

function MenuBar(Name,x,y,w,h,dispo,mode,etat,cssClass,BgColor,AlignX,AlignY,Bullets) {
// dispo  : "H" ou "V"ertical
// mode   : "C"lic ou "S"urvol
// etat   : 0 (masquer) ou 1 (afficher) 2 (tjs masquer) ou 3 (tjs afficher)
// AlignX : L(eft), C(enter), R(ight), F(ixed) + [S] pour scroll (ex : CS=centre avec ajustement horizontal sur agrandissement fenetre)
// AlignY : T(op), M(iddle), B(ottom), F(ixed) + [S] pour scroll

  this.ID = 0;
  this.Name = Name;
  this.Parent = ""; // Top level="" ou sous-menu
  this.x = x; // < 0 = relatif
  this.y = y;
  this.AlignX = AlignX;
  this.AlignY = AlignY;
  this.Bullets = Bullets; // nom groupe images puces

  this.width  = w;
  this.height = h;

  this.dispo = dispo;
  this.mode = mode;
  this.State = etat;

  //this.Background  = (Background != "" ? ImageNew(homePath + Background) : "");
  this.cssClass  = cssClass; // Remplace Background
  this.BgColor = (BgColor != "" ? BgColor : ""); // Obsolete

  this.menuItems = new Array();
  this.created = false;

  // Define methods.
  this.addMenu       = MenuBarAddMenu;
  this.create        = MenuBarCreate;
  this.hide          = MenuBarHide;
  this.show          = MenuBarShow;
  this.hideSelBoxes  = MenuBarHideSelectBoxes; // HJ 060419

  // Add to the list.
  this.index = MenuBar.length;
  MenuBar[this.index] = this;
}

//*****************************************************************************
// Methodes de MenuBar
//*****************************************************************************

function MenuBarAddMenu(menu) {
// Ajoute un MenuItem dans un MenuBar
  if (!this.created)
    this.menuItems[this.menuItems.length] = menu;
}


function MenuBarCreate() {
	var str;
	var i, j;
	var width, height;
	var x, y;
	
	//-- Style de depart :
	theStyle="position:absolute; left: " + this.x + (this.x>0 ? 'px' : '' ) + "; top: " + this.y + "px; z-index: 10;";
	if (this.BgColor != "") { theStyle += "background-color:" + this.BgColor + ";" }
//if (typeof this.Background == 'object') { theStyle += "background-image: url("+ this.Background.src +");" }
	if (this.dispo == "H") {
		//theStyle += "width: auto;"; //"height: " + this.height + "px;";
		theStyle += (this.height>0?"height: " + this.height + "px;":"");
	} else {
		theStyle += (this.width>0?"width: " + this.width + "px;":"");
	}
	if (this.State) {
		theStyle += "visibility: visible;";
	} else {
		theStyle += "visibility: hidden;"; //"display: none;"
	}
	
    str = '<div id="' + this.Name + '"' + (this.cssClass!=""?' class="' + this.cssClass + '"' : '' ) + ' style="' + theStyle + '"'
        + ' onmouseover ="CurrentOver=\'' + this.Name + '\';" onmouseout ="TimeoutErase(\'' + this.Name + '\'); return false;"'
        + '>\n';

	for (i = 0; i < this.menuItems.length; i++) { // Boucle sur MenuItems : un DIV par article de menu
		theStyleInt=""; // HJ 070827
		if (typeof this.menuItems[i].Img_Std == "object") {
			theStyleInt="";
		} else {
			if(this.height>0) {theStyleInt="height:" + this.height + "px;";}
			if(this.width>0) {theStyleInt="width:" + this.width + "px;";}			
		}	
		if (this.menuItems[i].MapOnly != 1) { // Visible ds plan du site seul
			//if (this.dispo == "V") { str += '<tr' + theHgt + '>' }
			// Ajout fleche sous menu
			theArw='';
			if (BulletsOn) {
				if (this.menuItems[i].Child != "" ) {
					theArw='<div class="'+BulletsSubMenu.CSS+'"><img src="' + BulletsSubMenu.onImage.src + '" border="0" /></div>'
				} else {
					theArw='<div class="'+BulletsSubMenu.CSS+'"><img src="' + BulletsSubMenu.offImage.src + '" border="0" /></div>'
				}
			}
			theStyleInt+="float:left; z-index:20;";

			if (typeof this.menuItems[i].Img_Std == "object") { // HJ 30/03/02
				// Gestion des images
				str += '<div id="' + this.menuItems[i].Name + '" style="' + theStyleInt + '">\n<a href="javascript:GoToLink(\'' + escape(this.menuItems[i].Link) + '\');"'
					+ ' onmouseover="LastOver=CurrentOver;CurrentOver=\'' + this.Name + '\';'
					+ (this.mode=="S" ? 'ShowThisLayer(\'' + this.menuItems[i].Name + '\');' : '' ) + 'SwapImage(\'' + this.menuItems[i].Name + '\', \'' + "1" + '\');return true;"'
					+ ' onmouseout ="SwapImage(\'' + this.menuItems[i].Name + '\', \'' + "0" + '\');return true;"'
					+ (this.menuItems[i].IDChild != "" && this.mode=="C" ? ' onclick="ShowThisLayer(\'' + this.menuItems[i].Name + '\');"' : ' ' )
					+ ' class="menustd">'
					+ '<img name="' + this.menuItems[i].Name + '" src="' + this.menuItems[i].Img_Std.src
					+ '" border=0 title="' + this.menuItems[i].Alt_txt + '">'
					+ '</a></div> ';
			} else {
				// Gestion du texte
				str += '<div id="' + this.menuItems[i].Name + '" class="' + this.menuItems[i].Img_Std + '"' + ' style="' + theStyleInt + '"'
					+ ' onmouseover="LastOver=CurrentOver;CurrentOver=\'' + this.Name + '\';' + (this.mode=="S" ? 'ShowThisLayer(\'' + this.menuItems[i].Name + '\');' : '' )
					+ 'this.style.cursor=(IE4||IE5)?\'hand\':\'default\';SwapClass(\'' + this.menuItems[i].Name + '\', 1);return true;"' 
					+ ' onclick="' + (this.mode=="C" && this.menuItems[i].Link=="" ? 'ShowThisLayer(\'' + this.menuItems[i].Name + '\');' : '') + 'GoToLink(\'' + escape(this.menuItems[i].Link) + '\');"'
					+ ' onmouseout="SwapClass(\'' + this.menuItems[i].Name + '\', 0);">' 
					+ this.menuItems[i].Title + theArw
					+ '</div>\n';
			}
			//if (this.dispo == "H" && typeof this.menuItems[i].Img_Std != "object") { str += '<td width=10></td>\n'; }
			//if (this.dispo == "V") { str += '</tr>\n' }
		} else { // HJ 070823 - Cas MapOnly=1 !
			str += '<div id="' + this.menuItems[i].Name + '" style="display:none;"></div>\n'
		}

		// Ajout propriete ID
		this.menuItems[i].IDU=this.ID*100+i; // ID unique
		this.menuItems[i].ID=i; // ID pour travail sur collection
		this.menuItems[i].IDParent=this.ID; // ???? Inutile, == addIDMB(this.ID)
		theMenus.addIDMB(this.ID);
		theMenus.addIDMI(this.menuItems[i].ID);
		theMenus.addNames(this.menuItems[i].Name);
	}
	//if (this.dispo == "H") { str += '</tr>\n'; }
	//str += ' </table>\n';
    str += '</div>\n';
    //+ 'width: ' + this.width + 'px; height: ' + this.height + 'px;'
    if (NS6) {
	    //document.write(str);
		var r = document.body.ownerDocument.createRange();
	    r.setStartBefore(document.body);
	    htmlFrag=r.createContextualFragment(str);
	    document.body.appendChild(htmlFrag);
	} else {
        document.body.insertAdjacentHTML("beforeEnd", str);
	}
	this.baseLayer = getLayer(this.Name);
	this.created = true;
	moveLayerTo(this.baseLayer,this.x,this.y); // Absolu ou relatif au parent !	
	setzIndex(this.baseLayer, 10);
	// Mettre a la bonne taille
	/*if (isMinIE4) {
		this.baseLayer.style.pixelWidth=this.width;
		this.baseLayer.style.pixelHeight=this.height; }
	if (NS6) {
		this.baseLayer.style.width=this.width;
		this.baseLayer.style.height=this.height; }*/

	// Couleur ou image de fond
	/*if (this.BgColor != "") { setBgColor(this.baseLayer,this.BgColor); }
	if (typeof this.Background == 'object') {  setBgImage(this.baseLayer,this.Background.src); }*/

}

function MenuBarHide() {
	var theBox, arrBox;
	if (this.created) {
		hideLayer(this.baseLayer);
		this.hideSelBoxes(0,0,0,0);
	}
}

function MenuBarShow() {
	var theBox, arrBox;
	if (this.created) {
		showLayer(this.baseLayer);
		theBox=getBox(this); // HJ 060501
		arrBox = theBox.split(";");
		this.hideSelBoxes(arrBox[1],arrBox[0],arrBox[3],arrBox[2]);
	}
}

function getBox(theMBobj) {
	var x0,y0,xM,yM;
	var xtmp,ytmp,wtmp,htmp;
	var box,mi;
	x0=0;y0=0;xM=0;yM=0;
	
	theMBP=theMenus.findMenuPath(theMBobj,theMBobj.menuItems[0],'');
	for (mi = 0; mi < theMBP.length-1; mi++) {
		tmpMB=theMBP[mi];
		tmpArr = tmpMB.split(";");
		theMB=theMenus.menuBars[tmpArr[0]];
		xtmp=getElementLeft(theMB.Name);
		if (xtmp<x0 || x0==0) { x0=xtmp }
		ytmp=getElementTop(theMB.Name);
		if (ytmp<y0 || y0==0) { y0=ytmp }
		wtmp=getElementWidth(theMB.Name);
		if ((wtmp+xtmp)>xM || xM==0) { xM=wtmp+xtmp }
		htmp=getElementHeight(theMB.Name);
		if ((htmp+ytmp)>yM || yM==0) { yM=htmp+ytmp }
	}

	box=""+x0+";"+y0+";"+(xM-x0)+";"+(yM-y0);
//DBugPrint(box,false); // Necessite biblio debug_lib.js

  	return box;
}

function MenuBarHideSelectBoxes(t,l,h,w) { // HJ 060419
	var selx,sely,selw,selh,i;
	if (IE5 && !OP5 && !OP6 && !IE7) { // Que pour IE5 et IE6 (pas IE7)
		if(!this.sel){
			this.sel=document.getElementsByTagName("SELECT");
			this.sel.level=0;
		}
		var sel=this.sel;
		for(i=0;i<sel.length;i++) {
			var selp;
			selx=0; sely=0;
			if(sel[i].offsetParent) {
				selp=sel[i];
				while(selp.offsetParent) {
					selp=selp.offsetParent;
					selx+=selp.offsetLeft;
					sely+=selp.offsetTop;
				}
			}
			selx+=sel[i].offsetLeft;
			sely+=sel[i].offsetTop;
			selw=sel[i].offsetWidth;
			selh=sel[i].offsetHeight;
			if(selx+selw>l && selx<l+w && sely+selh>t && sely<t+h) { 
				if(sel[i].style.visibility!="hidden") {
					//sel[i].level=l;
					sel[i].style.visibility="hidden";
					//if(pm){ if(!pm.mout) pm.mout=""; pm.mout+=this.name+".sel["+i+"].style.visibility='visible';"}
				}
			} else {
				sel[i].style.visibility="visible" // if(l<=sel[i].level && !(pm&&l==0))
			}
		}
	}
}

// ********** Fin methodes de MenuBar


function ShowThisLayer(theMenuItemName) {
// Affiche le(s) calque(s) conduisant au menuItem en survol et efface les autres
	var thePath = new String();
	isSubMenu=true;
	
	theMenuItem=theMenus.getMenuItem(theMenuItemName);

	if (theMenuItem!=null) {
		theChild=theMenuItem.IDChild;
	} else {
		theChild='';
	}
	
	if (theChild == '' || (typeof theChild == 'undefined')) { theChild=CurrentOver;isSubMenu=false; }

	theMenuBar=theMenus.getMenuBar(theChild);
	
	thePath="";
	if (theMenuBar != 0) {
		theMenuBarPath=theMenus.findMenuPath(theMenuBar,theMenuBar.menuItems[0],'');
		for (i = 0; i < theMenuBarPath.length; i++) {
			tmp2=theMenuBarPath[i]
			arr2 = tmp2.split(";");
			thePath=thePath + " " + arr2[0];
		}
	}

	for (i = 0; i < theMenus.menuBars.length; i++) {
		if (theMenus.menuBars[i].State != 3 && thePath.indexOf(theMenus.menuBars[i].ID) < 0) {
			// On efface si l'ID de la menubar n'est pas dans thePath
			theMenus.menuBars[i].hide();
		}
	}

	// Mise en highlight des elements sur le chemin
	if (displayActiveItems && (theMenuBar != 0)) {
		theMenuBarTmp=CurrentOver;
		for (i = 1; i < theMenuBarPath.length; i++) {
			tmp2=theMenuBarPath[i]
			arr2 = tmp2.split(";");
			for (j = 0; j < theMenus.menuBars[arr2[0]].menuItems.length; j++) {
				if (theMenus.menuBars[arr2[0]].menuItems[j].IDChild==theMenuBarTmp ) {
					// On active si IDChild = menubar en cours
					SwapItem(theMenus.menuBars[arr2[0]].menuItems[j], 1);
				} else {
					SwapItem(theMenus.menuBars[arr2[0]].menuItems[j], 0);
				}
			}
			theMenuBarTmp=theMenus.menuBars[arr2[0]].Name;
		}
	}
	
	// Remise en aspect std des menuitems sur sortie d'un sous-menu
	if ((typeof theMenuItemName=='undefined') && (typeof theMenuBarPath!='undefined')) {
		for (i = 0; i < theMenuBarPath.length; i++) {
			tmpM=theMenuBarPath[i];
			arrM = tmpM.split(";");
			SwapItem(theMenus.menuBars[arrM[0]].menuItems[arrM[1]], 0);
		}
	}
	
	// Deplacer le calque / parent
	if (isSubMenu) { //theMenuBar != 0
		if (theMenuBar.AlignY!="F" && theMenuBar.AlignX!= 'undefined') {
			theParentLayer=getLayer(CurrentOver); //getLayer(theParent.Name);
			if (theParentLayer!=null) {
				theParentMenuBar=theMenus.getMenuBar(CurrentOver);
				// Si navigateur <> IE -> activation capture souris
				if (!IE5&&!IE4) document.captureEvents(Event.MOUSEMOVE)
				// Lance fonction getMouseXY sur onMouseMove
				document.onmousemove = getMouseXY;
				/*	// Si vertical et souris
					newx=parseInt(theParentLayer.style.left)+parseInt(theParentLayer.style.width);//theParent.width;
					newy=tempY; //parseInt(theParentLayer.style.top)+   theParent.y +eval(scrolledY) +theParent.h; + scroll + position souris */
				if (theParentMenuBar.dispo=="H") {
					if (theMenuBar.x<0) {
						newx = getElementLeft(theMenuItem.Name);
					} else {
						newx=theMenuBar.x;
					}
					if (theMenuBar.y<0) {
						if(OpenMode==1){ // 0: mode normal, en bas ou a droite; 1: inverse (ex: en haut au lieu d'en bas)
							newy = getElementTop(theMenuItem.Name) - getElementHeight(theMenuBar.Name); // Pour ouvrir vers le haut :
						}else{
							newy = getElementTop(theMenuItem.Name) + getElementHeight(theMenuItem.Name);
						}
					} else {
						newy=theMenuBar.y;
					}
				} else {
					if (theMenuBar.x<0) {
						newx = getElementLeft(theMenuItem.Name) + getElementWidth(theMenuItem.Name); //-borderModSize;
					} else {
						newx=theMenuBar.x;
					}
					if (theMenuBar.y<0) {
						newy = getElementTop(theMenuItem.Name);
					} else {
						newy=theMenuBar.y;
					}
				}
				// [AF] Ne bouger que si x et/ou y <0 ?
				moveLayerTo(getLayer(theChild),newx,newy);
			}
			if (theMenuBar != 0) { theMenuBar.show(); }
		}
	}
}


function getMouseXY(e) {
// Renvoie la position de la souris
  if (isMinIE4) { // si IE
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
  } else {  // si NS
    tempX = e.pageX
    tempY = e.pageY
  }  
  // Interdiction < 0 pour NS4
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  
  return true
}


function TimeoutErase(theLayer) {
	CurrentOver=null;
	if (CloseTimer) clearTimeout(CloseTimer);
	CloseTimer=setTimeout('TimeoutEraseAll()',EraseDelay)
}

function TimeoutEraseAll() {
	if (CurrentOver==null) { ShowThisLayer(); }
}


//*****************************************************************************
// Objet MenuItem (Un item de menu = une image)
//*****************************************************************************

function MenuItem(Name,ChildName,Link,Img_Std,Img_Over,Img_Off,Img_On,Title,Alt_txt,MapOnly) {

  this.IDU = 0;
  this.ID = 0;
  this.IDParent = 0;
  this.Name = Name;
  this.Child = ChildName;
  this.IDChild = ChildName; // Reporter la valeur de l'ID unique
  this.Link = Link;

  // HJ 05/08/02 : style ou image ?
  this.Img_Std  = ((Img_Std.indexOf(".gif") > -1 || Img_Std.indexOf(".jpg") > -1 || Img_Std.indexOf(".png") > -1) ? ImageNew(pictPath + Img_Std) : Img_Std);
  this.Img_Over = ((Img_Over.indexOf(".gif") > -1 || Img_Over.indexOf(".jpg") > -1 || Img_Over.indexOf(".png") > -1) ? ImageNew(pictPath + Img_Over) : (Img_Over == "") ? this.Img_Std : Img_Over);
  this.Img_Off  = ((Img_Off.indexOf(".gif") > -1 || Img_Off.indexOf(".jpg") > -1 || Img_Off.indexOf(".png") > -1) ? ImageNew(pictPath + Img_Off) : Img_Off );
  this.Img_On = ((Img_On.indexOf(".gif") > -1 || Img_On.indexOf(".jpg") > -1 || Img_On.indexOf(".png") > -1) ? ImageNew(pictPath + Img_On) : Img_On );
  this.State = 0; // 0 = Img_Std + survol on; 1 = Img_On + survol on; 3 = Img_Off + survol off;

  this.Title = Title; // Pour afficher l'endroit ou l'on est. Ex : Accueil -> Produits -> Pompes
  this.Alt_txt = Alt_txt;
  this.MapOnly = MapOnly; // 1 = que dans SiteMap et chemin (pas menus), 2 = que dans menus et chemin (pas SiteMap)

  this.created = false;

  // Define methods.
  this.addMenu     = MenuItemAddMenu;

  // Add to the list.
  this.index = MenuItem.length;
  MenuItem[this.index] = this;
  MenuItem[this.Name] = this;
}

//*****************************************************************************
// Methodes de MenuItem
//*****************************************************************************

function MenuItemAddMenu(menu) {
  if (!this.created)
    this.menuItems[this.menuItems.length] = menu;
}


function bulletPoint(onURL, offURL, css) {
	this.onImage = new Image();
	this.onImage.src = homePath + onURL;
	this.offImage = new Image();
	this.offImage.src = homePath + offURL;
	this.URL = String(offURL);
	this.CSS = css;
}


//*****************************************************************************
// Fonctions generales
//*****************************************************************************

function initMenus() {
// 	Dummy();

	theMenus.setParents();
	
	for (i = 0; i < theMenus.menuBars.length; i++) {
		theMenus.menuBars[i].ID=i; // ID unique pour chaque barre		
		theMenus.menuBars[i].create();
	}

	if (typeof MenusOn != 'undefined') { // HJ 060504
		if (MenusOn.length==0) {
			theMO=getPageMenu();
			if (theMO!=null) { MenusOn=Array(theMO.Name); } else { MenusOn=Array(); }
		}
	} else {
		theMO=getPageMenu();
		if (theMO!=null) { MenusOn=Array(theMO.Name); } else { MenusOn=Array(); }
	}

	for (k = 0; k < MenusOn.length; k++) {
		tmp = theMenus.getMenuItemID(MenusOn[k]);
		arr = tmp.split(";");
		theMenuBar=theMenus.menuBars[arr[0]]; // Recherche la MenuBar contenant le MenuItem theMenu
		theActivePath=theMenus.findMenuPath(theMenuBar,theMenuBar.menuItems[arr[1]],'');
		// Afficher toutes les barres du chemin ou activer tous les boutons
		for (j = 0; j < theActivePath.length; j++) {
			tmp2=theActivePath[j]
			arr2 = tmp2.split(";");
			theMenuBar=theMenus.menuBars[arr2[0]];
			//Change l'image des menus actifs
			if (theMenuBar.x != -1) { // HJ 060306
				SwapItem(theMenuBar.menuItems[arr2[1]], 1);
			}
			theMenuBar.menuItems[arr2[1]].State=1;
			if (displayActiveMenus) {
				if (theMenuBar.State != 2) {
					theMenuBar.show();
				}
			}
			if (j == 0) {
				if (theMenuBar.menuItems[arr2[1]].Title != "Accueil") {
					pathTemp="<b>"+theMenuBar.menuItems[arr2[1]].Title+"</b>" + pathTemp; // Page en cours = en gras (ou CSS ?)  - HJ 060607
				}
			} else {
				if (theMenuBar.menuItems[arr2[1]].Link != "") {
					pathTemp="<a href='" + homePath + theMenuBar.menuItems[arr2[1]].Link + "'>" + theMenuBar.menuItems[arr2[1]].Title + "</a>" + ActivePathSeparator + pathTemp;
				} else {
					pathTemp=theMenuBar.menuItems[arr2[1]].Title + ActivePathSeparator + pathTemp;
				}
			}
			lastLink=theMenuBar.menuItems[arr2[1]].Link;
		}

		if ((homePath != "" || (lastLink.indexOf(HomePage) != 0 ))) {
			pathTemp="<a href='" + homePath + HomePage + "'>Accueil</a>" + ActivePathSeparator + pathTemp;
		}
		
		// Insˇrer dans page : <div id="Path"></div>
		if (displayActivePath) {
			strPath = "";
			// Utiliser CreateLayer(id,style,content,w,c,app) dans dhtml_lib.js :
			strPath += '<div id="Path_temp" style="position:absolute;width:800px;height:10px;" class="' + ActivePathCSS + '">\n';
			strPath += pathTemp;
			strPath += '</div>\n';
			strPath = '<div id="Path"'
				+ ' style="position:absolute;left:0px;top:0px;width:800px;height:10px;'
				+ '">\n'
				+ strPath
				+ '</div>\n';
			if (NS6) {
				var r = document.body.ownerDocument.createRange();
				r.setStartBefore(document.body);
				htmlFrag=r.createContextualFragment(strPath);
				document.body.appendChild(htmlFrag);
			} else {
				document.body.insertAdjacentHTML("beforeEnd", strPath); }
			pathLayer = getLayer("Path");
			moveLayerTo(pathLayer,ActivePathX,ActivePathY);
			setzIndex(pathLayer, 200);
		} 
	}
	if (MoveOnScroll) {
//theMainMenu=theMenus.menuBars[0]; // Prendre tous les menus racine
		initScroll();
	}
}

function ImageNew(pictSrc) {
// Preload images
	if (document.images) {
		thePict = new Image();
		thePict.src = pictSrc;
		return thePict;
	}
}


function SwapItem(theItem, theAction) { // [HJ 09/09/03]
// theAction : 1:over , 0:out
// theItem   : Objet MenuItem
	if (theAction==1 || theItem.State==1) { // onmouseover
		if (typeof theItem.Img_Std == "object") {
			SwapImage(theItem.Name, 1);
		} else {
			theItemObj=(NS6||IE5)?window.document.getElementById(theItem.Name):window.document.all[theItem.Name];
			theItemObj.className=theItem.Img_Over;
		}
	} else { // onmouseout
		if (typeof theItem.Img_Std == "object") {
			SwapImage(theItem.Name, 0);
		} else {
			theItemObj=(NS6||IE5)?window.document.getElementById(theItem.Name):window.document.all[theItem.Name];
			if (typeof theItemObj!='undefined') {
				theItemObj.className=theItem.Img_Std;
			}
		}
	}
}

function SwapClass(theItemName, theAction) { // [HJ 01/05/06]
	theMenuItem=theMenus.getMenuItem(theItemName);
	SwapItem(theMenuItem, theAction);
}

function SwapImage(theImgName,theAction) {
// theAction  : 0 (passer etat init), 1 (etat survol), 2 (forcer off), 3 (forcer on)
	var theMenuItem;
	
	tmpMn = theMenus.getMenuItemID(theImgName);
	arrMn = tmpMn.split(";");
	theMenuItem=theMenus.menuBars[arrMn[0]].menuItems[arrMn[1]]; // Recherche la MenuBar contenant le MenuItem theMenu

	if (typeof theMenuItem == "object") {
		if (isMinIE4) { // HJ 03/04/02
			theNewSrc=document.images[theImgName].src;
		} else {
			if (NS6) {
				theNewSrc=document[theImgName].src;
			} else {
				theNewSrc=CSFindElement(theImgName,0).src;
			}
		}
		
		if (theAction == 0) {
			if (theMenuItem.State==0) {
				theNewSrc=theMenuItem.Img_Std.src;
			}
		} else {
			if (theAction == 1) {
				if (theMenuItem.State==0) { theNewSrc=theMenuItem.Img_Over.src; }
			} else {
				if (theAction == 2) {
					if (theMenuItem.State==0) { theNewSrc=theMenuItem.Img_Off.src; }
				} else {
					if (theAction == 3) {
						if (theMenuItem.State==0) { theNewSrc=theMenuItem.Img_On.src; }
					} else {
					}
				}
			}
		}
		if (document.images) {
			if (isMinIE4) {
				document.images[theImgName].src = theNewSrc;
			} else {
				if (NS6) {
					document[theImgName].src = theNewSrc;
				} else {
					CSFindElement(theImgName,0).src = theNewSrc;
				}
			}
		}
	} else {
		alert(theMenuItem);
	}
}


function getPageMenu() { // HJ 060502
// Renvoie le nom (ou l'ID) du menu correspondant a la page en cours selon son URL
	var i,j,doc,doc2,url,menuObj;
	var fullURL,menuURL;
	doc=document.location.href.split("?");
	curURL=doc[0]; // Param¸tres : doc[1]
	FoundMenu = false;
	i=0;
	menuObj=null;
	// Recherche avec adresse complete
	while (FoundMenu == false && i < theMenus.menuBars.length) {
		j=0;
		while (FoundMenu == false && j < theMenus.menuBars[i].menuItems.length) {
			fullURL=document.location.href+";"; // HJ 060705
			menuURL=theMenus.menuBars[i].menuItems[j].Link+";";
			if (fullURL.indexOf(menuURL,0)>0 && menuURL.length>1) { // HJ 070509
				FoundMenu=true;
				menuObj=theMenus.menuBars[i].menuItems[j];
			}
			j++
		}
		i++
	}
	// Si pas trouve, recherche avec adresse sans params [HJ 18/05/06]
	if (!FoundMenu) {
		while (FoundMenu == false && i < theMenus.menuBars.length) {
			j=0;
			while (FoundMenu == false && j < theMenus.menuBars[i].menuItems.length) {
				doc2=theMenus.menuBars[i].menuItems[j].Link.split("?");
				url=doc2[0];
				if (curURL.indexOf(url,0)>0) {
					FoundMenu=true;
					menuObj=theMenus.menuBars[i].menuItems[j];
				}
				j++
			}
			i++
		}
	}
	return menuObj;
}


function GoToLink(theLink) {
	// HJ 26/11/03
	// Test type lien : relatif, absolu, http://, mailto:, javascript: ...
	theLink=unescape(theLink);
	theLinkTest=theLink.toLowerCase();
	if (self.innerWidth) {
		frameWidth = self.innerWidth;
		frameHeight = self.innerHeight;
	} else {
		if (document.body) {
			frameWidth = document.body.clientWidth;
			frameHeight = document.body.clientHeight;
		} else {
			frameWidth = 640;
			frameHeight = 480;
		}
	}
	theWinParams="width=" + frameWidth + ",height=" + frameHeight;
	theWinParams+=",resizable=yes,scrollbars=yes,menubar=yes,toolbar=yes,directories=yes,location=yes,status=yes";
	
	if (theLink!="") {
		if (theLinkTest.indexOf('javascript:')!=-1) {
			//alert("JS : " + theLink);
			eval(theLink);
		} else {
			if (theLinkTest.substr(0,7) == "http://") {
				theWindow=window.open(theLink, "NewWin", theWinParams);
				theWindow.focus();
			} else {
				if (theLinkTest.indexOf('.pdf')!=-1 || theLinkTest.indexOf('.gif')!=-1 || theLinkTest.indexOf('.jpg')!=-1 || theLinkTest.indexOf('.png')!=-1) {
					theWindow=window.open(homePath + theLink, "NewWin", theWinParams);
					theWindow.focus();
				} else {
					if (theLink.substr(0,1) == "/" || theLinkTest.substr(0,7) == "mailto:") {
						//alert("mailto ou / : " + theLink);
						window.location.href=theLink;
					} else {
						window.location.href=homePath + theLink;
					}
				}
			}
		}
	} else {
		//return false;
	}
}

//*****************************************************************************
// Fonctions de scroll - [HJ 13/03/05]
//*****************************************************************************
scrolledY=isMinNS4||NS6?"window.pageYOffset":"document.body.scrollTop"
scrolledX=isMinNS4||NS6?"window.pageXOffset":"document.body.scrollLeft"

function getPosX(theMenuBarObj) {
	if (document.body) { frameWidth = document.body.clientWidth; }
	else if (self.innerWidth) { frameWidth = self.innerWidth; }
	else return;
	
	alignX=theMenuBarObj.AlignX;
	theWidth=theMenuBarObj.width;
	deltaX=theMenuBarObj.x;
	x=deltaX;
	if (alignX.substr(1,1)=="S") {
		switch (alignX.substr(0,1)) {
			case "C" :
				x=(frameWidth-theWidth)/2+deltaX;
				if (x<0) { x=0; }
				break;
			case "R" :
				x=frameWidth-theWidth-deltaX;
				break;
			default :
				x=deltaX
		}
	}	
	return x;
}

function getPosY(theMenuBarObj) {
	if (self.innerWidth) { frameHeight = self.innerHeight; }
	else if (document.body) { frameHeight = document.body.clientHeight; }
	else return;

	alignY=theMenuBarObj.AlignY;
	theHeight=theMenuBarObj.h;
	deltaY=theMenuBarObj.y;
	y=deltaY;

	if (alignY.substr(1,1)=="S") {
		switch (alignY.substr(0,1)) {
			case "M" :
				y=(frameHeight-theHeight-deltaY)/2;
				if (y<0) { y=0; }
				break;
			case "B" :
				y=frameHeight-theHeight-deltaY;
				break;
			default :
				y=deltaY
		}
	}
	return y;
}

function initScroll(){
	for (i = 0; i < theMenus.menuBars.length; i++) {
		if (theMenus.menuBars[i].Parent=="") { // Que top levels
			themenuBar=theMenus.menuBars[i];
			theLayer=getLayer(themenuBar.Name);
		
			x=getPosX(themenuBar);
			y=getPosY(themenuBar);
			
			if (MoveAnim) {
				moveLayerTo(theLayer,x,y);
				//scrollLayerTo(theLayer, x, y, 1) 
			} else {
				moveLayerTo(theLayer,x,y);
			}
		}
	}
	if (MoveOnScroll) isMinNS4||NS6?checkScrolled():window.onscroll=checkScrolled;
	if (MoveOnScroll) window.onresize=checkScrolled;
}

function checkScrolled(){
	for (i = 0; i < theMenus.menuBars.length; i++) {
		if (theMenus.menuBars[i].Parent=="") { // Que top levels
			themenuBar=theMenus.menuBars[i];
			theLayer=getLayer(themenuBar.Name);
		
			x=getPosX(themenuBar);
			y=getPosY(themenuBar);
			
			if (themenuBar.AlignX.substr(1,1)=="S") {
				dx=eval(scrolledX);
				x=x+dx;
			}
		
			if (themenuBar.AlignY.substr(1,1)=="S") {
				dy=eval(scrolledY);
				y=y+dy;
			}
			if (MoveAnim) {
				moveLayerTo(theLayer,x,y);
				//scrollLayerTo(theLayer, x, y, 1) 
			} else {
				moveLayerTo(theLayer,x,y);
			}
		}
	}
	if(isMinNS4||NS6) setTimeout('checkScrolled()',40)
}


//*****************************************************************************
// Methode Golive
//*****************************************************************************

function CSFindElement(NomObj,ly) {
	if (NavVers < 4) return document[NomObj];
	var curDoc = ly ? ly.document : document;
	var elem = curDoc[NomObj];
	if (!elem) {
		if (NS6) {
			//elem = CSFindElement(NomObj,curDoc.getElementById[i]); if (elem) return elem;
		} else {
			for (var i=0;i<curDoc.layers.length;i++) {
				elem = CSFindElement(NomObj,curDoc.layers[i]); if (elem) return elem;
			}
		}
	}
	return elem;
}

