function bindForm() {
    new Ajax.Autocompleter(
        'txtCpCourrier', 
        'autocomplete_choix_cp', 
        '/lib/ajax/rechercheCP.php', 
        {
            paramName: 'cp',
            indicator: 'spinnerCodePostal',
            minChars: 3,
            afterUpdateElement: determinerVille,
            autoSelect: true
        }
    );
            
    Event.observe('lstFamille', 'change', rechercherDiscipline, false);
    new Validation('fCotisationNew');
}        
        
function determinerVille() {
    new Ajax.Updater(    // 'recapitulatifBenevoles' + type,
        'tdVille', 
        '/lib/ajax/determinerVille.php', 
        {
            postBody: $H({ cp: $F('txtCpCourrier')}).toQueryString()
        }
    );    
}
        
function rechercherDiscipline() { 
    new Ajax.Updater( // 'recapitulatifBenevoles' + type,
        'tdDiscipline', 
        '/lib/ajax/rechercheDiscipline.php', 
        {
            postBody: $H({idFamille: $F('lstFamille')}).toQueryString()
        }
    );
}
        
Event.observe(window, 'load', bindForm);


