function checkit(e,f) { if (e.which) Key = e.which; else Key = e.keyCode; if(Key==13) { if(f=="advhtl") sub_form(); } } function sub_form() { error_msg = ""; destination = document.getElementById("hotel_new_destination").value; hotel_name = document.getElementById("hotel_name").value; checkin = document.getElementById("hotel_checkin_day").value+"/"+document.getElementById("hotel_checkin_months").value+"/"+document.getElementById("hotel_checkin_years").value; checkout = document.getElementById("hotel_checkout_day").value+"/"+document.getElementById("hotel_checkout_months").value+"/"+document.getElementById("hotel_checkout_years").value; if(document.getElementById("hotel_checkin_months").value<10) hcm = "0"+document.getElementById("hotel_checkin_months").value; else hcm = document.getElementById("hotel_checkin_months").value; if(document.getElementById("hotel_checkin_day").value<10) hcd = "0"+document.getElementById("hotel_checkin_day").value; else hcd = document.getElementById("hotel_checkin_day").value; hcy = document.getElementById("hotel_checkin_years").value; if(document.getElementById("hotel_checkout_months").value<10) hom = "0"+document.getElementById("hotel_checkout_months").value; else hom = document.getElementById("hotel_checkout_months").value; if(document.getElementById("hotel_checkout_day").value<10) hod = "0"+document.getElementById("hotel_checkout_day").value; else hod = document.getElementById("hotel_checkout_day").value; hoy = document.getElementById("hotel_checkout_years").value; chi = hcy+hcm+hcd; cho = hoy+hom+hod; cy = eval("year_"+hcy+"["+hcm+"][1]"); if(hcd>cy) {error_msg += "
  • Please Check your dates. "+calendar_months_array[document.getElementById("hotel_checkin_months").value-1]+" "+hcy+" have "+cy+" days
  • ";} co = eval("year_"+hoy+"["+hom+"][1]");; if(hod>co) {error_msg += "
  • Please Check your dates. "+calendar_months_array[document.getElementById("hotel_checkout_months").value-1]+" "+hoy+" have "+co+" days
  • ";} if(chi>=cho && (hod!=0 || hcd!=0)) {error_msg +="
  • Please Check your dates. Checkin must be less than checkout
  • ";} if(hcd==0 || hcd=="") checkin=""; if(hod==0 || hod=="") checkout=""; destination_id = document.getElementById("hotel_destination_id").value; if(destination_id!="") destination=""; if(document.getElementById("ai").checked==false) ai = 0; else ai = 1; if(document.getElementById("new").checked==false) new1 = 0; else new1 = 1; if(document.getElementById("sug").checked==false) sug = 0; else sug = 1; if(document.getElementById("sp").checked==false) sp = 0; else sp = 1; optional = ai+","+new1+","+sug+","+sp; chain = document.getElementById("chain").value; category = document.getElementById("category").value; type = document.getElementById("type").value; amenities =""; if(destination_id=="") { if(destination=="" && hotel_name=="") { error_msg += "
  • Please Specify a Destination or a Hotel name
  • ";} if(destination.length < 3 && hotel_name=="") { error_msg += "
  • The Destination must have at least 3 characters
  • ";} } if(error_msg!="") { open_error_win(error_msg);} else {document.location.href="advhtl.php?prms="+destination+"|"+hotel_name+"|"+checkin+"|"+checkout+"|"+destination_id+"|"+optional+"|"+chain+"|"+category+"|"+type+"|"+amenities;} }