function popup(url,width,height) { javascript:window.open(url,'','left=0,top=0,width='+width+',height='+height+',scrollbars=yes,resizable=yes,titlebar=no,toolbar=no,menubar=no,directories=no,status=no'); } function printWindow(){ bV = parseInt(navigator.appVersion) if (bV >= 4) window.print() } function checkDate(d,current_year) { // Cette fonction vérifie le format JJ/MM/AAAA saisi et la validité de la date. // Le séparateur est défini dans la variable separateur var amin=1915; // année mini var amax=current_year; // année maxi var separateur="/"; // separateur entre jour/mois/annee var j=(d.substring(0,2)); var m=(d.substring(3,5)); var a=(d.substring(6)); var ok=1; if ( ((isNaN(j))||(j<1)||(j>31)) && (ok==1) ) { alert("Date de naissance : Le jour n'est pas correct."); ok=0; } if ( ((isNaN(m))||(m<1)||(m>12)) && (ok==1) ) { alert("Date de naissance : Le mois n'est pas correct."); ok=0; } if ( ((isNaN(a))||(aamax)) && (ok==1) ) { alert("Date de naissance : L'année n'est pas correcte."); ok=0; } if ( ((d.substring(2,3)!=separateur)||(d.substring(5,6)!=separateur)) && (ok==1) ) { alert("Date de naissance : Les séparateurs doivent être des "+separateur); ok=0; } if (ok==1) { var d2=new Date(a,m-1,j); j2=d2.getDate(); m2=d2.getMonth()+1; a2=d2.getFullYear(); if (a2<=100) {a2=1900+a2} if ( (j!=j2)||(m!=m2)||(a!=a2) ) { alert("Date de naissance : La date "+d+" n'existe pas !"); ok=0; } } if (ok == 0) { document.inputform["fields[date_naissance]"].value = ""; } return ok; } function checkForm() { var swt = 0; msg = ""; var reg = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]{2,}[.][a-z]{2,4}$/; if (document.inputform["fields[civilite]"].value == 0) { msg += "Votre civilité\n"; swt = 1; } if (document.inputform["fields[parcour]"].value == 0) { msg += "Votre parcours\n"; swt = 1; } if (document.inputform["fields[nom]"].value == "") { msg += "Votre nom\n"; swt = 1; } if (document.inputform["fields[prenom]"].value == "") { msg += "Votre prénom\n"; swt = 1; } /* datenaissance = checkDate(document.inputform["fields[date_naissance]"].value); if (datenaissance == 0) { msg += "Votre date de naissance\n"; swt = 1; } */ if (document.inputform["date_naissance[jour]"].value == 0 || document.inputform["date_naissance[mois]"].value == 0 || document.inputform["date_naissance[annee]"].value == 0) { msg += "Votre date de naissance\n"; swt = 1; } if (document.inputform["fields[adresse]"].value == "") { msg += "Votre adresse\n"; swt = 1; } if (document.inputform["fields[cp]"].value == "") { msg += "Votre code postal\n"; swt = 1; } if (document.inputform["fields[ville]"].value == "") { msg += "Votre ville\n"; swt = 1; } if (document.inputform["fields[telephone]"].value == "") { msg += "Votre téléphone\n"; swt = 1; } if (document.inputform["fields[email]"].value == ""){ msg += "Email \n"; swt = 1; } else if (reg.exec(document.inputform["fields[email]"].value) == null){ msg += "Votre adresse e-mail est invalide \n"; swt = 1; } if (document.inputform["fields[categorie]"].value == 0) { msg += "Votre catégorie\n"; swt = 1; } if (document.inputform["fields[federation]"].value == 0) { msg += "Votre fédération\n"; swt = 1; } if (document.inputform["fields[club]"].value == "") { msg += "Votre club\n"; swt = 1; } if (document.inputform["code"].value == "") { msg += "Code de l'image\n"; swt = 1; } if (swt == 1){ alert("Vous n'avez pas renseigné les informations suivantes : \n\n" + msg); return false; } else { document.inputform.submit(); } } function calculPrix() { parcour = document.inputform['fields[parcour]'].value; federation = document.inputform['fields[federation]'].value; civilite = document.inputform['fields[civilite]'].value; mt_a_payer = 0; prix_grand_parcour = new Array(); prix_moyen_parcour = new Array(); prix_petit_parcour = new Array(); var engagement = new Array(); prix_grand_parcour[1] = 25; prix_grand_parcour[2] = 26; prix_grand_parcour[3] = 27; prix_moyen_parcour[1] = 20; prix_moyen_parcour[2] = 21; prix_moyen_parcour[3] = 22; prix_petit_parcour[1] = 6; prix_petit_parcour[2] = 12; repas_acc = 9; //engagement["federation"]["parcour"] //FFC = 1 engagement[1] = new Array(); engagement[1][1] = prix_grand_parcour[1]; engagement[1][2] = prix_moyen_parcour[1]; //UFOLEP = 2 engagement[2] = new Array(); engagement[2][1] = prix_grand_parcour[2]; engagement[2][2] = prix_moyen_parcour[2]; //FFCT = 3 engagement[3] = new Array(); engagement[3][1] = prix_grand_parcour[3]; engagement[3][2] = prix_moyen_parcour[3]; //Autre = 4 engagement[4] = new Array(); engagement[4][1] = prix_grand_parcour[2]; engagement[4][2] = prix_moyen_parcour[2]; //Non licencié = 5 engagement[5] = new Array(); engagement[5][1] = prix_grand_parcour[3]; engagement[5][2] = prix_moyen_parcour[3]; //FFT = 6 engagement[6] = new Array(); engagement[6][1] = prix_grand_parcour[2]; engagement[6][2] = prix_moyen_parcour[2]; if (document.inputform["fields[repas_acc]"].checked == true) { repas = repas_acc * document.inputform["fields[qte_repas_acc]"].value; } else { repas = 0; } if ((parcour == 1 || parcour == 2) && federation != 0) { if (engagement[federation][parcour] != undefined || engagement[federation][parcour] != "") { mt_a_payer = engagement[federation][parcour] + repas; } else { mt_a_payer = 0 + repas; } } else { switch(parcour) { case "3": mt_a_payer = prix_petit_parcour[1] + repas; break; case "4": mt_a_payer = prix_petit_parcour[2] + repas; break; } } //Réduction pour les féminines if ((civilite == 2 || civilite == 3) && mt_a_payer) { mt_a_payer = mt_a_payer - 2; } if (mt_a_payer) { document.inputform["fields[montant_a_payer]"].value = mt_a_payer; document.getElementById("montant_a_payer").innerHTML = "Le montant à régler est de " + mt_a_payer +"€"; } } function detectFederation(federation) { switch(federation) { case "5": document.inputform["fields[club]"].value = "Sans club"; break; default: document.inputform["fields[club]"].value = ""; break; } }