var min_day = 1, max_day = 31, month = "Gennaio ,Febbraio ,Marzo ,Aprile ,Maggio ,Giugno ,Luglio ,Agosto ,Settembre ,Ottobre ,Novembre ,Dicembre ".split(","), min_year = 2E3, max_year = min_year + 10, nbJours = 7; function leMois(c, e, f) { c = c < f.getMonth() ? f.getYear() + 1 : f.getYear(); 1900 > c && (c += 1900); return e + c }
function verifier_date_sejours(c, e, f, d) {
    var a = c.selectedIndex + 1, b = e.options[e.selectedIndex].value, g = e.options[e.selectedIndex].text, j = g.indexOf(" "), g = g.substring(j, g.length); if (2 == b) if (0 == g % 4) { if (29 < a) c.selectedIndex = 28 } else { if (28 < a) c.selectedIndex = 27 } else { if (7 > b) var h = 0; else 8 < b && (h = 1); if ((7 > b || 8 < b) && b % 2 == h && 29 < a) c.selectedIndex = 29 } f.value = g; d.value = c.options[c.selectedIndex].value + "/" + e.options[e.selectedIndex].value + "/" + g; d = e.options[e.selectedIndex].value + "/" + c.options[c.selectedIndex].value +
"/" + g; if ("DEPART_DD_H" == c.name && "DEPART_MM_H" == e.name) { c = c.selectedIndex + 1; e = e.options[e.selectedIndex].value - 1; a = f.value; b = Ajout_date(c, e, a, nbJours); document.moteurp.RETOUR_DD_H.selectedIndex = b.getDate() - 1; for (h = 0; 11 >= h; h++) if (document.moteurp.RETOUR_MM_H.options[h].value == b.getMonth() + 1) var k = h; document.moteurp.RETOUR_MM_H.selectedIndex = k; document.moteurp.RETOUR_YYYY_H.value = b.getYear(); Afficher_Jour_Aller_Sejours(c, e, a); Afficher_Jour_Retour_Sejours(b.getDate(), b.getMonth(), f.value) } else c = c.selectedIndex +
1, e = e.options[e.selectedIndex].value - 1, a = f.value, Afficher_Jour_Retour_Sejours(c, e, a); sjour = GetTodayName(d)
} function Ajout_date(c, e, f, d) { for (var a = [], b = 0; 6 >= b; b++) a[b] = b % 2 ? 30 : 31; for (b = 7; 11 >= b; b++) a[b] = b % 2 ? 31 : 30; a[1] = f % 4 ? 28 : 29; for (c += d; c > a[e] && !(c -= a[e], e++, 12 == e); ); 12 == e ? (f++, c--, a = Ajout_date(1, 0, f, c)) : a = new Date(f, e, c); return a }
function saisie_date(c, e, f, d, a, b, g) {
    b = new Date(b); a = new Date(a); document.write("<select class='input1' name='" + c + "' style='width:40px; color:#000000; font-size: 10px; font-family: Trebuchet; font-weight: normal;' OnChange='verifier_date_sejours(form." + c + ",form." + e + ",form." + f + "," + d + ")'" + g + ">"); for (i = min_day; i <= max_day; i++) b.getDate() == i ? document.write("<option value='" + i + "' selected>" + (10 > i ? "0" + i : i)) : document.write("<option value='" + i + "'>" + (10 > i ? "0" + i : i)); document.write("</select>"); document.write("<select class='input1' name='" +
e + "' style='width:117px; color:#000000; font-size: 10px; font-family: Trebuchet; font-weight: normal;' OnChange='verifier_date_sejours(form." + c + ",form." + e + ",form." + f + "," + d + ")'" + g + ">"); for (i = a.getMonth(); i < month.length; i++) b.getMonth() == i ? document.write("<option value='" + (i + 1) + "' selected>" + leMois(i, month[i], a)) : document.write("<option value='" + (i + 1) + "'>" + leMois(i, month[i], a)); for (i = 0; i < a.getMonth(); i++) b.getMonth() == i ? document.write("<option value='" + (i + 1) + "' selected>" + leMois(i, month[i], a)) : document.write("<option value='" +
(i + 1) + "'>" + leMois(i, month[i], a)); document.write("</select>"); annee = 1900 > b.getYear() ? b.getYear() + 1900 : b.getYear(); document.write("<input type='hidden' name='" + f + "' value='" + annee + "'>"); "D" == g && Afficher_Jour_Aller_Sejours(b.getDate(), b.getMonth(), b.getYear()); "R" == g && Afficher_Jour_Retour_Sejours(b.getDate(), b.getMonth(), b.getYear())
} function Trim(c) { var e = ""; for (i = 0; i < c.length; i++) " " != c.charAt(i) && (e += c.charAt(i)); return e }
function IsNumeric(c) { var e = !0; for (i = 0; i < c.length; i++) if (temp = c.charAt(i), !(0 <= temp && 9 >= temp || "." == temp)) { e = !1; break } return e } function Test_Numeric(c) { c.value = Trim(c.value); IsNumeric(c.value) || (alert("La valeur doit \u00eatre num\u00e9rique"), c.focus()) } function Compter_Chaine(c, e) { for (var f = e, d = 0, a = 0, b = 0; b < f.length; b++) a = f.indexOf(c, 0), -1 != a && (d++, f = f.substring(a + c.length, f.length)); return d }
function IsMail(c) { var e = !1; -1 != c.indexOf("@") && c.indexOf("@") != c.length - 1 && 0 != c.indexOf("@") && 1 == Compter_Chaine("@", c) && (e = !0); return e }
function GetSaturday(c, e) {
    var f = new Date(c), d = f.getDate(), a = f.getMonth(), b = f.getYear(), f = f.getDay(); date2 = ""; 1900 > b && (b += 1900); if (0 == f) return date2 = (10 > d ? "0" + d : d) + "/" + (10 > a ? "0" + a : a) + "/" + b, date2 = Ajout_date(d, a, b, 6 + e); if (1 == f) return date2 = (10 > d ? "0" + d : d) + "/" + (10 > a ? "0" + a : a) + "/" + b, date2 = Ajout_date(d, a, b, 12 + e); if (2 == f) return date2 = (10 > d ? "0" + d : d) + "/" + (10 > a ? "0" + a : a) + "/" + b, date2 = Ajout_date(d, a, b, 11 + e); if (3 == f) return date2 = (10 > d ? "0" + d : d) + "/" + (10 > a ? "0" + a : a) + "/" + b, date2 = Ajout_date(d, a, b, 10 + e); if (4 == f) return date2 =
(10 > d ? "0" + d : d) + "/" + (10 > a ? "0" + a : a) + "/" + b, date2 = Ajout_date(d, a, b, 9 + e); if (5 == f) return date2 = (10 > d ? "0" + d : d) + "/" + (10 > a ? "0" + a : a) + "/" + b, date2 = Ajout_date(d, a, b, 8 + e); if (6 == f) return date2 = (10 > d ? "0" + d : d) + "/" + (10 > a ? "0" + a : a) + "/" + b, date2 = Ajout_date(d, a, b, 7 + e)
}
function GetFriday(c, e) {
    var f = new Date(c), d = f.getDate(), a = f.getMonth(), b = f.getYear(), f = f.getDay(); date2 = ""; 1900 > b && (b += 1900); if (0 == f) return date2 = (10 > d ? "0" + d : d) + "/" + (10 > a ? "0" + a : a) + "/" + b, date2 = Ajout_date(d, a, b, 5 + e); if (1 == f) return date2 = (10 > d ? "0" + d : d) + "/" + (10 > a ? "0" + a : a) + "/" + b, date2 = Ajout_date(d, a, b, 11 + e); if (2 == f) return date2 = (10 > d ? "0" + d : d) + "/" + (10 > a ? "0" + a : a) + "/" + b, date2 = Ajout_date(d, a, b, 10 + e); if (3 == f) return date2 = (10 > d ? "0" + d : d) + "/" + (10 > a ? "0" + a : a) + "/" + b, date2 = Ajout_date(d, a, b, 9 + e); if (4 == f) return date2 =
(10 > d ? "0" + d : d) + "/" + (10 > a ? "0" + a : a) + "/" + b, date2 = Ajout_date(d, a, b, 8 + e); if (5 == f) return date2 = (10 > d ? "0" + d : d) + "/" + (10 > a ? "0" + a : a) + "/" + b, date2 = Ajout_date(d, a, b, 7 + e); if (6 == f) return date2 = (10 > d ? "0" + d : d) + "/" + (10 > a ? "0" + a : a) + "/" + b, date2 = Ajout_date(d, a, b, 6 + e)
} function GetTodayDate(c) { Aoujourdhui = new Date(c); jour = Aoujourdhui.getDate(); mois = Aoujourdhui.getMonth() + 1; annee = Aoujourdhui.getFullYear(); return date = (10 > mois ? "0" + mois : mois) + "/" + (10 > jour ? "0" + jour : jour) + "/" + annee }
function GetTodayName(c) { Aoujourdhui = new Date(c); jour = Aoujourdhui.getDay(); if (0 == jour) return "Dim"; if (1 == jour) return "Lun"; if (2 == jour) return "Mar"; if (3 == jour) return "Mer"; if (4 == jour) return "Jeu"; if (5 == jour) return "Ven"; if (6 == jour) return "Sam" }
function Afficher_Jour_Aller_Sejours(c, e, f) {
    DateSaisie = new Date(f, e, c, 0, 0, 0, 0); jour = DateSaisie.getDay(); if (0 == jour) document.moteurp.image1.src = "/mirror/images/dimanche.gif"; if (1 == jour) document.moteurp.image1.src = "/mirror/images/lundi.gif"; if (2 == jour) document.moteurp.image1.src = "/mirror/images/mardi.gif"; if (3 == jour) document.moteurp.image1.src = "/mirror/images/mercredi.gif"; if (4 == jour) document.moteurp.image1.src = "/mirror/images/jeudi.gif"; if (5 == jour) document.moteurp.image1.src = "/mirror/images/vendredi.gif";
    if (6 == jour) document.moteurp.image1.src = "/mirror/images/samedi.gif"
}
function Afficher_Jour_Retour_Sejours(c, e, f) {
    DateSaisie = new Date(f, e, c, 0, 0, 0, 0); jour = DateSaisie.getDay(); if (0 == jour) document.moteurp.image2.src = "/mirror/images/dimanche.gif"; if (1 == jour) document.moteurp.image2.src = "/mirror/images/lundi.gif"; if (2 == jour) document.moteurp.image2.src = "/mirror/images/mardi.gif"; if (3 == jour) document.moteurp.image2.src = "/mirror/images/mercredi.gif"; if (4 == jour) document.moteurp.image2.src = "/mirror/images/jeudi.gif"; if (5 == jour) document.moteurp.image2.src = "/mirror/images/vendredi.gif";
    if (6 == jour) document.moteurp.image2.src = "/mirror/images/samedi.gif"
};
