// Script réalisé par Tout JavaScript.com

    // Fonction d'extraction des paramètres
    function TJSExtraireParam() {
        var url = new String (window.location.href);
        var exp=new RegExp("[&?]+","g");
        var exp2=new RegExp("[=]+","g");
        var tabNom=url.split(exp);
        var tabParam=new Array();
        if (tabNom!=null) {
            for (var i=1;i<tabNom.length;i++){
                var tabTemp=tabNom[i].split(exp2);
                tabParam[tabTemp[0]]=tabTemp[1];
            }
        }
        return tabParam;
    }

    // Pour rendre une chaîne fixe
    function SetLen (Chaine, NouvLg, Remplissage) {
       if (typeof Remplissage == "undefined") {   // Paramètre optionnel
         Remplissage = " ";
       }
       if (Chaine.length >= NouvLg) {
           return Chaine.substr (Chaine, 0, NouvLg);    // Tronque
       } else {
           var Ch = new String  (Chaine);
           while (Ch.length < NouvLg) {
             if (Remplissage <= "9") {
               Ch = Remplissage + Ch;
             } else {
                 Ch = Ch + Remplissage;
             }
           }
           return Ch;
       }
    }

    // Objet Date, création
    function ODate () {
        this.LaDate = new Date();
        this.RecalDate = function (NouvDate) {
            NomsJSem = ["Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"];
            NomsMois = ["Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août",
                   "Septembre", "Octobre", "Novembre", "Décembre"];
            if (typeof NouvDate != "undefined") {   // Paramètre optionnel
              this.LaDate.setFullYear (NouvDate.substr (0, 4),
                 NouvDate.substr (4,2) - 1, NouvDate.substr (6,2));
            }
            this.JourSem = this.LaDate.getDay();
            this.NomJSem = NomsJSem [this.JourSem];
            this.Mois = this.LaDate.getMonth() + 1;
            this.NomMois = NomsMois [this.Mois - 1];
            this.Jour = this.LaDate.getDate();
            this.JJ = SetLen (this.Jour, 2, "0");
            this.MM = SetLen (this.Mois, 2, "0");
            this.Annee = this.LaDate.getFullYear();

        }         // 24 * 3600 * 1000 = 86400000
        this.AjJour = function (jours) {    // Ajoute n jours
          this.LaDate.setTime (this.LaDate.getTime() + jours * 86400000);
          this.RecalDate();
        }
        this.DimProch = function () {
          this.LaDate.setTime (this.LaDate.getTime() + (7 - this.LaDate.getDay()) % 7 * 86400000);
          this.RecalDate();
        }

        this.RecalDate ();
    }


var Auj = new ODate();

    // Appel de la fonction et création du tableau des paramètres
    var urlParam = TJSExtraireParam();

    if (urlParam["Dim"]=="1") {               // Si paramètre comme quoi qu'on doit aller à dimanche
          Auj.DimProch ();
    } else {
      var Dte = new String (urlParam ["Date"]);
      if (Dte.length == 8) {
        Auj.RecalDate(Dte);
      }
    }
