var months=['janvier','février','mars','avril','mai','juin','juillet','août','septembre','octobre','novembre','décembre',]; var days=['Lu','Ma','Me','Je','Ve','Sa','Di']; var days3=['Lun','Mar','Mer','Jeu','Ven','Sam','Dim']; function checkDateOrder(me, ci_day, ci_month_year, co_day, co_month_year) { var frm = document.getElementById('recherche'); if (document.getElementById) { var my = $F(ci_month_year).split("-"); ci = new Date (my[1], my[0]-1, $F(ci_day), 12, 0, 0, 0); my = $F(co_month_year).split("-"); co = new Date (my[1], my[0]-1, $F(co_day), 12, 0, 0, 0); if (ci >= co){ co.setTime(ci.getTime() + 1000 * 60 * 60 * 24); frm[co_day].value = co.getDate(); var com = co.getMonth()+1; frm[co_month_year].value = com+ "-" +co.getFullYear(); } } } function updateDaySelect( me ) { if(!$('checkin_monthday') || !$('checkout_monthday') || !$('checkin_year_month') || !$('checkout_year_month')) return; var ci_d = $('checkin_monthday'); var co_d = $('checkout_monthday'); var ci_my = $F('checkin_year_month').split("-"); var co_my = $F('checkout_year_month').split("-"); var ci_sel = ci_d.selectedIndex; var co_sel = co_d.selectedIndex; var monthDays = [], opt; // Checkin month monthDays = buildDaysForMonth(ci_my[1], ci_my[0]); ci_d.innerHTML = ''; for(var i = 0; i < monthDays.length; i++) { opt = document.createElement('option'); opt.innerHTML = (monthDays[i] + ' ' + (i+1)); opt.value = (i+1); ci_d.appendChild(opt); } ci_d.options[ci_sel].defaultSelected = ci_d.options[ci_sel].selected = true; // Checkout month monthDays = buildDaysForMonth(co_my[1], co_my[0]); co_d.innerHTML = ''; for(var i = 0; i < monthDays.length; i++) { opt = document.createElement('option'); opt.innerHTML = (monthDays[i] + ' ' + (i+1)); opt.value = (i+1); co_d.appendChild(opt); } co_d.options[co_sel].defaultSelected = co_d.options[co_sel].selected = true; } function buildDaysForMonth( year, month ) { // Month index starts on 0(-11) in Date()-object var monthDate = new Date(year, month-1); var orgMonth = monthDate.getMonth(); var dayArray = [], weekDay; while(monthDate.getMonth() == orgMonth) { // Week starts on Sunday in Date()-object weekDay = (monthDate.getDay() == 0) ? 6 : (monthDate.getDay()-1); dayArray.push(days3[weekDay]); monthDate.setDate(monthDate.getDate()+1); } return dayArray; } function initDaySelect() { var forms = document.getElementsByTagName('form'); for(var i=0; i