function initMenu(){
	/* Version 1.0 */
	/* Marc */
	for(var t=0;t<window.Dmc_declars.length;t++){
		addMenu(window.Dmc_declars[t],t); 
	}
}
function addMenu(tableau,t){
	var DmcParent = document.createElement("DIV");
	document.body.appendChild(DmcParent);
	DmcParent.id=tableau[0][0];
	DmcParent.className=tableau[0][3];
	DmcParent.Niveau=tableau[0][4];
	DmcParent.style.position = "absolute";
	DmcParent.style.top = "0px";
	DmcParent.style.left= "10px";
	DmcParent.style.zIndex= t+1000;
	DmcParent.style.width = tableau[0][1][0]+"px";
	DmcParent.style.overflow="hidden"; 
	DmcParent.style.backgroundColor=tableau[0][2][0];
	DmcParent.backgroundColorOver=tableau[0][2][1];
	DmcParent.style.borderWidth ="1px";
	DmcParent.style.borderStyle = "solid";
	DmcParent.style.visibility = "hidden";
	DmcParent.style.padding = "0";
	DmcParent.hauteur=0;
	DmcParent.isSelect="";
	
	for(var i=1;i<tableau.length;i++){
		var items=addItem(DmcParent.id,tableau[0][1][0],tableau[i],i)
		DmcParent.appendChild(items)
		items.setStyle();
	}
	DmcParent.style.height=(parseInt(DmcParent.hauteur)-1)+"px"
}
function addItem(nom,width,table,index){
	var DmcItem = document.createElement("DIV");
	DmcItem.id=nom+"_"+index;
	DmcItem.style.zIndex=index;
	DmcItem.style.position = "absolute";
	DmcItem.Url=table[1];
	DmcItem.Target="_self";
	DmcItem.Nom_Fils=table[2];
	DmcItem.style.cursor=setCursor((table[1]!="")? true:false)
	DmcItem.innerHTML ="<a href=\"#\" class=\"lien_menu\" style=\"cursor:"+setCursor((table[1]!="")? true:false)+"\" onclick=\"return false\">"+table[0]+"</a>";
	DmcItem.setStyle=setStyleItem;
  return DmcItem;
}
function setImage(Menu){
		var l=(parseInt(Menu.style.width)-parseInt(Menu.style.padding)-5)
		imagef='<img src="images/f.gif" style="float: right;" hspace="'+(2)+'"  vspace="'+(2)+'">'
		Menu.innerHTML=imagef+Menu.innerHTML;
}
function setStyleItem(){
	this.className=this.parentNode.className;
	this.style.backgroundColor=this.parentNode.style.backgroundColor;
	this.style.padding = "2px";
	if(this.style.zIndex==1){
		this.style.top="0px"
	}else{
		this.style.top=(parseInt(this.previousSibling.offsetHeight)+parseInt(this.previousSibling.style.top))+"px";
	}
	this.style.left=0;
	
	this.style.visibility='inherit';
	this.style.borderWidth="0px";
	this.style.borderBottomWidth ="1px";
	this.style.borderStyle = "solid";
	this.style.width=(parseInt(this.parentNode.offsetWidth)-(parseInt(this.style.padding)*2))+"px";
	if(this.Nom_Fils!=""){
		setImage(this)
	}
	this.onmouseover=rollover;
 	this.onmouseout=rollout;
	this.filsVisible = function(){
	if(this.Nom_Fils!=""){
				var DmcCalque=Dmc_Layer.is_object(this.Nom_Fils);
				if(DmcCalque!=false){
						if(Dmc_Layer.DMC_net){
						}else if(Dmc_Layer.DMC_net6 || Dmc_Layer.DMC_ie){
							if(DmcCalque.style.visibility=="visible"){
									this.style.backgroundColor=this.parentNode.backgroundColorOver;
									return
								}else{
									this.style.backgroundColor=this.parentNode.style.backgroundColor;
								}
						}
				}
			}
			this.style.backgroundColor=this.parentNode.style.backgroundColor;
	}
	if(Dmc_Layer.DMC_net){
		this.captureEvents(Event.MOUSEUP);
		this.onmouseup =ouvrePage;
	}else if(Dmc_Layer.DMC_net6){
		this.onclick=ouvrePage;
	}else if(Dmc_Layer.DMC_ie){
		this.onmousedown = ouvrePage;
	}
		this.parentNode.hauteur=this.parentNode.hauteur+parseInt(this.offsetHeight);
}
function rollover(){
	clearTimeout(MenuTimer);
	var ecran =getEcranX();
	if(typeof(EnsembleMenu[this.parentNode.Niveau+1])!="undefined"){
		cacheniveau(this.parentNode.Niveau);
	}	
	if(this.parentNode.isSelect!=""){this.parentNode.isSelect.filsVisible();}
	this.style.backgroundColor=this.parentNode.backgroundColorOver;
	if(this.Nom_Fils!=""){
		this.parentNode.isSelect=this;
		EnsembleMenu[this.parentNode.Niveau+1]=this.Nom_Fils;
		var DmcCalque=Dmc_Layer.is_object(this.Nom_Fils);
		if( DmcCalque!=false){
			var longueur=parseInt(this.parentNode.style.width);
			if(is_droit==true){
				if((parseInt(this.parentNode.style.width)*2)+parseInt(this.parentNode.style.left) < ecran ){
						var posx=parseInt(this.parentNode.style.width)+parseInt(this.parentNode.style.left);
						is_droit=true;
				}else{
						var posx=parseInt(this.parentNode.style.left)-parseInt(this.parentNode.style.width);
						//is_droit=false;
				}
			}else{
			 	var posx=parseInt(this.parentNode.style.left)-parseInt(this.parentNode.style.width);
			}
			var posy=parseInt(this.parentNode.style.top)+parseInt(this.style.top)
			DmcCalque.style.left=(posx-1)+"px";
			DmcCalque.style.top=posy+"px";
			DmcCalque.style.visibility="visible";
		}
	}else{
		this.parentNode.isSelect="";
	}	
}
function rollout(){
	MenuTimer=setTimeout("cacheniveau(-1)",1000);
	if(this.Nom_Fils==""){this.style.backgroundColor=this.parentNode.style.backgroundColor;}
}
function setCursor(action){
	if(!action){
		return "default";
	}else{
		if(Dmc_Layer.DMC_ie){return "hand";}
		else if(Dmc_Layer.DMC_net6){return "pointer";}
		else{return "";}
	}
}
function ouvrePage(){
	if(this.Url!=""){
		if(Dmc_Layer.DMC_net6 && this.Url.indexOf('javascript:')!=-1){eval(this.Url);}
		else{open(this.Url,this.Target);}
	}
}
function cacheniveau(Niveau){
	for(var j=Number(Niveau+1);j<EnsembleMenu.length;j++){
		if(EnsembleMenu[j]!="" && typeof(EnsembleMenu[j])!="undefined"){
			//alert(EnsembleMenu[j])
			var obj=Dmc_Layer.is_object(EnsembleMenu[j]);
			Dmc_Layer.f_cacher(obj);
			if(obj!=false){
				Dmc_Layer.set_posy(obj,-200);
				Dmc_Layer.set_posx(obj,-100);
			}
			EnsembleMenu[j]="";
		}
	}
}
function getEcranX(){
		if (window.innerWidth != null){
		return parseInt(window.innerWidth);}
		if (document.body.clientWidth != null){
		return parseInt(document.body.clientWidth);}
		return (0);
}
function getArbo(nom){
	var result=new Array();
	for(var rt=0;rt<window.Dmc_declars.length;rt++){
		if(window.Dmc_declars[rt][0][0]==nom){
			result=window.Dmc_declars[rt];
			break;
		}
	}
	return result;
}
function AoMenu_AddOnline(nom,objlien){
	clearTimeout(MenuTimer);
	cacheniveau(-1);
	var pos_y=220;
	var pos_x=199;
		if(nom!=""){
			var _layer = Dmc_Layer.is_object(nom);
			var ecran  = ((getEcranX()-939)/2)
			if(getEcranX()<=939){
				ecran  = 0;
			}
			//var _x = parseInt(objlien.offsetLeft);
			pos_y = objlien.offsetTop;
			if(Dmc_Layer.DMC_ie) pos_y += 211;
			_x = 155;

			if(_layer!=false){
				EnsembleMenu[0]=nom;
				Dmc_Layer.set_posx(_layer,_x+pos_x+ecran);
				Dmc_Layer.set_posy(_layer,pos_y);
				Dmc_Layer.f_visible(_layer);
			}
		}
}



function AoMenu_AddOnlinev(calque,objetlien,blocconteneur,blocparent){
	/**/
	clearTimeout(MenuTimer);
	cacheniveau(-1);
	var _blocconteneur = Dmc_Layer.is_object(blocconteneur);
	var blocconteneurY =_blocconteneur.offsetTop;
	var _blocparent = Dmc_Layer.is_object(blocparent);
	var blocparentY =_blocparent.offsetTop;
	var ecran  = ((getEcranX()-939)/2);
	var posx=255;
	var posy=233; //350;
	if(getEcranX()<=939){
		ecran  = 0;
	}
	var _layer = Dmc_Layer.is_object(calque);
	if(_layer!=false){ 
		EnsembleMenu[0] = calque;
		var _parente = Dmc_Layer.is_object("blockmenuv1");
		_y= parseInt(blocparentY)+parseInt(blocconteneurY)+posy+objetlien.offsetTop;
		Dmc_Layer.set_posx(_layer,posx+ecran);
		Dmc_Layer.set_posy(_layer,_y);
		Dmc_Layer.f_visible(_layer);
	}
}

function deroulefil(nom){
	if(window.oldDeplie!=""){
		var _layer = Dmc_Layer.is_object(window.oldDeplie);
					_layer.style.display ="none";
	}
	var _layer = Dmc_Layer.is_object(nom);
	if(_layer!=false){
			if(_layer.style.display == "none"){
				_layer.style.display = "block";
				window.oldDeplie =nom;
			}else{
				_layer.style.display ="none";
				window.oldDeplie ="";
			}
	}
}
/*
mm  =open("","mm");
function test(objs){	
var obj =objs;
mm.document.write("<hr>")
	for(var i in obj){
		mm.document.write(i+"="+obj[i]+"<br>")
	}
}
*/

