FIX Some syntax error
[cl7.git] / js / cl7.js
index 61a82a7..57766d1 100644 (file)
--- a/js/cl7.js
+++ b/js/cl7.js
@@ -43,13 +43,17 @@ cl7.verification_formulaire_inscription = function(util) {
    return true;
 };
 
-cl7.maj_prix_inscription = function() {
-   var nbPeriodes = $('#formulaireInscription input[name="periodes[]"]:checked').length;
+cl7.maj_prix_inscription = function() {\r
+   var prixTotal = (int)($('meta[name="cout_total"]').attr('content'));\r
+   var prixPeriode = (int)($('meta[name="cout_periode"]').attr('content'));\r
+   var nbPeriodesTotal = (int)($('meta[name="nb_periodes"]').attr('content'));\r
+   var nbPeriodesCheck = (int)($('#formulaireInscription input[name="periodes[]"]:checked').length);
+   \r
    var prix = 5;
-   if (nbPeriodes === 3) {
-      prix = 40;
-   } else if (nbPeriodes != 0) {
-      prix = 15 * nbPeriodes;
+   if (nbPeriodesCheck === nbPeriodesTotal) {
+      prix = prixTotal;
+   } else if (nbPeriodesCheck != 0) {
+      prix = prixPeriode * nbPeriodesCheck;
    }
    $('#formulaireInscription span#prix').html(prix.toString());   
 };
@@ -77,11 +81,11 @@ $(document).ready(
       \r
       // inscrit les emails codés (page contacts)\r
       $('a#contactPifou').attr('href', util.rot13('znvygb:tert.oheev@tznvy.pbz'));
-      $('a#contactLePiaf').attr('href', util.rot13('znvygb:tyrcvns695@zfa.pbz'));
+      $('a#contactLePiaf').attr('href', util.rot13('znvygb:yrcvns695@zfa.pbz'));
       
-      /*$('#formulaireInscription input[name="periodes[]"]').change(function() {
+      $('#formulaireInscription input[name="periodes[]"]').change(function() {
          cl7.maj_prix_inscription();         
-      });*/
+      });
       // met à jour le prix d'inscription
       cl7.maj_prix_inscription();\r
       \r