/*var AcceptPeriod = new Class( { implements: [Options, Events], initialize: function() { this._registerListners(); }, _registerListners : function() { oDateField = $('s_date'); oAcceptPeriodCheckBox = $('iAcceptPeriodActive_second'); oDateField.addEvent("focus", function(event) { oAcceptPeriodCheckBox.checked = true; }.bind(this)); } });*/ function setEndDate(dp) { oDateEndBox = $('e_date'); if (oDateEndBox.value=='') { sDateFirstSelect = dp.value; aDateParts = dp.value.split("-"); oOldDate = new Date(aDateParts[2],(aDateParts[1]-1),aDateParts[0]); oOldDate.setDate(oOldDate.getDate()+7); sNewDate = leadingZero(oOldDate.getDate()) + '-' + leadingZero(oOldDate.getMonth()+1) + '-' + oOldDate.getFullYear(); oDateEndBox.value = sNewDate; } } function leadingZero(x){return (x>9)?x:'0'+x;} function setAcceptPeriod() { oSearchForm = $('mapform'); oStartDateBox = $('s_date'); oEndDateBox = $('e_date'); aDateParts = oStartDateBox.value.split("-"); StartDate = new Date(aDateParts[2],(aDateParts[1]-1),aDateParts[0]); aDateParts = oEndDateBox.value.split("-"); EndDate = new Date(aDateParts[2],(aDateParts[1]-1),aDateParts[0]); if (EndDate <= StartDate) { alert(''); } else { oSearchForm.elements['procedure'].value = 'changeSearchCCAcceptPeriod'; oSearchForm.submit(); } } window.addEvent("domready", function() { //oAcceptPeriod = new AcceptPeriod(); new DatePicker($('s_date'), { onDateClick: function() { setEndDate($('s_date')); $('iAcceptPeriodActive_second').checked = true; } }); new DatePicker($('e_date')); });