// JavaScript Document


function validateForm(form) { //This is the name of the function



if (form.surname.value == "") { //This checks to make sure the field is not empty
   alert("Please enter Surname"); //Informs user of empty field
   form.surname.focus( ); //This focuses the cursor on the empty field
   return false; //This prevents the form from being submitted
   }


if (form.email.value == "") { //This checks to make sure the field is not empty
   alert("Please enter Email Address"); //Informs user of empty field
   form.email.focus( ); //This focuses the cursor on the empty field
   return false; //This prevents the form from being submitted
   }
   
   if (form.address1.value == "") { //This checks to make sure the field is not empty
   alert("Please enter Address 1"); //Informs user of empty field
   form.address1.focus( ); //This focuses the cursor on the empty field
   return false; //This prevents the form from being submitted
   }



}



function validateAvailabilityForm(form) { //This is the name of the function

var myselect = document.getElementById("title")
   if (myselect.options[0].selected == true) { //This checks to see if an option other than the "Please select" has been selected
       alert("Please select your Title");
       form.title.focus();
       return false; //This prevents the form from being submitted
   }

if (form.firstname.value == "") { //This checks to make sure the field is not empty
    alert("Please enter Firstname"); //Informs user of empty field
        form.firstname.focus(); //This focuses the cursor on the empty field
        return false; //This prevents the form from being submitted
    }

if (form.surname.value == "") { //This checks to make sure the field is not empty
   alert("Please enter Surname"); //Informs user of empty field
   form.surname.focus( ); //This focuses the cursor on the empty field
   return false; //This prevents the form from being submitted
   }


if (form.email.value == "") { //This checks to make sure the field is not empty
   alert("Please enter Email Address"); //Informs user of empty field
   form.email.focus( ); //This focuses the cursor on the empty field
   return false; //This prevents the form from being submitted
   }
   
   if (form.phone.value == "") { //This checks to make sure the field is not empty
   alert("Please enter Phone number"); //Informs user of empty field
   form.phone.focus( ); //This focuses the cursor on the empty field
   return false; //This prevents the form from being submitted
   }
   
   
   if (form.address1.value == "") { //This checks to make sure the field is not empty
   alert("Please enter Address 1"); //Informs user of empty field
   form.address1.focus( ); //This focuses the cursor on the empty field
   return false; //This prevents the form from being submitted
   }
   
   if (form.town.value == "") { //This checks to make sure the field is not empty
   alert("Please enter Town"); //Informs user of empty field
   form.town.focus( ); //This focuses the cursor on the empty field
   return false; //This prevents the form from being submitted
   }

   if (form.county.value == "") { //This checks to make sure the field is not empty
   alert("Please enter County"); //Informs user of empty field
   form.county.focus( ); //This focuses the cursor on the empty field
   return false; //This prevents the form from being submitted
   }
   
   if (form.postcode.value == "") { //This checks to make sure the field is not empty
   alert("Please enter Postcode"); //Informs user of empty field
   form.postcode.focus( ); //This focuses the cursor on the empty field
   return false; //This prevents the form from being submitted
   }
   
   
   
   
   var myselect = document.getElementById("length")
   if (myselect.options[0].selected == true) { //This checks to see if an option other than the "Please select" has been selected
   alert("Please select a lengh of stay");
    form.length.focus( );
	return false; //This prevents the form from being submitted
   }
   
   var myselect = document.getElementById("people")
   if (myselect.selectedIndex == 0) { //This checks to see if an option other than the "Please select" has been selected
       alert("Please select number of people");
       form.people.focus();
       return false; //This prevents the form from being submitted
   }

   var myselect = document.getElementById("unit")
   if (myselect.selectedIndex == 0) { //This checks to see if an option other than the "Please select" has been selected
       alert("Please select Accommodation");
       form.unit.focus();
       return false; //This prevents the form from being submitted
   }
   

}
