         function setArrivalDate(value, type){
                 var currDay = window.document.frmQuickFind.tempDay.value;
                 var currMonth = window.document.frmQuickFind.tempMonth.value;
                 var currYear = window.document.frmQuickFind.tempYear.value;

                 if(currDay.length==1){
                         currDay = '0'+currDay;
                 }
                 if(currMonth.length==1){
                         currMonth = '0'+currMonth;
                 }
                 if((type==1 || type==2) && value.length==1){
                         value = '0'+value;
                 }

                 if(type==0) { //called if date does not change or on automatic date reset
                         currDateString = new String(currYear+''+currMonth+''+currDay);
                         window.document.frmQuickFind.qfdArrivalDate.value = currDateString;
                 }
                 else{
                         if(type==1) { //day to change
                                 currDateString = new String(currYear+''+currMonth+''+value);
                         }
                         if(type==2) {
                                 currDateString = new String(currYear+''+value+''+currDay);
                         }
                         if(type==3) {
                                 currDateString = new String(value+''+currMonth+''+currDay);
                         }
                 }
         }



         function checkSearchDate(searchDate) {
                  var currDate = new Date();

                  if(searchDate.getYear() < currDate.getYear()){
                         alert("Jahr der Suche < aktuelles Jahr! Datum wird zurückgesetzt...");
                         return false;
                  }
                  if(searchDate.getYear() == currDate.getYear() && searchDate.getMonth() < currDate.getMonth()){
                         alert("Monat der Suche < aktueller Monat! Datum wird zurückgesetzt...");
                         return false;
                  }
                  if(searchDate.getYear() == currDate.getYear() && searchDate.getMonth() == currDate.getMonth() &&
                         searchDate.getDate() < currDate.getDate()){
                         alert("Tag der Suche < aktueller Tag! Datum wird zurückgesetzt...");
                         return false;
                  }
                  return true;
         }


        function changeBookable() {
                if (window.document.frmQuickFind.qfdBook.checked) {
                        window.document.frmQuickFind.qfdOnlyBookable.value = 1;
                      }
                else{
                        window.document.frmQuickFind.qfdOnlyBookable.value = 0;
                }
        }

                  function validateForm(form) {
                  var d = parseInt( form.tempDay.value )
                  var m = parseInt( form.tempMonth.value )
                  var j = parseInt( form.tempYear.value )

                  if ( !checkDate(d,m,j)) {
                  alert("Date incorrect!") ;
                  form.tempDay.focus();
                  return false;
                  }

                  document.frmQuickFind.ID.value=document.frmQuickFind.selID.value;
                  //document.frmQuickFind.SRCHORTE.value=document.frmQuickFind.townDropdown.value;
                  //document.frmQuickFind.SrchStars.value=document.frmQuickFind.catDropdown.value;

                  }

                  function checkDate( d, m, j ) {
                  var dt = new Date( j, m-1, d )
                  if ( dt.getDate() != d || dt.getMonth()+1 != m ) return false;
                  return true;
                  }

                  function checkDate2(){
                          var currDay = window.document.frmQuickFind.tempDay.value;
                          var currMonth = window.document.frmQuickFind.tempMonth.value;
                          var currYear = window.document.frmQuickFind.tempYear.value;
                          var searchDate = new Date(currYear, currMonth-1, currDay);
                        var check = checkSearchDate(searchDate);
                         if(check == false){
                                 setCurrentDay();
                                 return false;
                         }
                         else{
                                 window.document.frmQuickFind.qfdArrivalDate.value = currDateString;
                                 return true;
                         }

                  }


                  function setCurrentDay() {
                  //
                  // Set Quickfinder date to current day
                  //
                  var today = new Date();
                  var today_day = today.getDate();
                  var today_month = today.getMonth();
                  var today_year = today.getFullYear();

                  var currDateString = new String(today_year+''+(today_month+1)+''+today_day);

                  window.document.frmQuickFind.qfdArrivalDate.value = currDateString;
                  window.document.frmQuickFind.tempDay.options[today_day-1].selected = true;
                  window.document.frmQuickFind.tempMonth.options[today_month].selected = true;
                  window.document.frmQuickFind.tempYear.options[0].value = today_year;
                  window.document.frmQuickFind.tempYear.options[0].text = today_year;
                  setArrivalDate(0,0);
                  }

setCurrentDay();

