$(document).ready(function(){
	$("#submit").click(function(){					   				   
		$(".error").hide();
		var hasError = false;
		var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
		
		var nameFromVal = $("#nameFrom").val();
		if(nameFromVal == '') {
			$("#nameFrom").before('<span class="error">You forgot to enter your Name.</span>');
			hasError = true;
		}
		
		var emailFromVal = $("#emailFrom").val();
		if(emailFromVal == '') {
			$("#emailFrom").before('<span class="error">You forgot to enter your Email Address.</span>');
			hasError = true;
		} else if(!emailReg.test(emailFromVal)) {	
			$("#emailFrom").before('<span class="error">Please ensure you enter a valid Email Address.</span>');
			hasError = true;
		}
		
		var numberFromVal = $("#numberFrom").val();
		if(numberFromVal == '') {
			$("#numberFrom").before('<span class="error">You forgot to enter your Telephone Number.</span>');
			hasError = true;
		}
		
		var timeFromVal = $("#timeFrom").val();
		if(timeFromVal == '') {
			$("#timeFrom").before('<span class="error">You forgot to enter your Preferred Time.</span>');
			hasError = true;
		}
		
		var dateFromVal = $("#dateFrom").val();
		if(dateFromVal == '') {
			$("#dateFrom").before('<span class="error">You forgot to enter your Preferred Date.</span>');
			hasError = true;
		}
		
		var peopleFromVal = $("#peopleFrom").val();
		if(peopleFromVal == '') {
			$("#peopleFrom").before('<span class="error">You forgot to enter the Number of People.</span>');
			hasError = true;
		}
		
		var messageFromVal = $("#messageFrom").val();		
		 
		
		
		

		
		
		// Terms Check
		
		if($('#termsCheck').attr('checked') == false)
		{
			$("#termsCheck").before('<span class="error">You need to agree to our Terms &amp; Conditions to submit a booking.</span>');
			hasError = true;
		}
	
		
		
	
		
		if(hasError == false) {	
			return true;
		} else {
			return false;
		}
	});						   
});
