//************************************************************************************************
//* version 1.O 12/08/03
//************************************************************************************************
//** création d'un tableau pour chaque menu pour sauver le nom du bouton qui déclenche le menu
//** la classe a utiliser pour le survol,  la classe au repos, la classe lorsqu'un doc du menu
//** est séléctionné et la classe à utiliser pour remettre le bouton dans son etat avant passage de la souris
 NbMenu = 1;
 D_button =0; 		// indice dans tableau => nom du bouton
 D_classOver=1; 	// indice dans tableau => classe à utiliser lorsque le bouton est survolé ou menu affiché
 D_classNormal=2; 	// indice dans tableau => classe à utiliser lorsque le bouton est inactif
 D_classSelected=3; // indice dans tableau => classe à utiliser lorsque selectionne une entree du menu
 D_svgClass=4; 		// indice dans tableau => classe à utiliser pour remettre le bouton dans son etat avant passage de la souris


 while(eval("window.arMenu" + NbMenu)) {
		eval("elMenu" + NbMenu + 'Dynam=new Array("", "","", "", "");')
		NbMenu++
}


loader = (isFrames) ? (NS4) ? parent : parent.document.body : window;
loader.onload = startIt;
if(NS4){
	origWidth = loader.innerWidth;
	origHeight = loader.innerHeight;
	loader.onresize = reDo;
}
isLoaded = false;
NSresized = false;

if (!window.menuVersion) {
	clickKill = keepHilite = clickStart = false;
}

if (!window.imgHspace) imgHspace=0;

isWin = (navigator.appVersion.indexOf("Win") != -1)

mSecsVis = secondsVisible*1000;
isRight = (window.navFrLoc && navFrLoc == "right");
fullImgSize = (imgSiz+(imgHspace*2));
if(!IE5) {
	 imgSuf = (isRight) ? ">"  : " ALIGN=RIGHT>";
	 imgStr = "<IMG SRC='" + imgSrc + "' WIDTH=" + imgSiz + " HEIGHT=" + imgSiz +" VSPACE=2 HSPACE="+ imgHspace +" BORDER=0"+ imgSuf;
	 if(NS7) imgStr = "<IMG SRC='" + imgSrc + "' WIDTH=" + imgSiz + " HEIGHT=" + imgSiz +" HSPACE="+ imgHspace +" BORDER=0"+ ">";
	 if(IE4) imgStr = "<SPAN STYLE='height:100%;width:"+ (fullImgSize-(isRight?3:0)) +";float:"+ (isRight?"left":"right") +";overflow:hidden'>"+ imgStr +"</SPAN>";
}

areCreated = false;
menuLoc = null;

function initVars() {
	if(areCreated) {
		for(i=1; i<topCount; i++) {
			cur = eval("elMenu"+i);
			clearTimeout(cur.hideTimer);
			cur.hideTimer=null;
		}
		clearTimeout(allTimer);
	}
	topCount = 1;
	areCreated = false;
	beingCreated = false;
	isOverMenu = false;
	currentMenu = null;
	allTimer = null;
}

initVars();

function NSunloaded(){
	isLoaded = false;
}

function NSloaded(e){
	if (e.target.name == mainFrName) {
		initVars();
		startIt();
	}
}

function IEunloaded() {
	initVars();
	isLoaded = false;
	setTimeout("keepTrack()",50)
}

function keepTrack() {
	if (menuLoc.document.readyState == "complete") {
		initVars();
		startIt();
	}
	else {
		setTimeout("keepTrack()",50);
	}
}

function startIt() { 
	isLoaded = true;
	if (isFrames) {
		if (NS7) {menuLoc = document.getElementById("parent.frames." + mainFrName);}
		else { menuLoc = eval("parent.frames." + mainFrName);}
		
		
		if (NS4) {
			loader.captureEvents(Event.LOAD);
			loader.onload = NSloaded;
			menuLoc.onunload = NSunloaded;
		}
		if (IE4) {
			menuLoc.document.body.onunload = IEunloaded;
		}
	}
	else {
		menuLoc = window;
	}
	menuLoc.nav = nav = window;
	if (clickKill) {
		if (NS4) menuLoc.document.captureEvents(Event.MOUSEDOWN);
		menuLoc.document.onmousedown = clicked;
	}
	makeTop();   
}

function makeTop(){topZ = 0;
	beingCreated = true;
	if(IE4) {
		topZ = 0;
		for (z=0;z<menuLoc.document.all.length;z++){
			oldEl = menuLoc.document.all(z);
			topZ = Math.max(oldEl.style.zIndex,topZ)
		}
	}
	while(eval("window.arMenu" + topCount)) {
		(NS4 ) ? makeMenuNS(false,topCount) : makeMenuIE(false,topCount);
		topCount++
	}

	status = (topCount-1) + " Hierarchical Menu Trees Created"
	areCreated = true;
	beingCreated = false;
}

function makeMenuNS(isChild,menuCount,parMenu,parItem) {
	tempArray = eval("arMenu" + menuCount);

	if (!isChild) {
		tempWidth = tempArray[0] ? tempArray[0] : menuWidth;
		menu = makeElement("elMenu" + menuCount,tempWidth,null,null);
			
	}
	else {
		menu = makeElement("elMenu" + menuCount,null,parMenu,null);
	}

	menu.array = tempArray;
	menu.setMenuTree = setMenuTree;
	menu.setMenuTree(isChild,parMenu);
	while (menu.itemCount < menu.maxItems) {
		menu.itemCount++;
		status = "Creating Hierarchical Menus: " + menuCount + " / " + menu.itemCount;
		prevItem = (menu.itemCount > 1) ? menu.item : null;
		itemName = "item" + menuCount + "_" + menu.itemCount;
		menu.item = makeElement(itemName,null,null,menu);
		menu.item.prevItem = prevItem;
		menu.item.setup = itemSetup;
		menu.item.setup(menu.itemCount,menu.array);
		if (menu.item.hasMore) {
			makeMenuNS(true,menuCount + "_" + menu.itemCount,menu,menu.item);
			menu = menu.parentMenu;
		}
	}
	menu.lastItem = menu.item;

	menu.setup(isChild,parMenu,parItem);

}

function findTree(men){
	foundTree = false;
	for(i=11;i<men.array.length;i+=3){
		if(men.array[i]) {
			foundTree = true;
			break;
		}
	}
	
	return foundTree;
}

function setMenuTree(isChild,parMenu) {
	if (!isChild) {
		this.menuWidth = this.array[0] ? this.array[0] : menuWidth;
		this.menuLeft = this.array[1];
		this.menuTop = this.array[2];
		this.menuFontColor = this.array[3] ? this.array[3] : fntCol;
		this.menuFontOver = this.array[4] ? this.array[4] : overFnt;
		this.menuBGColor = this.array[5] ? this.array[5] : backCol;
		this.menuBGOver = this.array[6] ? this.array[6] : overCol;
		this.menuBorCol = this.array[7] ? this.array[7] : borCol;
		this.menuSeparatorCol = this.array[8] ? this.array[8] : separatorCol;
		this.treeParent = this;
		this.startChild = this;
		this.isTree = findTree(this);
	}
	else {
		this.menuWidth = parMenu.menuWidth;
		this.menuLeft = parMenu.menuLeft;
		this.menuTop = parMenu.menuTop;
		this.menuFontColor = parMenu.menuFontColor;
		this.menuFontOver = parMenu.menuFontOver;
		this.menuBGColor = parMenu.menuBGColor;
		this.menuBGOver = parMenu.menuBGOver;
		this.menuBorCol = parMenu.menuBorCol;
		this.menuSeparatorCol = parMenu.menuSeparatorCol;
		this.treeParent = parMenu.treeParent;
		this.isTree = parMenu.isTree;
	}

	this.maxItems = (isChild) ? this.array.length/3 : (this.array.length-9)/3;
	this.hasParent = isChild;
	this.setup = menuSetup;
	this.itemCount = 0;
}

function makeMenuIE(isChild,menuCount,parMenu) {
	menu = makeElement("elMenu" + menuCount);
	menu.array = eval("arMenu" + menuCount);
	menu.setMenuTree = setMenuTree;
	menu.setMenuTree(isChild,parMenu);
	menu.itemStr = "";
	
	while (menu.itemCount < menu.maxItems) {
		menu.itemCount++;
		status = "Creating Hierarchical Menus: " + menuCount + " / " + menu.itemCount;
		itemName = "item" + menuCount + "_" + menu.itemCount;
		arrayPointer = (isChild) ? (menu.itemCount-1)*3 :((menu.itemCount-1)*3)+9;
		dispText = menu.array[arrayPointer];
		hasMore = menu.array[arrayPointer + 2];
		if(IE5) {
			newSpan = menuLoc.document.createElement("SPAN");
			with(newSpan) {
				id = itemName;
				with(style) {
					width = (menu.menuWidth-(borWid*2));
					fontSize = fntSiz + "pt";
					fontWeight = (fntBold) ? "bold" : "normal";
					fontStyle = (fntItal) ? "italic" : "normal";
					fontFamily = fntFam;
					borderBottomWidth = separator + "px";
					borderBottomStyle = "solid";
					paddingLeft=itemPadH;
					paddingTop=itemPadV;					
					paddingBottom=itemPadV;					
//3.10.3 added conditional:
					if(menu.isTree)	{
						if (isRight) paddingLeft = itemPadH+fullImgSize;
						//else paddingRight = itemPadH+fullImgSize;
					}
				}
				innerHTML = dispText;
			}
			newBreak = menuLoc.document.createElement("BR");
			menu.appendChild(newSpan);
			menu.appendChild(newBreak);
			if(hasMore) {
				newImage = menuLoc.document.createElement("IMAGE");
				with(newImage){
					src = imgSrc;
					with(style) {
						position = "absolute";
						width = imgSiz;
						height = imgSiz;
						left = (isRight) ? itemPadH : (newSpan.style.pixelWidth - itemPadH - imgSiz);
						top = newSpan.offsetTop + itemPadV + (isMac ? 0 : 2);
					}
				}
				newSpan.appendChild(newImage);
			}

		}
		else {
			htmStr = (hasMore) ? dispText + imgStr : dispText;
			if (NS7) {
				menu.itemStr += "<SPAN ID=" + itemName + " STYLE=\"width:" + (menu.menuWidth-(borWid*2)) + ";\"><IMG SRC='" + imgHeight + "' WIDTH=1 HEIGHT='" + lineHeight + "px'>" + htmStr + "</SPAN><BR>"; 
			} else {
				menu.itemStr += "<SPAN ID=" + itemName + " STYLE=\"width:" + (menu.menuWidth-(borWid*2)) + ";\">" + htmStr + "</SPAN><BR>";
			}
		}
		if (hasMore) {
			makeMenuIE(true,menuCount + "_" + menu.itemCount,menu);
			menu = menu.parentMenu;
		}
	}

	if(!IE5) menu.innerHTML = menu.itemStr;
	
	if (NS7) { itemColl = menu.childNodes;
			i = 0;
			for (x=0; x<itemColl.length; x++) {
				if (itemColl.item(x).tagName == "SPAN") {
					it = itemColl.item(x);
					it.setup = itemSetup;
					it.setup(i+1,menu.array);
					i++;
				}
			}
		menu.lastItem = itemColl.item(itemColl.length-1);
	}
	else {itemColl = menu.children.tags("SPAN");
		for (i=0; i<itemColl.length; i++) {
			it = itemColl(i);
			it.setup = itemSetup;
			it.setup(i+1,menu.array);
		}
		menu.lastItem = itemColl(itemColl.length-1);

	}
	menu.setup(isChild,parMenu);
	
}

function makeElement(whichEl,whichWidth,whichParent,whichContainer) {
	if (NS4 ) { 
		if (whichWidth) {
			elWidth = whichWidth;
		}
		else {
			elWidth = (whichContainer) ? whichContainer.menuWidth : whichParent.menuWidth;
			if (whichContainer) elWidth = elWidth-(borWid*2)-(itemPadH*2);
		}
				
		if (!whichContainer) whichContainer = menuLoc;
		eval(whichEl + "= new Layer(elWidth,whichContainer)");
	}
	else {
		if (IE5 || NS7) {
			newDiv = menuLoc.document.createElement("DIV");
			newDiv.style.position = "absolute";
			newDiv.id = whichEl;
			if (NS7) {newDiv.onmouseout = menuOut;}
			menuLoc.document.body.appendChild(newDiv);
		}
		else {
			elStr = "<DIV ID=" + whichEl + " STYLE='position:absolute'></DIV>";
			menuLoc.document.body.insertAdjacentHTML("BeforeEnd",elStr);
		}
		if (isFrames) eval(whichEl + "= menuLoc." + whichEl);
		
	}
		
	if (!NS7) {return eval(whichEl)}
	else { return newDiv;}
	
}

function itemSetup(whichItem,whichArray) {

	this.onmouseover = itemOver;
	this.onmouseout = itemOut;
	this.container = (NS4) ? this.parentLayer : (NS7) ? this.parentNode : this.parentElement;

	arrayPointer = (this.container.hasParent) ? (whichItem-1)*3 : ((whichItem-1)*3)+9;

	this.dispText = whichArray[arrayPointer];
	this.linkText = whichArray[arrayPointer + 1];
	this.hasMore = whichArray[arrayPointer + 2];

	if ((IE4 || NS7) && this.hasMore) {
		if (NS7) { this.child = document.getElementById("elMenu" + this.id.substr(4));}
		else {this.child = eval("elMenu" + this.id.substr(4));}
		this.child.parentMenu = this.container;
		this.child.parentItem = this;
	}

	if (this.linkText) {
		if (NS4 ) {
			this.captureEvents(Event.MOUSEUP)
			this.onmouseup = linkIt;
		}
		else {
			this.onclick = linkIt;
			this.style.cursor = "hand";
		}
	}

	if (NS4 ) {
		htmStr = this.dispText;
		if (fntBold) htmStr = htmStr.bold();
		if (fntItal) htmStr = htmStr.italics();

		htmStr = "<FONT FACE='" + fntFam + "' POINT-SIZE=" + fntSiz + ">" + htmStr+ "</FONT>";
		this.htmStrOver = htmStr.fontcolor(this.container.menuFontOver);
		this.htmStr = htmStr.fontcolor(this.container.menuFontColor);
		if(this.hasMore) {
			this.document.write(imgStr);
			this.document.close();
		}
		this.visibility = "inherit";
		this.bgColor = this.container.menuBGColor;
		if (whichItem == 1) {
			this.top = borWid + itemPadV;
		}
		else {
			this.top = this.prevItem.top + this.prevItem.clip.height + separator;
		}
		this.left = borWid + itemPadH;
		this.clip.top = -itemPadV;
		this.clip.left = -itemPadH;
		this.clip.right = this.container.menuWidth-(borWid*2)-itemPadH;
		maxTxtWidth = this.container.menuWidth-(borWid*2)-(itemPadH*2);
		if (this.container.isTree) maxTxtWidth-=(fullImgSize);
		this.txtLyrOff = new Layer(maxTxtWidth,this);
		if (isRight && this.container.isTree) this.txtLyrOff.left = fullImgSize;
		this.txtLyrOff.document.write(this.htmStr);
		this.txtLyrOff.document.close();
		this.txtLyrOff.visibility = "inherit";

		this.clip.bottom = this.txtLyrOff.document.height+itemPadV;

		this.txtLyrOn = new Layer(maxTxtWidth,this);
		if (isRight && this.container.isTree) this.txtLyrOn.left = fullImgSize;
		this.txtLyrOn.document.write(this.htmStrOver);
		this.txtLyrOn.document.close();
		this.txtLyrOn.visibility = "hide";
		this.dummyLyr = new Layer(100,this);
		this.dummyLyr.left = this.dummyLyr.top = -itemPadH;
		this.dummyLyr.clip.width = this.clip.width;
		this.dummyLyr.clip.height = this.clip.height;
		this.dummyLyr.visibility = "inherit";
	}
	else {
		with (this.style) {
			if(!IE5) {
				fontSize = fntSiz + "pt";
				fontWeight = (fntBold) ? "bold" : "normal";
				fontStyle =   (fntItal) ? "italic" : "normal";
				fontFamily = fntFam;
		
				borderBottomWidth = separator + "px";
				borderBottomStyle = "solid";
				paddingLeft=itemPadH;
				paddingTop=itemPadV;					
				paddingBottom=itemPadV;

	 			if (this.container.isTree && !this.hasMore) {
					if (isRight) paddingLeft = itemPadH+fullImgSize;
					//else paddingRight = itemPadH+fullImgSize;
				} 
			} 
			
			color = this.container.menuFontColor;
			borderBottomColor = this.container.menuSeparatorCol;
			backgroundColor = this.container.menuBGColor; 
			if (NS7) {
				this.style.paddingRight = (this.container.menuWidth - this.offsetWidth) + "px";
			}
		}
	}
	
}   

function menuSetup(hasParent,openCont,openItem) {
	this.onmouseover = menuOver;
	this.onmouseout = menuOut;
	
	this.showIt = showIt;
	this.keepInWindow = keepInWindow;
	this.hideTree = hideTree
	this.hideParents = hideParents;
	this.hideChildren = hideChildren;
	this.hideTop = hideTop;
	this.hasChildVisible = false;
	this.isOn = false;
	this.hideTimer = null;

	this.childOverlap = (perCentOver != null) ? ((perCentOver/100) * this.menuWidth) : childOverlap;
	this.currentItem = null;
	this.hideSelf = hideSelf;
		
	if (hasParent) {
		this.hasParent = true;
		this.parentMenu = openCont;
		if (NS4) {
			this.parentItem = openItem;
			this.parentItem.child = this;
		}
	}
	else {
		this.hasParent = false;
	}

	if (NS4) {
		this.bgColor = this.menuBorCol;
		this.fullHeight = this.lastItem.top + this.lastItem.clip.bottom + borWid;
		this.clip.right = this.menuWidth;
		this.clip.bottom = this.fullHeight;
	}
	else {
		with (this.style) {
			width = this.menuWidth;
			borderWidth = borWid;
			borderColor = this.menuBorCol;
			borderStyle = borSty;
			if (NS7) { 
				if (this.hasParent) {
					zIndex =  1;
				} else {				
					zIndex = topZ;
				}
			} else {
				zIndex = topZ;
			}				
			overflow = "hidden";
		}
		this.lastItem.style.border="";
		this.fullHeight = this.offsetHeight;
		if(isMac)this.style.pixelHeight = this.fullHeight;
		this.fullHeight = this.scrollHeight;
		this.showIt(false);
		this.onselectstart = cancelSelect;
		this.moveTo = moveTo;
		this.moveTo(0,0);
	}
}

function popUp(menuName,e, classOver, classNormal,  classSelected){

	if (NS4 && NSresized) startIt();
	if (!isLoaded) return;

	linkEl = (NS4 || NS7) ? e.target : event.srcElement;
	
	if (clickStart) linkEl.onclick = popMenu;

	if (!beingCreated && !areCreated) startIt();
	linkEl.menuName = menuName;   

	if (!clickStart) popMenu(e, classOver, classNormal,  classSelected);

}

function hideFlash(action) {
	//masque l'animation flash (il faut que l'objet est id="flash" 
		itemColl = document.getElementsByTagName("IFRAME");
		if (itemColl[0].contentWindow.document.getElementById("flash") != null) {
	 	    itemColl[0].contentWindow.document.getElementById("flash").style.visibility=action;
		}
}


function popMenu(e, classOver, classNormal, classSelected){
	if (!isLoaded || !areCreated) return true;

	eType = (NS4 || NS7) ? e.type : event.type;
	if (clickStart && eType != "click") return true;

	hideAll(e);

	linkEl = (NS4 || NS7) ? e.target : event.srcElement;

	
	if (NS7) {
		currentMenu = document.getElementById(linkEl.menuName);
		currentMenuDynam = eval(linkEl.menuName + "Dynam");
		if ( typeof linkEl.tagName == "undefined" ) {linkEl = linkEl.parentNode;}
	} else {
		currentMenu = eval(linkEl.menuName);
		currentMenuDynam = eval(linkEl.menuName + "Dynam");
	}
	
	if (linkEl.className != classOver && linkEl.className != "") {
		currentMenuDynam[D_button] = linkEl.id; 
		currentMenuDynam[D_classOver] = classOver; 
		currentMenuDynam[D_classNormal] = classNormal; 
		currentMenuDynam[D_classSelected] = classSelected; 
		currentMenuDynam[D_svgClass] = linkEl.className;
	}

	linkEl.className = classOver;

	hideFlash('hidden')
	HF = setTimeout("hideFlash('hidden');",90); 

	//DynamXpos= linkEl.offsetLeft;

if (document.all)
   width =  document.body.offsetWidth;
else if (document.layers)  
   width = window.innerWidth;


DynamXpos=(width/2)-380+linkEl.offsetLeft;
//rrr=(width/2)-380+linkEl.offsetLeft;
//alert(linkEl.offsetLeft+'--'+rrr+'--'+event.x);

	
	currentMenu.hasParent = false;
	currentMenu.treeParent.startChild = currentMenu;
	
	if (IE4 || NS7) menuLocBod = menuLoc.document.body;
	if (!isFrames) {
		switch (navFrLoc) {
			case "kitweb":
				xPos=DynamXpos;
				yPos=currentMenu.menuTop;
				break;
		   default :
				xPos = (currentMenu.menuLeft) ? currentMenu.menuLeft : (NS4) ? e.pageX : (event.clientX + menuLocBod.scrollLeft);
				yPos = (currentMenu.menuTop) ? currentMenu.menuTop : (NS4) ? e.pageY : (event.clientY + menuLocBod.scrollTop);
				break;
		}

	}
	else {
		switch (navFrLoc) {
			case "left":
				xPos = (currentMenu.menuLeft) ? currentMenu.menuLeft : (NS4) ? menuLoc.pageXOffset : menuLocBod.scrollLeft;
				yPos = (currentMenu.menuTop) ? currentMenu.menuTop : (NS4) ? (e.pageY-pageYOffset)+menuLoc.pageYOffset : event.clientY + menuLocBod.scrollTop;
				break;
			case "top":
				xPos = (currentMenu.menuLeft) ? currentMenu.menuLeft : (NS4) ? (e.pageX-pageXOffset)+menuLoc.pageXOffset : event.clientX + menuLocBod.scrollLeft;
				yPos = (currentMenu.menuTop) ? currentMenu.menuTop : (NS4) ? menuLoc.pageYOffset : menuLocBod.scrollTop;
				break;
			case "bottom":
				xPos = (currentMenu.menuLeft) ? currentMenu.menuLeft : (NS4) ? (e.pageX-pageXOffset)+menuLoc.pageXOffset : event.clientX + menuLocBod.scrollLeft;
				yPos = (currentMenu.menuTop) ? currentMenu.menuTop : (NS4) ? menuLoc.pageYOffset+menuLoc.innerHeight : menuLocBod.scrollTop + menuLocBod.clientHeight;
				break;
			case "right":
				xPos = (currentMenu.menuLeft) ? currentMenu.menuLeft : (NS4) ? menuLoc.pageXOffset+menuLoc.innerWidth : menuLocBod.scrollLeft+menuLocBod.clientWidth;
				yPos=menuLocBod.scrollTop;
				break;
			case "kitweb":
				xPos=DynamXpos;
				yPos=menuLocBod.scrollTop;
				break;
		}
	}
	currentMenu.moveTo(xPos,yPos);
	currentMenu.keepInWindow();
	currentMenu.isOn = true;
	currentMenu.showIt(true);

	return false;
}

function menuOver() {
	this.isOn = true;
	isOverMenu = true;
	currentMenu = this;
	if (currentMenu.id.indexOf("_") > 0) return;
	bt_dynam =  eval(currentMenu.id + "Dynam");
	if (NS7) {
		bt = document.getElementById(bt_dynam[D_button]);
	} else {
		bt = eval(bt_dynam[D_button] );
	}
	
	bt.className =bt_dynam[D_classOver];
	hideFlash("hidden");
	if (this.hideTimer) {clearTimeout(this.hideTimer); }
}

function menuOut() {
	if (IE4) {
		theEvent = menuLoc.event;
		if (theEvent.srcElement.contains(theEvent.toElement)) return;
	}
	this.isOn = false;
	isOverMenu = false;

	menuLoc.status = "";
	

	//if (!clickKill) allTimer = setTimeout("currentMenu.hideTree()",100);  
	 allTimer = setTimeout("currentMenu.hideTree()",100);  
	
}

function itemOver(){

	if (keepHilite) {
		if (this.container.currentItem && this.container.currentItem != this) {
			if (NS4) {
				this.container.currentItem.bgColor = this.container.menuBGColor;
				this.container.currentItem.txtLyrOff.visibility = "inherit";
				this.container.currentItem.txtLyrOn.visibility = "hide";
			}
			else {
				with (this.container.currentItem.style) {
					backgroundColor = this.container.menuBGColor;
					color = this.container.menuFontColor;
				}
			}
		}
	}

	if (this.linkText !="" || this.hasMore) {
		if (IE4 || NS7) {
			if (IE4 ) { 
				theEvent = menuLoc.event;
				if (theEvent.srcElement.tagName == "IMG") return;
			}
			this.style.backgroundColor = this.container.menuBGOver;
			this.style.color = this.container.menuFontOver;
		}
		else {
			this.bgColor = this.container.menuBGOver;
			this.txtLyrOff.visibility = "hide";
			this.txtLyrOn.visibility = "inherit";
		}

		this.container.currentItem = this;
	
		if (this.container.hasChildVisible) {
			this.container.hideChildren(this);
		}
	
		if (this.hasMore) {
			horOffset = (isRight) ? (this.container.childOverlap - this.container.menuWidth) : (this.container.menuWidth - this.container.childOverlap);
			if (NS4) {
				this.childX = this.container.left + horOffset;
				this.childY = (this.pageY+this.clip.top) + childOffset;
			}
			else {
				if (NS7) {
					this.childX = Number(this.container.style.left.replace("px", "")) + horOffset;
					this.childY = this.offsetTop + Number(this.container.style.top.replace("px", "")) + childOffset + borWid;
				} else {
					this.childX = this.container.style.pixelLeft + horOffset;
					this.childY = this.offsetTop + this.container.style.pixelTop + childOffset + borWid;
				}	
			}
			this.child.moveTo(this.childX,this.childY);
			this.child.keepInWindow();
			this.container.hasChildVisible = true;
			this.container.visibleChild = this.child;
			this.child.showIt(true);
		}
	}
}

function itemOut() {
	if (IE4 ) {
		theEvent = menuLoc.event;
		 if (theEvent.srcElement.contains(theEvent.toElement)
	  || (theEvent.fromElement.tagName=="IMG" && theEvent.toElement.contains(theEvent.fromElement)))
		  return;
		if (!keepHilite) {
			this.style.backgroundColor = this.container.menuBGColor;
			this.style.color = this.container.menuFontColor;
		}
	}
	else {
		if (!keepHilite) {
			this.bgColor = this.container.menuBGColor;
			this.txtLyrOff.visibility = "inherit";
			this.txtLyrOn.visibility = "hide";
		}
		if (!isOverMenu && !clickKill) {
			allTimer = setTimeout("currentMenu.hideTree()",10); 
		}
				
	}
}

function moveTo(xPos,yPos) {
	if (NS7) {
		this.style.left = xPos ;
		this.style.top = yPos ;
	} else {
		this.style.pixelLeft = xPos;
		this.style.pixelTop = yPos;
	}
}

function showIt(on) { 
	if (NS4) {
		this.visibility = (on) ? "show" : "hide";
		if (keepHilite && this.currentItem) {
			this.currentItem.bgColor = this.menuBGColor;
			this.currentItem.txtLyrOff.visibility = "inherit";
			this.currentItem.txtLyrOn.visibility = "hide";
		}
	}
	else {
		this.style.visibility = (on) ? "visible" : "hidden";
		if (keepHilite && this.currentItem) {
			with (this.currentItem.style) {
				backgroundColor = this.menuBGColor;
				color = this.menuFontColor;
			}
		}
	}
	this.currentItem = null;
}

function keepInWindow() {
	scrBars = 0;
	botScrBar = (isFrames && navFrLoc=="bottom") ? (borWid*2) : scrBars;
	rtScrBar = (isFrames && (navFrLoc=="right" || navFrLoc=="kitweb" )) ? (borWid*2) : scrBars;

	if (NS4) {
		winRight = (menuLoc.pageXOffset + menuLoc.innerWidth) - rtScrBar;
		rightPos = this.left + this.menuWidth;
	
		if (rightPos > winRight) {
			if (this.hasParent) {
				parentLeft = this.parentMenu.left;
				newLeft = ((parentLeft-this.menuWidth) + this.childOverlap);
				this.left = newLeft;
			}
			else {
				dif = rightPos - winRight;
				this.left -= dif;
			}
		}

		winBot = (menuLoc.pageYOffset + menuLoc.innerHeight) - botScrBar ;
		botPos = this.top + this.fullHeight;

		if (botPos > winBot) {
			dif = botPos - winBot;
			this.top -= dif;
		}
		
		winLeft = menuLoc.pageXOffset;
		leftPos = this.left;

		if (leftPos < winLeft) {
			if (this.hasParent) {
				parentLeft = this.parentMenu.left;
				newLeft = ((parentLeft+this.menuWidth) - this.childOverlap);
				this.left = newLeft;
			}
			else {
				this.left = 5;
			}
		}
	}
	else {
	
		if (NS7) {
			pLeft = this.style.left;
			if (this.hasParent) { parentPLeft = this.parentMenu.style.left;}
			pTop =	this.style.top;
		} else {
			pLeft = this.style.pixelLeft;
			if (this.hasParent) {parentPLeft = this.parentMenu.style.pixelLeft;}
			pTop = this.style.pixelTop;
			
		}
		
		winRight = (menuLoc.document.body.scrollLeft + menuLoc.document.body.clientWidth) - rtScrBar;
		rightPos = pLeft + this.menuWidth;
	
		if (rightPos > winRight) {
			if (this.hasParent) {
				parentLeft = parentPLeft;
				newLeft = ((parentLeft - this.menuWidth) + this.childOverlap);
				pLeft = newLeft;
			}
			else {
				dif = rightPos - winRight;
				pLeft -= dif;
			}
		}

		winBot = (menuLoc.document.body.scrollTop + menuLoc.document.body.clientHeight) - botScrBar;
		botPos = pTop + this.fullHeight;

		if (botPos > winBot) {
			dif = botPos - winBot;
			pTop -= dif;
		}
		
		winLeft = menuLoc.document.body.scrollLeft;
		leftPos = pLeft;

		if (leftPos < winLeft) {
			if (this.hasParent) {
				parentLeft = parentPLeft;
				newLeft = ((parentLeft+this.menuWidth) - this.childOverlap);
				pLeft = newLeft;
			}
			else {
				pLeft = 5;
			}
		}
		if (NS7) {
			this.style.left = pLeft;
			this.style.top = pTop;
		} else {
			this.style.pixelLeft = pLeft;
			this.style.pixelTop = pTop;
		}
	}

}

function linkIt() {
	if (this.linkText.indexOf("javascript:")!=-1) eval(this.linkText)
	else {menuLoc.location.href = this.linkText;}
	
			for(i=1; i<topCount; i++) {
				temp = eval("elMenu" + i+ "Dynam" );
				if (temp[D_button] != ""){
					if (NS7) {
						bt = document.getElementById(temp[D_button]);
					} else {
						bt = eval(temp[D_button]);
					}
					bt.className =temp[D_classNormal];
				}
			}
			tmpMenu = currentMenu;
			 while (tmpMenu.hasParent) {
   				tmpMenu =  tmpMenu.treeParent
 	 		}
			bt_dynam =  eval(tmpMenu.id + "Dynam");  
			if (NS7) {
				bt = document.getElementById(bt_dynam[D_button]);
			} else {
				bt = eval(bt_dynam[D_button]);
			}
			
			for(x=1; x<topCount; x++) {
				tmp_bt_dynam =  eval("elMenu" + x + "Dynam");
				tmp_bt_dynam[D_svgClass] = tmp_bt_dynam[D_classNormal];
			}
			bt_dynam[D_svgClass] = bt_dynam[D_classSelected];
			bt.className =bt_dynam[D_classSelected];
			
	if (clickKill) {
		//masque le menu
		for(i=1; i<topCount; i++) {
				if (NS7) {
					temp = document.getElementById("elMenu" + i ).startChild;
				} else {
					temp = eval("elMenu" + i + ".startChild");
				}
				
				
				temp.isOn = false;
				if (temp.hasChildVisible) temp.hideChildren();
				temp.showIt(false);
				if ("elMenu" + i != tmpMenu) {
					bt_dynam =  eval(temp.id + "Dynam");
					if (bt_dynam[D_button] != "") {
						if (NS7) {
							bt = document.getElementById(bt_dynam[D_button]);
						} else {
							bt = eval(bt_dynam[D_button]);
						}
						if (bt.className != bt_dynam[D_classSelected]) { 
							bt.className =bt_dynam[D_classNormal];
						}
					}
				}
		}
		
	}
	
}

function popDown(menuName){
	if (!isLoaded || !areCreated) return;
	if (NS7) {
		whichEl = document.getElementById(menuName );
	} else {
		whichEl = eval(menuName);
	}
	
	whichEl.isOn = false;
	
	//if (!clickKill) whichEl.hideTop();
	allTimer = setTimeout("whichEl.hideTop()",100);  
}

function hideAll(e) {
	bt = (NS4 || NS7) ? e.target : event.srcElement;
	if (currentMenu!=null ){ tmpMenu = bt.menuName;}
	else {tmpMenu = ""}

	for(i=1; i<topCount; i++) {
			if (NS7) {
				temp = document.getElementById("elMenu" + i ).startChild;
			} else {
				temp = eval("elMenu" + i + ".startChild");
			}
			
			temp.isOn = false;
			if (temp.hasChildVisible) temp.hideChildren();
			temp.showIt(false);
			if ("elMenu" + i != tmpMenu) {
			   	bt_dynam =  eval(temp.id + "Dynam");
				if (bt_dynam[D_button] != "") {
					if (NS7) {
						bt = document.getElementById(bt_dynam[D_button]);
					} else {
						bt = eval(bt_dynam[D_button]);
					}
					if (bt.className != bt_dynam[D_classSelected]) { 
						bt.className =bt_dynam[D_svgClass];
					}
				}
			}
		hideFlash("visible");
	}   
}

function hideTree() { 
	allTimer = null;
	if (isOverMenu) return;
	if (this.hasChildVisible) {
		this.hideChildren();
	}
	this.hideParents();

}

function hideTop() {
	whichTop = this;
	(clickKill) ? whichTop.hideSelf() : (this.hideTimer = setTimeout("if(whichTop.hideSelf)whichTop.hideSelf()",mSecsVis));
}

function hideSelf() {
	this.hideTimer = null;
	if (!this.isOn && !isOverMenu) { 
		this.showIt(false);
		bt_dynam =  eval(this.id + "Dynam");

        if (NS7) { bt = document.getElementById(bt_dynam[D_button]);}
		else     { bt = eval(bt_dynam[D_button]);}
		bt.className =bt_dynam[D_svgClass];
		hideFlash("visible")
	}
}

function hideParents() {
	tempMenu = this;
	while (tempMenu.hasParent) {
		tempMenu.showIt(false);
		tempMenu.parentMenu.isOn = false;      
		tempMenu = tempMenu.parentMenu;
	}
	tempMenu.hideTop();

}

function hideChildren(item) {
	tempMenu = this.visibleChild;
	while (tempMenu.hasChildVisible) {
		tempMenu.visibleChild.showIt(false);
		tempMenu.hasChildVisible = false;
		tempMenu = tempMenu.visibleChild;
	}

	if (!this.isOn || !item.hasMore || this.visibleChild != this.child) {
		this.visibleChild.showIt(false);
		this.hasChildVisible = false;
	}
}

function cancelSelect(){return false}

function reDo(){
	if (loader.innerWidth==origWidth && loader.innerHeight==origHeight) return;
	initVars();
	NSresized=true;
	menuLoc.location.reload();
}

function clicked() {
	if (!isOverMenu && currentMenu!=null && !currentMenu.isOn) {
		whichEl = currentMenu;
		whichEl.hideTree();
	}
}

window.onerror = handleErr;

function handleErr(){
	arAccessErrors = ["permission","access"];
	mess = arguments[0].toLowerCase();
	found = false;
	for (i=0;i<arAccessErrors.length;i++) {
		errStr = arAccessErrors[i];
		if (mess.indexOf(errStr)!=-1) found = true;
	}
	return found;
}

//end

