VIDOverMouse="";
var VMenShow=false;
var VMenShowTimeOut;

/*TEST TYPE NAVIGATEUR*/
if (document.all){
	Vpas = 4; // Surplus horizontal
	Vcorv = -1; // Surplus horizontal
	VposVNav = 17; // incrementation vertical
	HBorder = 2; // Surplus horizontal
	//document.onselectstart=new Function ("return false");
}else{
	Vpas = 3; // Surplus horizontal
	Vcorv = 0; // Surplus horizontal
	VposVNav = 17; // incrementation vertical
	HBorder = 0; // Surplus horizontal
	//document.onmousedown=disableselect
	//document.onclick=reEnable
}
function disableselect(e){
return false
}
function reEnable(){
return true
}

function onmouseovertd(VOption){
	VIDOverMouse=VOption.id;
	if(VOption.id.length==1 && !VMenShow){
		ShowMen();
	}
}

function ShowMen(){
	VMenShow=false;
	if (document.all)
	{
	  document.onselectstart=new Function ("return false");
	}
	else
	{
	 document.onmousedown=disableselect;
	 document.onclick=reEnable;
	}
	for (i=0;i<VMenu.length;i++){
		if (document.getElementById(i)){
			document.getElementById(i).className="ClassOptMenPrin";
			if (document.getElementById("T"+i)){
				document.getElementById("T"+i).style.visibility="hidden";
				document.getElementById("F"+i).style.visibility="hidden";
			}
		}
		if (typeof(VMenu[i][2])=="object"){
			for (j=0;j<VMenu[i][2].length;j++){
				if (document.getElementById(String(i)+String(j))){
					document.getElementById(String(i)+String(j)).className="ClassOptMenSeco";
					if (document.getElementById("T"+String(i)+String(j))){
						document.getElementById("T"+String(i)+String(j)).style.visibility="hidden";
						document.getElementById("F"+String(i)+String(j)).style.visibility="hidden";
					}
				}
				if (typeof(VMenu[i][2][j][1])=="object"){
					for (x=0;x<VMenu[i][2][j][1].length;x++){
						if (document.getElementById(String(i)+String(j)+String(x))){
							document.getElementById(String(i)+String(j)+String(x)).className="ClassOptMenSeco";
							if (document.getElementById("T"+String(i)+String(j)+String(x))){
								document.getElementById("T"+String(i)+String(j)+String(x)).style.visibility="hidden";
								document.getElementById("F"+String(i)+String(j)+String(x)).style.visibility="hidden";
							}
						}
						if (typeof(VMenu[i][2][j][1][x][1])=="object"){
							for (y=0;y<VMenu[i][2][j][1][x][1].length;y++){
								if (document.getElementById(String(i)+String(j)+String(x)+String(y))){
									document.getElementById(String(i)+String(j)+String(x)+String(y)).className="ClassOptMenSeco";
								}
							}
						}
					}
				}
			}
		}
	}
	for(i=0;i<VIDOverMouse.length;i++){
		VMenShow=true;
		switch(i){
			case 0:
				for (j=0;j<VMenu.length;j++){
					if(VIDOverMouse.substr(0,1)==j){
						document.getElementById(j).className="ClassOptMenPrinSurVol";
						if (document.getElementById("T"+j)){
							document.getElementById("T"+j).style.visibility="visible";
							document.getElementById("F"+j).style.visibility="visible";
						}
					}
				}
				break;
			case 1:
				for (j=0;j<VMenu[VIDOverMouse.substr(0,1)][2].length;j++){
					if(VIDOverMouse.substr(1,1)==j){
						document.getElementById(VIDOverMouse.substr(0,1) + String(j)).className="ClassOptMenSecoSurVol";
						if (document.getElementById("T"+VIDOverMouse.substr(0,1) + String(j))){
							document.getElementById("T"+VIDOverMouse.substr(0,1) + String(j)).style.visibility="visible";
							document.getElementById("F"+VIDOverMouse.substr(0,1) + String(j)).style.visibility="visible";
						}
					}
				}
				break;
			case 2:
				for (j=0;j<VMenu[VIDOverMouse.substr(0,1)][2][VIDOverMouse.substr(1,1)][1].length;j++){
					if(VIDOverMouse.substr(2,1)==j){
						document.getElementById(VIDOverMouse.substr(0,2) + String(j)).className="ClassOptMenSecoSurVol";
						if (document.getElementById("T"+VIDOverMouse.substr(0,2) + String(j))){
							document.getElementById("T"+VIDOverMouse.substr(0,2) + String(j)).style.visibility="visible";
							document.getElementById("F"+VIDOverMouse.substr(0,2) + String(j)).style.visibility="visible";
						}
					}
				}
				break;
			case 3:
				for (j=0;j<VMenu[VIDOverMouse.substr(0,1)][2][VIDOverMouse.substr(1,1)][1][VIDOverMouse.substr(2,1)][1].length;j++){
					if(VIDOverMouse.substr(3,1)==j){
						document.getElementById(VIDOverMouse.substr(0,3) + String(j)).className="ClassOptMenSecoSurVol";
						if (document.getElementById("T"+VIDOverMouse.substr(0,3) + String(j))){
							document.getElementById("T"+VIDOverMouse.substr(0,3) + String(j)).style.visibility="visible";
							document.getElementById("F"+VIDOverMouse.substr(0,3) + String(j)).style.visibility="visible";
						}
					}
				}
				break;
		}
	}
	if (VMenShow){
		VMenShowTimeOut=setTimeout("ShowMen()",100);
	}
	else
	{
		if (document.all)
		{
			document.onselectstart=new Function ("return true");
		}
		else
		{
			document.onmousedown=reEnable;

		}
	}
}

// DEUX FONCTIONS POUR GERER LE CLICK SIMPLE ET DOUBLE
function voirclick(el,VURL)
{  
  elm = el;
  if (el.clique) {el.clique=false;return;}
  el.clique=true;
  setTimeout("actionclick('"+ VURL + "')",250);
}

function actionclick(VURL){ 
  if (!elm.clique){ 
	window.open(VURL);
  }
  else{
    window.location = VURL;
  }
  elm.clique=false;
}

/* CONSTRUCTION MENU PRINCIPAL*/
document.write('<TABLE class="ClassMenu" style="width: 100%; z-index:3; top:' + VposPrinc + 'px; height:' + VHeiPrinc + 'px;"><TR>');
/* CONSTRUCTION DE L'IMAGE SI LARGEUR */
if (VImgWidth!=0){
document.write('<TD class="ClassOptCelImg" style="width:' + VImgWidth + 'px;"><IMG SRC="' + VImgUrl + '" style="width:' + VImgWidth + 'px; height:' + (VHeiPrinc - 2) + 'px;"></TD>')
}
for (i=0;i<VMenu.length;i++){
	Voption='<TD id="'+ String(i)+'" class="ClassOptMenPrin" style="width:' + VMenu[i][1] + 'px" onmouseover="onmouseovertd(this)"';
	if(typeof(VMenu[i][2])=="string"){
		Voption +=' onmouseup="voirclick(this,\'' + VMenu[i][2] + '\')"'; // Construction Lien Hypertext
	}
	Voption +='>' + VMenu[i][0] + '</TD>';
	document.write(Voption);
}
document.write('<TD onMouseMove="VIDOverMouse=\'\'">&nbsp;</TD></TABLE></TR>');
/*CONSTRUCTION PREMIER NIVEAU*/
VposLeft=VImgWidth+1;
for (i=0;i<VMenu.length;i++){
	if(typeof(VMenu[i][2])=="object"){
		HeightFrame  = 0
		document.write('<IFRAME id="F'+ i +'" src="about:blank" scrolling="no" frameborder="0" style="position:absolute; visibility:hidden; z-index:3; width:' + (parseFloat(VMenu[i][3]) + Vpas) + 'px; top:' + (VposPrinc + VHeiPrinc + Vcorv) + 'px; left:' + VposLeft + 'px; height:0px"></IFRAME>');
		document.write('<DIV id="T'+ i +'" style="position:absolute; visibility:hidden; z-index:3; width:' + (parseFloat(VMenu[i][3]) + Vpas) + 'px; top:' + (VposPrinc + VHeiPrinc + Vcorv) + 'px; left:' + VposLeft + 'px">');
		document.write('<TABLE class="ClassMenu" style="width:100%">');
		//alert("cou");
		//document.write('<TABLE id="T'+ i +'" class="ClassMenu" style="position:absolute; visibility:visible; z-index:3; width:' + (parseFloat(VMenu[i][3]) + Vpas) + 'px; top:' + (VposPrinc + VHeiPrinc + HBorder) + 'px; left:' + VposLeft + 'px">');
		for (j=0;j<VMenu[i][2].length;j++){
			if(typeof(VMenu[i][2][j])=="object"){
				Voption='<TR id="'+ String(i) + String(j) +'" class="ClassOptMenSeco" onmouseover="onmouseovertd(this)"><TD class="OptionAlign" style="height:' + VHeiSec + 'px; width:' + (parseFloat(VMenu[i][3]) + Vpas - 12) + 'px;"';
				Vimage= VMenUrl + "MenFle.GIF";
				if(typeof(VMenu[i][2][j][1])=="string"){
					Voption +=' onmouseup="voirclick(this,\'' + VMenu[i][2][j][1] + '\')"'; // Construction Lien Hypertext
				    Vimage= VMenUrl + "MenVide.GIF";
				}
				Voption +='>' + VMenu[i][2][j][0] + '</TD>';
				Voption +='<TD><div align="right"><IMG src="' + Vimage + '"</div></TD>';				
				Voption +='</TR>';
				document.write(Voption);
				HeightFrame+=VHeiSec;
			}else{
			/*CONSTRUCTION SEPARATION*/
				Voption='<TR><TD colspan="2" class="LineSep"></TD></TR>';
				document.write(Voption);
				HeightFrame+=1;
			}
		}
		document.write('</TABLE></DIV>');
		document.getElementById("F"+i).style.height= HeightFrame + "px";
	}
	VposLeft += parseFloat(VMenu[i][1])+Vpas+Vcorv; //POSITION HORIZONTAL
}
/*CONSTRUCTION DEUXIEME NIVEAU*/
VposLeft=VImgWidth+1;
for (i=0;i<VMenu.length;i++){
	if(typeof(VMenu[i][2])=="object"){
		VposVertical= VposPrinc + VHeiPrinc + Vcorv;
		for (j=0;j<VMenu[i][2].length;j++){
			if(typeof(VMenu[i][2][j])=="object"){
				if(typeof(VMenu[i][2][j][1])=="object"){
					HeightFrame  = 0
					document.write('<IFRAME id="F'+ String(i) + String(j) +'" src="about:blank" scrolling="no" frameborder="0" style="position:absolute; visibility:hidden; z-index:3; width:' + (parseFloat(VMenu[i][2][j][2]) + Vpas) + 'px; top:' + VposVertical + 'px; left:' + (VposLeft + parseFloat(VMenu[i][3]) + Vpas + Vcorv) + 'px; height:0px"></IFRAME>');
					document.write('<DIV id="T'+ String(i) + String(j) +'" style="position:absolute; visibility:hidden; z-index:3; width:' + (parseFloat(VMenu[i][2][j][2]) + Vpas) + 'px; top:' + VposVertical + 'px; left:' + (VposLeft + parseFloat(VMenu[i][3]) + Vpas + Vcorv) + 'px">');
					document.write('<TABLE class="ClassMenu" style="width:100%">');
					for (x=0;x<VMenu[i][2][j][1].length;x++){
						if(typeof(VMenu[i][2][j][1][x])=="object"){
							Voption='<TR id="'+ String(i) + String(j) + String(x) +'" class="ClassOptMenSeco" onmouseover="onmouseovertd(this)"><TD class="OptionAlign" style="height:' + VHeiSec + 'px; width:' + (parseFloat(VMenu[i][2][j][2]) + Vpas - 12) + 'px;"';
				            Vimage= VMenUrl + "MenFle.GIF";
   							if(typeof(VMenu[i][2][j][1][x][1])=="string"){
								Voption +=' onmouseup="voirclick(this,\'' + VMenu[i][2][j][1][x][1] + '\')"'; // Construction Lien Hypertext
				                Vimage= VMenUrl + "MenVide.GIF";
							}
							Voption +='>' + VMenu[i][2][j][1][x][0] + '</TD>';
							Voption +='<TD><div align="right"><IMG src="' + Vimage + '"</div></TD>';				
							Voption +='</TR>';				
							document.write(Voption);
							HeightFrame+=VHeiSec;
						}else{
							Voption='<TR><TD colspan="2" class="LineSep"></TD></TR>';
							document.write(Voption);
							HeightFrame+=1;
						}
					}
					document.write('</TABLE></DIV>');
					document.getElementById("F"+ String(i) + String(j)).style.height= HeightFrame + "px";
				}
				VposVertical+= VHeiSec + HBorder-2;
			}else{
				VposVertical+= 1;
			}
		}
	}
	VposLeft += parseFloat(VMenu[i][1])+Vpas+Vcorv; //POSITION HORIZONTAL
}
/*CONSTRUCTION TROISIEME NIVEAU*/
VposLeft=VImgWidth + 1;
for (i=0;i<VMenu.length;i++){
	if(typeof(VMenu[i][2])=="object"){
		VposVertical= VposPrinc + 20 + Vcorv;
		for (j=0;j<VMenu[i][2].length;j++){
			if(typeof(VMenu[i][2][j])=="object"){
				if(typeof(VMenu[i][2][j][1])=="object"){
					VposVerticalSMenu=VposVertical;
					for (x=0;x<VMenu[i][2][j][1].length;x++){
						if(typeof(VMenu[i][2][j][1][x])=="object"){
							if(typeof(VMenu[i][2][j][1][x][1])=="object"){
								HeightFrame  = 0
								document.write('<IFRAME id="F'+ String(i) + String(j) + String(x) +'" src="about:blank" scrolling="no" frameborder="0" style="position:absolute; visibility:hidden; z-index:3; width:' + (parseFloat(VMenu[i][2][j][1][x][2]) + Vpas) + 'px; top:' + (VposVerticalSMenu + 2) + 'px; left:' + (VposLeft + parseFloat(VMenu[i][3])+ parseFloat(VMenu[i][2][j][2]) + 2*Vpas + 2*Vcorv) + 'px; height:0px"></IFRAME>');
								document.write('<DIV id="T'+ String(i) + String(j) + String(x) +'" style="position:absolute; visibility:hidden; z-index:3; width:' + (parseFloat(VMenu[i][2][j][1][x][2]) + Vpas) + 'px; top:' + (VposVerticalSMenu + 2) + 'px; left:' + (VposLeft + parseFloat(VMenu[i][3])+ parseFloat(VMenu[i][2][j][2]) + 2*Vpas + 2*Vcorv) + 'px">');
								document.write('<TABLE class="ClassMenu" style="width:100%">');
								for (z=0;z<VMenu[i][2][j][1][x][1].length;z++){
									if(typeof(VMenu[i][2][j][1][x][1][z])=="object"){
										Voption='<TR id="'+ String(i) + String(j) + String(x) + String(z) + '" class="ClassOptMenSeco" onmouseover="onmouseovertd(this)"><TD class="OptionAlign" style="height:' + VHeiSec + 'px;"';
										Voption +=' onmouseup="voirclick(this,\'' + VMenu[i][2][j][1][x][1][z][1] + '\')"'; // Construction Lien Hypertext
										Voption +='>' + VMenu[i][2][j][1][x][1][z][0] + '</TD>';
										Voption +='</TR>';				
										document.write(Voption);
										HeightFrame+=VHeiSec;
									}else{
										Voption='<TR><TD class="LineSep"></TD></TR>';
										document.write(Voption);
										HeightFrame+=1;
									}
								}
								document.write('</TABLE></DIV>');
								document.getElementById("F"+ String(i) + String(j) + String(x)).style.height= HeightFrame + "px";
							}
							VposVerticalSMenu+= VHeiSec + HBorder+2;
						}else{
							VposVerticalSMenu+= 1;
						}
					}
				}
				VposVertical+= VHeiSec + HBorder - 2;
			}else{
				VposVertical+= 1;
			}
		}
	}
	VposLeft += parseFloat(VMenu[i][1])+Vpas+Vcorv; //POSITION HORIZONTAL
}
