function checkbooking() {
 
  firstname = document.booking.firstname.value;
  lastname = document.booking.lastname.value;
  phone = document.booking.phone.value;
  email = document.booking.email.value;
  arrivalday = document.booking.arrivalday.options[document.booking.arrivalday.selectedIndex].value;
  arrivalmonth = document.booking.arrivalmonth.options[document.booking.arrivalmonth.selectedIndex].value;
  arrivalyear = document.booking.arrivalyear.options[document.booking.arrivalyear.selectedIndex].value;
  departureday = document.booking.departureday.options[document.booking.departureday.selectedIndex].value;
  departuremonth = document.booking.departuremonth.options[document.booking.departuremonth.selectedIndex].value;
  departureyear = document.booking.departureyear.options[document.booking.departureyear.selectedIndex].value;
  filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
  
  var now = new Date();
  now = now.getTime(); //NN3
  var dateToCheck = new Date();
  dateToCheck.setYear(arrivalyear);
  dateToCheck.setMonth(arrivalmonth-1);
  dateToCheck.setDate(arrivalday);
  var checkDate = dateToCheck.getTime();
  
  var now2 = new Date();
  now2 = now2.getTime(); //NN3
  var dateToCheck2 = new Date();
  dateToCheck2.setYear(departureyear);
  dateToCheck2.setMonth(departuremonth-1);
  dateToCheck2.setDate(departureday);
  var checkDate2 = dateToCheck2.getTime();
  
 returnval = true;
 hideAllErrors();
if (firstname == "") {
 returnval = false;
 document.getElementById("firstnameError").style.display = "inline";
} 
if (lastname == "") {
 returnval = false;
 document.getElementById("lastnameError").style.display = "inline";
}
if (phone == "") {
 returnval = false;
 document.getElementById("phoneError").style.display = "inline";
}
if (email == "") {
 returnval = false;
 document.getElementById("emailError").style.display = "inline";
}
if (email != "" && !(filter.test(email))) { 
 returnval = false;
 document.getElementById("emailError").style.display = "none";
 document.getElementById("email2Error").style.display = "inline";
}
if (arrivalday == "select" || arrivalmonth == "select" || arrivalyear == "select") {
 returnval = false;
 document.getElementById("arrivaldateError").style.display = "inline";
}
if (departureday == "select" || departuremonth == "select" || departuremonth == "select") {
 returnval = false;
 document.getElementById("departuredateError").style.display = "inline";
}
 if (now > checkDate){
  returnval = false;
 document.getElementById("arrivaldate2Error").style.display = "inline"; 
 }
 if (now2 > checkDate2){
  returnval = false;
 document.getElementById("departuredate2Error").style.display = "inline"; 
 }
 if (checkDate > checkDate2){
  returnval = false;
 document.getElementById("dateError").style.display = "inline"; 
 }
 return returnval;
}
 
function hideAllErrors() {
document.getElementById("firstnameError").style.display = "none"
document.getElementById("lastnameError").style.display = "none"
document.getElementById("phoneError").style.display = "none"
document.getElementById("emailError").style.display = "none"
document.getElementById("email2Error").style.display = "none"
document.getElementById("arrivaldateError").style.display = "none"
document.getElementById("departuredateError").style.display = "none"
document.getElementById("arrivaldate2Error").style.display = "none"
document.getElementById("departuredate2Error").style.display = "none"
document.getElementById("dateError").style.display = "none"
}