(function() {

    if (typeof (this.ModuleProgrammeEnLigne) == "undefined") {
        this.ModuleProgrammeEnLigne = {};
    }

    // Initialise l'accordeon représentant les plages horaires
    ModuleProgrammeEnLigne.InitializeTimeSlotAccordion = function() {
        dojo.addOnLoad(function() {
            var rootNode = "div.congres2009 div.sectionDetails";
            new cyim.dojo.widgets.Accordion({}, dojo.query(rootNode)[0]).startup();

            dojo.query(rootNode + " div.PlagehoraireUnselected").forEach(
                    function(tag) {
                        new cyim.dojo.widgets.AccordionPane({}, tag).startup();
                    }
                );

            dojo.query(rootNode + " div.PlagehoraireSelected").forEach(
                    function(tag) {
                        new cyim.dojo.widgets.AccordionPane({}, tag).startup();
                    }
                );
        });
    }

    // Switch l'affichage du moteur de recherche
    ModuleProgrammeEnLigne.SwitchRecherche = function() {
        var tagRechAvancee = dojo.byId('progRechAvancee');
        if (tagRechAvancee.style.display == 'block') {
            tagRechAvancee.style.display = 'none';
        } else {
            tagRechAvancee.style.display = 'block';
        }
    }

    // Lance une recherche
    ModuleProgrammeEnLigne.LaunchSimpleSearch = function() {
        alert("TODO");
    }

    // Lance une recherche
    ModuleProgrammeEnLigne.ChangeOrateur = function(selectTag) {
        var intIdIntervenant = selectTag.options[selectTag.selectedIndex].value;
        var lettre = document.progChampRechercheAdv.letter.value;
        var intAnnee = document.progChampRechercheAdv.intAnnee.value;

        document.location.href = '/14-conferenciers/les-conferenciers.asp?intAnnee=' + intAnnee + '&intervenant=' + intIdIntervenant + '&letter=' + lettre + '#listeRecherche';
    }
})();