var all_SUBMIT = [ {text:"Abandon, retour a l'acceuil", link:"npb_page_centre.php?page=accueil"}, {text:"Mettre a jour maintenant", link:"npb_page_centre.php?page=insc_db_add"}, {text:"Terminer l'inscription", link:"npb_page_centre.php?page=insc_db_add"} ]; function updateBT_SUBMIT(i_SUBMIT) { document.getElementById("LB_SUBMIT").textContent = all_SUBMIT[i_SUBMIT].text; document.fm_insc_db_chk.action = all_SUBMIT[i_SUBMIT].link; } function copypwd() { document.fm_user_saisie.tf_repwd.value=document.fm_user_saisie.tf_pwd.value; } function validateFields() { var obj, msg=''; var err = null; var fm = null; // test des zones du formulaire d'inscription des utilisateurs ============= if (fm=document.fm_user_saisie) { fm.hid_niveau.value = fm.tf_niveau.value; obj = fm.tf_pseudo; if (!obj.value) { msg += "Le pseudo est obligatoire !\n"; if (!err) err = obj; } obj = fm.tf_pwd; if (!obj.value) { msg += "Le mot de passe est obligatoire !\n"; if (!err) err = obj; } obj = fm.tf_repwd; if (obj.value != fm.tf_pwd_copy.value) { msg += "Le mot de passe doit être répété !\n"; if (!err) err = obj; } } // test des zones du formulaire d'inscription au tournoi =================== if (fm=document.fm_insc_saisie) { obj = fm.tf_nom; if (!obj.value) { msg += "Le nom est obligatoire !\n"; if (!err) err = obj; } obj = fm.lb_age; if (!obj.value) { msg += "L'âge est obligatoire !\n"; if (!err) err = obj; } if (fm.cb_participe.checked) { obj = fm.lb_niveau; if (obj.value == -100) { msg += "Le niveau est obligatoire !\n"; if (!err) err = obj; } obj = fm.lb_club; if (!obj.value) { msg += "Le club est obligatoire !\n"; if (!err) err = obj; } } } if (err != null) { alert(msg); err.focus(); return false; } return true; } function setSL_CLUBEnabled(slt) { with (document.fm_insc_saisie){ sls=[SL_CLUB1, SL_CLUB2, SL_CLUB3, SL_CLUB4, SL_CLUB5]; for(i = 0; i < sls.length; i++) { if (i == slt - 1) { sls[i].style.visibility="visible"; } else { sls[i].style.visibility="hidden"; } } } } function field_changed(){ with (document.fm_insc_saisie){ var l_age = lb_age.value; var l_participe = cb_participe.checked; var l_niveau = lb_niveau.value; var l_sam_midi = cb_sam_midi.checked; var l_sam_soir = cb_sam_soir.checked; var l_dim_midi = cb_dim_midi.checked; var l_nuit_chambre =rd_nuit_chambre.checked; var l_nuit_tente = rd_nuit_tente.checked; var l_nuit_etoile = rd_nuit_etoile.checked; var l_cheque_oui = rd_cheque_oui.checked; var l_cheque_non = rd_cheque_non.checked; if (l_age == '') l_age = 18; /* Mise à jour des zones de saisie obligatoires */ if (l_participe) { document.getElementById("oblig_niveau").className='mandatory'; document.getElementById("oblig_club").className='mandatory'; }else{ document.getElementById("oblig_niveau").className=''; document.getElementById("oblig_club").className=''; } } /* initialisation du montant à payer */ var montant = 0; var s_decomposition = ''; /* tarif du tournoi lui-même -------------------------*/ if (l_participe) { if (l_age < 18 || l_niveau < -10) { montant += 8; s_decomposition += '8 € (J ou <10K)+'; }else{ montant += 15; s_decomposition += '15 € (Tournoi)+'; } } nb_repas = 0; if (l_sam_soir) nb_repas ++; if (l_dim_midi) nb_repas ++; /* Chambre -------------------------------------------*/ if (l_nuit_chambre) { /* Repas samedi midi */ if (l_sam_midi) { if (l_age < 12) { montant += 6; s_decomposition += '6 € (repas-J)+'; }else{ montant += 12; s_decomposition += '12 € (repas)+'; } } /* Autres repas */ if (nb_repas == 0) { // nuit seule montant += 12; s_decomposition += '12 € (nuit)+'; } if (nb_repas == 1) { // demi-pension montant += 25; s_decomposition += '25 € (demi-p)+'; } if (nb_repas == 2) { // pension if (l_age < 12) { montant += 25; s_decomposition += '25 € (pension-J)+'; }else{ montant += 35; s_decomposition += '35 € (pension)+'; } } } /* Tente ---------------------------------------------*/ if (l_nuit_tente) { /* pension-camping */ if (nb_repas == 2) { /* Repas samedi midi */ if (l_sam_midi) { if (l_age < 12) { montant += 6; s_decomposition += '6 € (repas-J)+'; }else{ montant += 12; s_decomposition += '12 € (repas)+'; } } montant += 25; s_decomposition += '25 € (pension-camp)+'; }else{ if (l_sam_midi) nb_repas++; if (nb_repas > 0) { if (l_age < 12) { montant += 6 * nb_repas; s_decomposition += (6 * nb_repas) + ' € ('+nb_repas+' repas-J)+'; }else{ montant += 12 * nb_repas; s_decomposition += (12 * nb_repas) + ' € ('+nb_repas+' repas)+'; } } montant += 5; s_decomposition += ' 5 € (camping)+'; } } /* Etoile --------------------------------------------*/ if (l_nuit_etoile) { if (l_sam_midi) nb_repas++; if (nb_repas > 0) { if (l_age < 12) { montant += 6 * nb_repas; s_decomposition += (6 * nb_repas) + ' € ('+nb_repas+' repas-J)+'; }else{ montant += 12 * nb_repas; s_decomposition += (12 * nb_repas) + ' € ('+nb_repas+' repas)+'; } } } /* majoration pour paiement sur place ----------------*/ if (!l_cheque_oui && montant > 0){ montant += 2; s_decomposition += '2 € (majoration)+'; } /* montant nul ---------------------------------------*/ if (montant == 0){ s_decomposition += 'Venir de si loin que pour pinter... ça finira tout de même par faire cher...+'; } s_decomposition = s_decomposition.substring(0, s_decomposition.length - 2); document.getElementById("montant").innerHTML = montant + ' €'; document.getElementById("hid_montant").value = montant; document.getElementById("decomposition").innerHTML = s_decomposition; } function dump(){ obj=document.forms[0].elements; s = 'DUMP ' + document + '

'; for (i=0 ; i < obj.length ; i++){ s+= i + obj[i] + ': '; atts = obj[i].attributes; for (j=0 ; j < atts.length ; j++) { s+= j + ' ' + atts[j].name + '='+atts[j].value + ' | '; } s+= 'value='+obj[i].value + ' | '; s+= '
'; } document.write(s); return false; }