function checkSubmit() {

//http://web.deskline.net/oststeiermark/de/qfind_accommodation?OC=OSTSTEIER&qfdArrivalDate=20110505&CLR_all=true&qfdLocation=&SrchFromDay=5&SrchFromMonth=5&SrchFromYear=2011&qfdNights=1&qfdNumberOfUnits=1&qfdAdults=2&qfdChildren=&button=Unterkunft+suchen

	sVoid = document.location.href;

	if(sVoid.indexOf('OC=OSTSTEIER') != -1)
	{
		sParam = sVoid.slice(sVoid.indexOf('OC=OSTSTEIER'));
		
		document.getElementById('fframe').src = 'http://web.deskline.net/oststeiermark/de/qfind_accommodation?'+sParam;
	}
	else if(sVoid.indexOf('extern=') != -1)
	{
		sParam = sVoid.slice(sVoid.indexOf('extern=') + 7);
		
		document.getElementById('fframe').src = sParam;
	}
}


function setArrivalDate(value, type){
                 var currDay = window.document.frmQuickFind.SrchFromDay.value;
                 var currMonth = window.document.frmQuickFind.SrchFromMonth.value;
                 var currYear = window.document.frmQuickFind.SrchFromYear.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) { //month to change
                                 currDateString = new String(currYear+''+value+''+currDay);
                         }
                         if(type==3) { //year to change
                                 currDateString = new String(value+''+currMonth+''+currDay);
                         }
                 }
         } //setArrivalDate


                                 /*Function to check whether the search date is in the past*/
         function checkSearchDate(searchDate) {
                  var currDate = new Date();
                  if(searchDate.getYear() < currDate.getYear()){
                         alert("Das Jahr liegt in der Vergangenheit. Bitte nehmen Sie eine Korrektur vor!");
                         return false;
                  }
                  if(searchDate.getYear() == currDate.getYear() && searchDate.getMonth() < currDate.getMonth()){
                         alert("Der Monat liegt in der Vergangenheit. Bitte nehmen Sie eine Korrektur vor!");
                         return false;
                  }
                  if(searchDate.getYear() == currDate.getYear() && searchDate.getMonth() == currDate.getMonth() &&
                         searchDate.getDate() < currDate.getDate()){
                         alert("Der Tag liegt in der Vergangenheit. Bitte nehmen Sie eine Korrektur vor!");
                         return false;
                  }
                  return true;
         } //checkSearchDate

         /*Helper function to check the query string passed to the system*/
         function displayQueryString(form){
                 var sfDay = form.SrchFromDay.value;
                 var sfMonth = form.SrchFromMonth.value;
                 var sfYear = form.SrchFromYear.value;
                 var qfdNights = form.qfdNights.value;
                 var qfdAdults = form.qfdAdults.value;
                 var qfdArrivalDate = form.qfdArrivalDate.value;
                 //var qfdCategories = form.qfdCategories.value;
                 var baseUrl = form.action;
                 var url = baseUrl+'?'+'qfdArrivalDate='+qfdArrivalDate+
                         '&SrchFromDay='+sfDay+'&SrchFromMonth='+sfMonth+'&SrchFromYear='+sfYear+
                       '&qfdNights='+qfdNights+'&qfdAdults='+qfdAdults;
                 alert(url);
         } //displayQueryString


/*Helper function to check the query string passed to the system*/
         function displayQueryString(form){
                 var sfDay = form.SrchFromDay.value;
                 var sfMonth = form.SrchFromMonth.value;
                 var sfYear = form.SrchFromYear.value;
                 var qfdNights = form.qfdNights.value;
                 var qfdAdults = form.qfdAdults.value;
                 var qfdArrivalDate = form.qfdArrivalDate.value;
                 //var qfdCategories = form.qfdCategories.value;
                 var baseUrl = form.action;
                 var url = baseUrl+'?'+'qfdArrivalDate='+qfdArrivalDate+
                         '&SrchFromDay='+sfDay+'&SrchFromMonth='+sfMonth+'&SrchFromYear='+sfYear+
                       '&qfdNights='+qfdNights+'&qfdAdults='+qfdAdults;
                 alert(url);
         } //displayQueryString


               function validateForm(form) {
                                               var d = parseInt(form.SrchFromDay.value);
                                        var m = parseInt(form.SrchFromMonth.value);
                                        var j = parseInt(form.SrchFromYear.value);

                                                                if ( !checkDate(d,m,j)) {
                                                                alert("Das gegebene Datum existiert nicht (z.B. 31.02.)! Überprüfen Sie Ihre Eingabe!") ;
                                                        form.SrchFromDay.focus();
                                                        return false;
                                        }

                                                                if ( !checkDate2()) {
                                                        form.SrchFromDay.focus();
                                                        return false;
                                        }
                } //validateForm

          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;
          } //checkDate


          function checkDate2(){
                 var currDay = window.document.frmQuickFind.SrchFromDay.value;
                 var currMonth = window.document.frmQuickFind.SrchFromMonth.value;
                 var currYear = window.document.frmQuickFind.SrchFromYear.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;
                 }
          } //checkDate2


          function setCurrentDay() {
                                          var today = new Date();
                                          var today_day = today.getDate();
                                          var today_month = today.getMonth();
                                          var today_year = today.getFullYear();
                                          //Set Quickfinder date to current day

                                          var currDateString = new String(today_year+''+(today_month+1)+''+today_day);

                                                window.document.frmQuickFind.qfdArrivalDate.value = currDateString;
                                                window.document.frmQuickFind.SrchFromDay.options[today_day-1].selected = true;
                                                window.document.frmQuickFind.SrchFromMonth.options[today_month].selected = true;
                                                window.document.frmQuickFind.SrchFromYear.options[0].value = today_year;
                                                window.document.frmQuickFind.SrchFromYear.options[0].text = today_year;
                                                setArrivalDate(0,0);
          } //setCurrentDay
