prechargement(); 

//active la feuille de style dynamique
//document.getElementsByTagName("link")[0].href="menu_JS.css";

window.onload=function()
{
	menu_deroulant("menu_h",600); 
}

menu_deroulant = function(idMenu,delai) 
{
	masque=0;
	mu=document.getElementById(idMenu);
	dls = mu.getElementsByTagName("dl");
	dds = mu.getElementsByTagName("dd");
	
	var couleurstitres = {"adherer": "E8B2B2", "secteurs": "B8B5B3", "salaires": "A4B7C8", "infos": "A4C3EA", "btp": "DDC1AD",
								"organisation": "DBC8A4", "formations": "F1CCAB"};
	
	for(var i=0;i<dls.length;i++) 
	{
		dls[i].getElementsByTagName("dt")[0].onmouseover=function()
		{
			photo(this.className, 1);
		}
	
	    if(dls[i].getElementsByTagName("dd")[0])
	    {
            dls[i].onmouseover=function()
		    {
		        titre = this.getElementsByTagName("dt")[0];
				titre.firstChild.style.color = "#"+couleurstitres[titre.className];
		    
			    clearTimeout(masque);
				masque_menus();
				this.getElementsByTagName("dd")[0].style.display="block";
			}  
 
              				
			dls[i].onmouseout = function()
			{				  
				titre = this.getElementsByTagName("dt")[0];
				photo(titre.className, 0);
				titre.firstChild.style.color = "#FFFFFF";
				
				if(delai)
				    masque=setTimeout('masque_menus()',delai);				
            }
            			
        }
		else
		{
			dls[i].firstChild.onmouseout=function()
			{
				photo(this.className, 0);
			}				
		} 
    }  
	
	document.onclick=masque_menus;
}



function photo(nom, action)
{
	img = document.getElementById(nom);
	if( action == 1)
		url = nom+"_on";
	else
		url = nom;
	
	img.style.backgroundImage = "url(images/interf/banniere/pictos/"+url+".jpg)";
}



function masque_menus()
{
    dds = document.getElementById("menu_h").getElementsByTagName("dd");
    
    for(var j=0;j<dds.length;j++)
        dds[j].style.display="none";     
}


function prechargement() {

	chemin = "images/interf/";
	
	document.image_chargee = new Array();
	liste_images = new Array();
	nb_images_chargees = 0;
	
	
/*	liste_images["logo/"] = new Array('logo.gif','bord_d.gif','bord_bas.gif','news_bord_d.gif','bord_arrondi.gif','fond_rep.gif');
	
	liste_images["recherche/"] = new Array('bt.gif','puce.gif');*/
	
	liste_images["banniere/pictos/"] = new Array('adherer.jpg','btp.jpg','formations.jpg','infos.jpg','organisation.jpg','salaires.jpg','secteurs.jpg',
					'adherer_on.jpg','btp_on.jpg','formations_on.jpg','infos_on.jpg','organisation_on.jpg','salaires_on.jpg','secteurs_on.jpg');
	
	liste_images["menu_h/"] = new Array('d_adherer.gif','g_adherer.gif','d_secteurs.gif','g_secteurs.gif','d_salaires.gif','g_salaires.gif',
								'd_infos.gif','g_infos.gif','d_btp.gif','g_btp.gif','d_organisation.gif','g_organisation.gif',
								'd_formations.gif','g_formations.gif');
								
	/*liste_images["menu_g/"] = new Array('fond_rep.gif','coin_bd.gif','coin_hd.gif','bt_fond_rep.gif','bt_bord.gif','bt_puce.gif');
	
	liste_images["echo/"] = new Array('bord_b.gif','coin_bd.gif','coin_titre.gif','couverture.gif','fond_menu_rep.gif','fond_titre_degrade.gif',
										'fond_titre_rep.gif','puce.gif');
										
	liste_images["breves/"] = new Array('coin_bg.gif','coin_titre.gif','fond_rep.gif','puce_breve.gif','puce_secteur.gif','puce_secteur_on.gif',
										'titre_fond_rep.gif');
										
	liste_images["contenu/"] = new Array('h2_fond_rep.gif','h2_bord_d.gif','h2_puce_haut.gif','news_bord_d.gif');
	
	liste_images["news/"] = new Array('fond_rep.gif','coin_hg.gif','coin_hd.gif','coin_bd.gif','coin_bg.gif','bord_h_rep.gif','bt_puce.gif',
									'bt_fond_rep.gif','bt_coin_d.gif');
									
	liste_images["news/"] = new Array('titre_fond_rep.gif','coin_d.gif');	*/

	for( dossier in liste_images )
	{
		for ( i = 0; i < liste_images[dossier].length; i++ )
		{
			document.image_chargee[nb_images_chargees] = new Image;
			document.image_chargee[nb_images_chargees].src = chemin + dossier + liste_images[dossier][i];
			nb_images_chargees++;
		}
	
	}
}


function open_popup(page, titre, width, height) { 
		
		params = 'directories=no, menubar=yes, location=no, toolbar=yes, status=no';
		
 		if( width != 0 )
 			params += ', scrollbars=no, resizable=no, width='+width+',height='+height;
 		else
 			params += ', scrollbars=yes, resizable=yes';

		open(page, '', params);		
}

