﻿                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
// Implantation du calendrier
var calendExp = new CalendarPopup("calendardiv");
var calendTrn = new CalendarPopup("calendardiv");
calendExp.setCssPrefix("CAL_STYLE"); calendExp.setYearSelectStartOffset(0); calendExp.setWeekStartDay(1); calendExp.setDayHeaders("D","L","M","M","J","V","S"); calendExp.setTodayText("Aujourd'hui"); calendExp.setMonthNames("Janvier","Fevrier","Mars","Avril","Mai","Juin","Juillet","Aout","Septembre","Octobre","Novembre","Decembre");  
calendTrn.setCssPrefix("CAL_STYLE"); calendTrn.setYearSelectStartOffset(0); calendTrn.setWeekStartDay(1); calendTrn.setDayHeaders("D","L","M","M","J","V","S"); calendTrn.setTodayText("Aujourd'hui"); calendTrn.setMonthNames("Janvier","Fevrier","Mars","Avril","Mai","Juin","Juillet","Aout","Septembre","Octobre","Novembre","Decembre");  
today = new Date;
mo = today.getMonth()+1;
day = today.getDate()-1;
year = today.getFullYear();
if (day == 0){
 mo--;
 if (mo == 0){ mo = 12; year = year-1; }
 if (mo == 2){ if ((year%4) == 0) day = 29; else day = 28; } else { if ((mo == 1) || (mo == 3) || (mo == 5) || (mo == 7) || (mo == 8) || (mo == 10) || (mo == 12)) day = 31; else day = 30; }
}
date = year+"-"+mo+"-"+day;
calendExp.addDisabledDates(null, date);
calendTrn.addDisabledDates(null, date);
yearend = year + 1; dayend = day + 1; datefinexp = yearend + "-" + mo + "-28"; + /* dayend; */
calendExp.addDisabledDates(datefinexp, null);
mo = mo + 6; if (mo > 12){ year++; mo -= 12; } datefintrn = year + "-" + mo + "-28"; /* + dayend;*/
calendTrn.addDisabledDates(datefintrn, null);


//Gestion des calendriers
function calendar(champ,id,type){ if (document.saisie.btheadt[0].checked) calendTrn.select(champ,id,type); else calendExp.select(champ,id,type); }
function calendmaj(idin,idout){ idin.value = idout.value; }
