// Seitosei - Menu.js JavaScript Document
// © Cameleo
// http://www.cameleo-design.fr
	
addListener(window,'load',setMenuDeroul,false);

function setMenuDeroul() { menuDeroulant.init(); }

var menuDeroulant = {
	
	init : function() {
		this.hideAllDD();
		this.hideAllUL();
	},
	
	getAllDD : function() {
		/* DD's de premier niveau */
		return $("deroulseitosei","deroulmetiers","deroulpdv","deroulfocus");
	},
	
	getAllUL : function() {
		/* UL's de second niveau */
		return $("deroul1_cso","deroul2_ev","deroul3_co","deroul4_gr");
	},
	
	nbDD : 4 ,
	nbUL : 4 ,
	regExp : function() {
		return new RegExp("(deroul)", "g"); // #deroulNom -> #navNom
	},
	
	hideAllDD : function() {
		var ddTab = this.getAllDD();
		for(var i=0; i<this.nbDD; i++)
			ddTab[i].style.display = 'none';
	},
	
	hideAllUL : function() {
		var ulTab = this.getAllUL();
		for(var i=0; i<this.nbUL; i++)
			ulTab[i].style.display = 'none';
	},
	
	setUL : function(id) {
		this.hideAllUL();
		var eUL = $(id);
		eUL.style.display = (eUL.style.display == 'none' ) ? 'block' : 'none' ;
	},
	
	deroule : function(id) {
		$(id).style.display = 'block'; // Affiche <dd> le menu déroulant en question
		$(id.replace(this.regExp(),"nav")).style.backgroundPosition =  '0px -36px'; // Maintient effet RollOver sur le lien
	},
	
	cache : function(id) {
		$(id).style.display = 'none';
		$(id.replace(this.regExp(),"nav")).style.backgroundPosition =  '0 0';
	}
};
		
		
		

