/* menu eplorer par E.D Prod 1998
   etiennedeb@ifrance.com
   http://javascript-lab.nexen.net
*/

//
//
// Rendez vous a la fin du script pour la création du menu
//
var clevel=1;
var type;type = new Array();
var level;level = new Array();
var texte;texte = new Array();
var status;status = new Array();
var image;image = new Array();
var lien;lien = new Array();
var pere;pere = new Array();
var ok=0;var nb=1;var numpere=0;var Apere=0;var Alevel=1;var oldpere;oldpere = new Array();
var major = parseInt(navigator.appVersion);
var agent = navigator.userAgent.toLowerCase();
var ns = ((agent.indexOf('mozilla')!=-1) && ((agent.indexOf('spoofer')==-1) && (agent.indexOf('compatible') == -1)));
var ns4 = (ns && (major == 4));
//
// la cible par default, ici c'est la fenetre ou cadre courant
// si vous visez un cadre appelle 'cadre1' par exmple, la variable doit etre egale a ' top.cadre1 '
//
var Acible="parent.contenu";
var temp=0;
var ex_posx=5; // position absolue en x du menu
var ex_posy=200; // position absolue en y du menu

function ajouter(Anew,Atype,Atexte,Aimage,Alien) {
  if (Anew<0) {
  	numpere+=Anew;
  	if (numpere!=0) {
  	  Apere=oldpere[numpere];
 	    Alevel=level[Apere]+1;
  	}
  	else {
  	 Apere=0;numpere=0;Alevel=1;
  	}
  }
  if (Anew==1) {
	 Apere=0;numpere=0;Alevel=1;
  }
  type[nb]=Atype;
  level[nb]=Alevel;
  pere[nb]=Apere;
  status[nb]=0;
  texte[nb]=Atexte;
  image[nb]=Aimage;
  lien[nb]=Alien; 
  if (Atype==1) {oldpere[numpere]=Apere;Apere=nb;numpere+=1;Alevel+=1;}	
  nb+=1;
}

function verif(num){
 if (pere[num]!=0) {
  while (pere[num]!=0) {
   num=pere[num];
   if (status[num]==0) {ok=0;}
  }
 }
}

function excliquer(i) {
 if (lien[i]!="#") {
  chaine=Acible+".location.href='"+lien[i]+"';"
  eval(chaine);
 }
}

function AffExploMenu(){
 var y=0;
 for (var i = 1; i < texte.length; i++) {
 	CacherObj("explodiv"+i);
 }
 for (var i = 1; i < texte.length; i++) {
  ok=1;var nom="explodiv"+i;
  verif(i);
  if (ok==1) {
		PlacerObj(nom,ex_posx,ex_posy+y);VoirObj(nom);
		y+=16;
  }
 }
}

function bascule(numero) {
 status[numero]=1-status[numero];
 AffExploMenu();
}

function dessus(num) {
 if (!ns) {
  num.style.hover="#000000";
  num.style.cursor="hand";
 }
}
function dehors(num) {
 if (!ns) {
//  num.style.background="#0066CC";
  num.style.cursor="default";
 }
}

function CreerMenu(){
 var chaine = "";var saute=0;var niveau=1;var counter=0;
 for (var i = 1; i < texte.length; i++) {
   decalage="";special="";
   for (var j = 1; j < level[i]; j++) {
    if (j == level[i]-1) {
     decalage+="<img src='espacef.gif' align='top'>";}
    else {
     decalage+="<img src='espace.gif' align='top'>";}
   }
   if (type[i]==1) {
   	 special="onclick='bascule("+i+");return(false);' onmouseover='dessus(this);' onmouseout='dehors(this);'";
     if (ns4) {chaine="<layer name='explodiv"+i+"' width=300 height=16><nobr>"+decalage+"<font face='verdana' size=2><a href='#' "+special+"><img src='bouton.gif' border='0' align='top'>&nbsp;"+texte[i]+"</font></A></nobr></layer>";}
     else{chaine="<div id='explodiv"+i+"' class='explodiv' "+special+"><nobr>"+decalage+"<img src='bouton.gif' border='0' align='top'>&nbsp;"+texte[i]+"</nobr></div>";}
   }
   else if (type[i]==2){
   	special="onclick='excliquer("+i+");return(false);' onmouseover='dessus(this);' onmouseout='dehors(this);'";
   	if (ns4) {chaine="<layer name='explodiv"+i+"' width=300 height=16 "+special+"><nobr>"+decalage+"<font face='verdana' size=2><a href='#' "+special+">"}
   	else {chaine="<div id='explodiv"+i+"' class='explodiv' "+special+"><nobr>"+decalage}
   	if (image[i]=="") {
      chaine+="<img src='lien.gif' border='0' align='top'>&nbsp;"}
    else {
    	chaine+="<img src='"+image[i]+"' border='0' align='top'>&nbsp;"
    }
    if (ns4) {chaine+=texte[i]+"</font></A></nobr></layer>";}
    else {chaine+=texte[i]+"</nobr></div>";}
   }
   document.write(chaine);
 }
}

// *****************************************************************
// Les entrees du menu sont crees ici
//
// argument 1: si mis a 1 : retour a la racine du menu
//             si mis a -x : remonter de x branches
//	       si mis a 0 : aucun changement d'arborescence
// argument 2: type de l'entree, 1 pour un dossier, 2 pour un lien
// argument 3: texte qui apparaitra dans le menu
// argument 4: Icone associe (laisser vide si pas d'icone)
// argument 5: Lien associe
//

//ajouter(1,1,"Le groupe","","#");
   ajouter(1,1,"Delmonico-Dorel <br>","bouton.gif",'delmonico_dorel.htm');ajouter(0,2,"","",''); 
  
		   ajouter(0,2,"Bureau <br>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;d'Andancette<br>","fleche.gif",'bureaux_andancette.htm'); ajouter(0,2,"","",''); ajouter(0,2,"","",''); 
		   ajouter(0,2,"Carrière <br>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;d'Albon<br>","fleche.gif",'car_albon.htm'); ajouter(0,2,"","",''); ajouter(0,2,"","",''); 
		   ajouter(0,2,"Carrière de <br>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;Beauchastel<br>","fleche.gif",'car_beauchastel.htm'); ajouter(0,2,"","",''); ajouter(0,2,"","",''); 
  		   ajouter(0,2,"Carrière de<br>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; Borée<br>","fleche.gif",'car_boree.htm'); ajouter(0,2,"","",''); ajouter(0,2,"","",''); 
		   ajouter(0,2,"Carrière de<br>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; St Julien-<br>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;Molin-Molette<br>","fleche.gif",'car_st-julien-molin-molette.htm'); ajouter(0,2,"","",''); ajouter(0,2,"","",''); ajouter(0,2,"","",''); 
		   ajouter(0,2,"Plateforme<br>&nbsp; &nbsp; &nbsp; &nbsp; Multimodale <br>&nbsp; &nbsp; &nbsp; &nbsp; Sablons<br><br>","fleche.gif",'car_sablon.htm'); ajouter(0,2,"","",''); ajouter(0,2,"","",''); 

   ajouter(-1,1,"DDF béton ","bouton.gif",'albon-prefa.htm');
   ajouter(0,2,"Centrale et <br>&nbsp; &nbsp; &nbsp; &nbsp;bureaux(Tence)<br>","fleche.gif",'ddf-beton-tence.htm');ajouter(0,2,"","",''); ajouter(0,2,"","",''); 
  			ajouter(0,2,"Centrale à <br>&nbsp; &nbsp; &nbsp; &nbsp; béton <br>&nbsp; &nbsp; &nbsp; &nbsp;(Puy-en-Velay)<br>","fleche.gif",'ddf-beton-le-puy.htm'); ajouter(0,2,"","",''); ajouter(0,2,"","",''); ajouter(0,2,"","",''); 
			ajouter(0,2,"Béton service<br> &nbsp; &nbsp; &nbsp; &nbsp; Le Cheylard<br><br>&nbsp; &nbsp; &nbsp; &nbsp;","fleche.gif",'beton-service.htm');ajouter(0,2,"","",''); ajouter(0,2,"","",''); ajouter(0,2,"","",''); 
   ajouter(-1,2,"Albon Préfa <br>","fleche.gif",'albon-prefa.htm'); ajouter(0,2,"","",''); 
   //ajouter(0,2,"Romanat TP<br>","fleche.gif",'romanat-tp.htm'); ajouter(0,2,"","",''); 
   ajouter(0,2,"DDM<br>","fleche.gif",'ddm.htm'); ajouter(0,2,"","",''); 
   ajouter(0,2,"Adimat Gedimat<br>","fleche.gif",'adimat-gedimat.htm'); ajouter(0,2,"","",''); 
   ajouter(0,2,"Granutrans<br>","fleche.gif",'granutrans.htm'); ajouter(0,2,"","",''); 
   ajouter(0,2,"MIC<br>","fleche.gif",'mic.htm'); ajouter(0,2,"","",''); 

//ajouter(1,2,"Les sites","bouton.gif",'sites.htm'); 

//ajouter(1,2,"Pages occasions","bouton.gif",'accueil_materiel.htm'); 

// construction du menu, rien a changer ici
CreerMenu();
