var global_Formulaire = "";
var global_Visibilite = "";
var global_Selects    = new Array();

function afficheObjet(indexObj) {
    for (i=1; i<=6; i++){
        setIdProperty( 'rolMGE' + i , 'display', 'none' );
    }
    setIdProperty( 'rolMGE' + indexObj, 'display', 'block' );
    modifierVisibiliteSelect(global_Formulaire,"hidden");
}
    
function masquer() {
    for (i=1; i<=6; i++){
        setIdProperty( 'rolMGE' + i , 'display', 'none' );
    }
    modifierVisibiliteSelect(global_Formulaire,"visible");
}

// Fonction afficher/masquer un bloc
// selon son état et modifie le fond de l’élément parent
function swapMenu(selectedItem, indexMenu){

    ObjectState = getIdProperty(indexMenu, 'display');

    if (ObjectState != 'block') {
        setIdProperty(indexMenu, 'display', 'block' );
        setIdProperty(selectedItem, 'background', '#00b2ed' );
    } else {
        setIdProperty(indexMenu, 'display', 'none' );
        setIdProperty(selectedItem, 'background', '#00b2ed' );
    }
}

function chercherSelect(idFormulaire)
{
	global_Selects = new Array();
	if (idFormulaire != "")
	{
		objetFormulaire = document.getElementById(idFormulaire);
		nombreElements = objetFormulaire.all.length;
		elementCourant = 0;
		while (elementCourant < nombreElements)
		{
			if (objetFormulaire.all[elementCourant].tagName.toUpperCase()=="SELECT")
			{
				global_Selects[global_Selects.length] = elementCourant;
			}
			elementCourant++;
		}
	}
}

// Recherche tous les objets SELECT du formulaire donn? et change le style visibility
function modifierVisibiliteSelect(idFormulaire, visibilite)
{
	if (idFormulaire != "" && global_Visibilite!=visibilite)
	{
		global_Visibilite = visibilite;
		objetFormulaire = document.getElementById(idFormulaire);
		nombreElements = global_Selects.length; //objetFormulaire.all.length;
		elementCourant = 0;
		while (elementCourant < nombreElements)
		{
			//if (objetFormulaire.all[elementCourant].tagName.toUpperCase()=="SELECT")
			//{
			//	objetFormulaire.all[elementCourant].style.visibility=visibilite;
			//}
			objetFormulaire.all[global_Selects[elementCourant]].style.visibility=visibilite;
			elementCourant++;
		}
	}
}