   function Liste_Modules(formulaire, champ, champ_id, page, width, height, type_sql, nbre, nbre2, champ_restrict, check, un_titre) {
		var controle = eval('document.' + formulaire + '.' + champ_id);
		var modules = controle.value;
		var params = 'width=' + width + ', height=' + height + ',scrollbars=yes';
				
		var lien = page + '?liste_modules=' + modules + '&champ1=' + champ + '&form=' + formulaire + '&champ2=' + champ_id + '&type_sql=' + type_sql + '&nbre_col=' + nbre + '&nbre_clics=' + nbre2 + '&check=' + check+ '&le_titre=' + un_titre;
		if(champ_restrict) {
		  var tab = champ_restrict.split('::');
		  if(tab.length>1) champ_restrict = tab[0]
		  var controle = eval('document.' + formulaire + '.' + champ_restrict + '_id');
		  if(controle==undefined) controle = eval('document.' + formulaire + '.' + champ_restrict);
		  var modules = controle.value;

		  if(modules) {
		    if(tab[1]) modules = modules + '::' + tab[1];
		    lien = lien + '&valeur_restrict=' + modules;
		  }	
		}
	    OpenPop(lien, 'popinit', params);
    }
    
	function OpenPop(page,nom,option) {
         window.open(page,nom,option);
    }
		
			
		function Cocher(elmt, Nbre) {
				       var ok = 0;
				 var champ = eval(elmt);
				 
				 if(Nbre>1) {
				           for (var i=0; i < champ.length; i++){
				            if(champ[i].checked) ok = 1;
				           }
				 }
				 else if(champ.checked) ok = 1;
				 if(ok==0) return false;
				 else return true;
        }
		
		function Valeur_Options(elmt, Nbre, elmt2) {
				 var champ = eval(elmt);
				 var champ2 = eval(elmt2);
				 var aux = '';
				 
				 if(Nbre>1) {
				   for (var i=0; i < champ.length; i++){
				     if(i) aux  += '::';
				     if(champ[i].checked) aux += champ[i].value;
				     else aux += '';
				   }
				 }
				 else {
				  if(champ.checked) aux = champ.value;
				  else aux = '';
				 } 
				 champ2.value = aux;
				 //alert(aux);
        }
		
		function Valeur_Radio(elmt, Nbre, elmt2) {
				       //var ok = 0;
				 var champ = eval(elmt);
				 var champ2 = eval(elmt2);
				 var aux = '';
				 
				 if(Nbre>1) {
				           for (var i=0; i < champ.length; i++){
				            if(champ[i].checked) aux += champ[i].value;
				           }
				 }
				 else if(champ.checked) aux += champ.value;
				 champ2.value = aux;
				 //alert(aux);
        }
		
		function Elmt_Over(elmt, classe) {
		  elmt.className = classe;  
		}
		
function Over_Menu(fils, type) {
    var objet = fils;//fils.parentNode;
    var classe = objet.className;
	if(classe != 'item current') {
	  classe = str_replace( ' over', '', classe);
	  if(type == 1) classe += ' over';
	}
	/*else {
	  //classe = str_replace( ' current', '', classe);
	  if(type == 1) classe += ' over';
	  else classe += ' current';
	}*/
	 objet.className = classe;
}

function str_replace( sujet, remplacant,chaine) {
  position = chaine.indexOf(sujet);
  retour = '';
  if (position == -1) return chaine;
  retour += chaine.substring(0,position) + remplacant;
  if ( position + sujet.length < chaine.length)
    retour += str_replace( sujet, remplacant,chaine.substring(position + sujet.length, chaine.length));
  return retour;
}

function Liste_Filiale_Gauche(aff){
 //if(aff) O('corp_liste_filiale').style.left
 //alert(O('bg_liste').style.left);
 O('corp_liste_filiale').style.display = (aff)?'block':'none';
}

//Get all the elements of the given classname of the given tag.
	function getElementsByClassName(classname,tag) {
		if(!tag) tag = "*";
		var anchs =  document.getElementsByTagName(tag);
		var total_anchs = anchs.length;
		var regexp = new RegExp('\\b' + classname + '\\b');
		var class_items = new Array()
		
		for(var i=0;i<total_anchs;i++) { //Go thru all the links seaching for the class name
			var this_item = anchs[i];
			if(regexp.test(this_item.className)) {
				class_items.push(this_item);
			}
		}
		return class_items;
	}

function Menus_Filiales(objet){
  tab = getElementsByClassName('deplie', '');
  for(var i=0;i<tab.length;i++) tab[i].className = 'plie'; 
  objet.parentNode.className = (objet.parentNode.className == 'plie')?'deplie':'plie';
}
function Menus_Active(objet){
  tab = getElementsByClassName('active', '');
  for(var i=0;i<tab.length;i++) tab[i].className = ''; 
  objet.className = 'active';
}
