// wait for the DOM to be loaded $(document).ready(function() { dateSetups(); $("#policyType").change(showOptions); }); function dateSetups() { $('#startDate').datepicker({showOn:'none', minDate: 0, changeMonth: true, changeYear: true}); if (isExisting(document.qeForm.endDate)) { $('#endDate').datepicker({showOn:'none', minDate: 0, changeMonth: true, changeYear: true}); } if (isExisting(document.qeForm.bookingDate)) { $('#bookingDate').datepicker({showOn:'none', maxDate: 0, changeMonth: true, changeYear: true}); } } function showOptions() { options.success = tripTypeUpdate; document.qeForm.qeEvent.value = "getStep_CD1"; document.qeForm.qeButtonNextStep.disabled=true; $('#qeForm').submit(); document.qeForm.qeButtonNextStep.disabled=false; options.success = validateForm; document.qeForm.qeEvent.value = "validateForm"; } function tripTypeUpdate(responseText, statusText) { loadingScreen("end"); responseText = xmlTidy(responseText); $('#qeTripsFormContent').html(responseText); addCorners(); dateSetups(); // need to rebind $("#policyType").change(showOptions); $('#qeForm').ajaxForm(options); }