var cal1; var cal2; function init() { this.today = new Date(); var thisMonth = this.today.getMonth(); var thisDay = this.today.getDate(); var thisYear = this.today.getFullYear(); this.link1 = document.getElementById('dateLink1'); this.link2 = document.getElementById('dateLink2'); cal1 = new YAHOO.widget.Calendar2up_en("cal1","container1",(thisMonth+1)+"/"+thisYear,(thisMonth+1)+"/"+thisDay+"/"+thisYear); var customConfig = function() { this.Options.NAV_ARROW_LEFT = "http://www.4yourtravel.com/images/callt.gif"; this.Options.NAV_ARROW_RIGHT = "http://www.4yourtravel.com/images/calrt.gif"; } cal1.setChildFunction("customConfig",customConfig); cal1.callChildFunction("customConfig"); cal1.title = "Please choose the date of your arrival in Andorra:"; cal1.setChildFunction("onSelect",setDate1); cal1.pages[0].minDate = YAHOO.widget.DateMath.add(new Date(), YAHOO.widget.DateMath.DAY, 1); cal1.render(); cal2 = new YAHOO.widget.Calendar2up_en("cal2","container2",(thisMonth+1)+"/"+thisYear,(thisMonth+1)+"/"+thisDay+"/"+thisYear); cal2.setChildFunction("customConfig",customConfig); cal2.callChildFunction("customConfig"); cal2.title = "Please choose the date of your departure of Andorra:"; cal2.setChildFunction("onSelect",setDate2); cal2.pages[0].minDate = YAHOO.widget.DateMath.add(new Date(), YAHOO.widget.DateMath.DAY, 1); cal2.render(); } function showCalendar1() { cal2.hide(); cal1.outerContainer.style.top = (link1.offsetTop+link1.offsetParent.offsetTop+link1.height-1) + "px"; cal1.outerContainer.style.left = (link1.offsetLeft+link1.offsetParent.offsetLeft) + "px"; cal1.outerContainer.style.display='block'; } function showCalendar2() { cal1.hide(); cal2.outerContainer.style.top = (link2.offsetTop+link2.offsetParent.offsetTop+link2.height-1) + "px"; cal2.outerContainer.style.left = (link2.offsetLeft+link2.offsetParent.offsetLeft) + "px"; cal2.outerContainer.style.display='block'; } function setDate1() { var date10 = cal1.getSelectedDates()[0]; var date1 = document.getElementById('date1'); cal2.pages[0].minDate = YAHOO.widget.DateMath.add(date10, YAHOO.widget.DateMath.DAY, 1); day=(date10.getDate()<10)?"0"+date10.getDate():date10.getDate(); month=((date10.getMonth()+1)<10)?"0"+(date10.getMonth()+1):(date10.getMonth()+1); var d = day+"-"+month+"-"+date10.getFullYear(); date1.value = d; reCreateCalendar2(date10); cal1.hide(); } function reCreateCalendar2(pMinDate){ var lThisMonth = pMinDate.getMonth()+1; var lThisDay = pMinDate.getDate()+1; var lThisYear = pMinDate.getFullYear(); document.getElementById('container2').innerHTML = ''; var date2 = document.getElementById('date2'); day=(pMinDate.getDate()+1<10)?"0"+pMinDate.getDate()+1:pMinDate.getDate()+1; month=((pMinDate.getMonth()+1)<10)?"0"+(pMinDate.getMonth()+1):(pMinDate.getMonth()+1); var d = day+"-"+month+"-"+pMinDate.getFullYear(); date2.value = d; cal2 = new YAHOO.widget.Calendar2up_en("cal2","container2",lThisMonth+"/"+lThisYear,lThisMonth+"/"+lThisDay+"/"+lThisYear); var customConfig = function() { this.Options.NAV_ARROW_LEFT = "http://www.4yourtravel.com/images/callt.gif"; this.Options.NAV_ARROW_RIGHT = "http://www.4yourtravel.com/images/calrt.gif"; } cal2.setChildFunction("customConfig",customConfig); cal2.callChildFunction("customConfig"); cal2.title = "Please choose the date of your departure of Andorra:"; cal2.setChildFunction("onSelect",setDate2); pMinDateTemp = YAHOO.widget.DateMath.add(pMinDate, YAHOO.widget.DateMath.DAY, 1);; cal2.pages[0].minDate = pMinDateTemp; cal2.render(); } function setDate2() { var date20 = cal2.getSelectedDates()[0]; var date2 = document.getElementById('date2'); day=(date20.getDate()<10)?"0"+date20.getDate():date20.getDate(); month=((date20.getMonth()+1)<10)?"0"+(date20.getMonth()+1):(date20.getMonth()+1); var d = day+"-"+month+"-"+date20.getFullYear(); date2.value = d; cal2.hide(); }