  function checkEmail(address){
    var filter =/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
    return filter.test(address);
  }
  
  function checkForm(property_type) {
    var f = document.forms.request;
    if(!checkEmail(f.email_address.value)) {
      alert('Please fill in a valid email address.');
      return false;
    }
      
    if(!f.first_name.value || !f.last_name.value || !f.email_address.value) {
      alert('Please fill in all required fields (marked with a *).');
      return false;
    }
    if(property_type == 'shortstay') {
      if(!f.num_guests.value || !f.checkin.value || !f.checkout.value) {
        alert('Please fill checkin, checkout, and number of guests (marked with a *).');
        return false;
      }
    }      
    return true;    
  }

