$(function(){
	function contactInputName(){
		input = $("#contactInputName").val();
		if(input.length < 2){
			alert("Name field is required and must be more than 2 characters.");
			return false;
		} else{
			return true;
		}	
	}

	function contactInputEmail(){
		input = $("#contactInputEmailAddress").val();
		var filter=/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/;	
		if(filter.test(input)){
			return true;
		}else{
			alert("Email address field is required and must be a valid email address.");
			return false;
		}
	}
	
	function contactInputSubject(){
		input = $("#contactInputSubject").val();
		if(input.length < 2){
			alert("Subject field is required and must be more than 2 characters.");
			return false;
		} else{
			return true;
		}	
	}
	
	function contactTextAreaMessage(){
		input = $("#contactTextAreaMessage").val();
		if(input.length < 10){
			alert("Textarea field is required and must be more than 10 characters.");
			return false;
		} else{
			return true;
		}	
	}
	
	$("#contactSubmitButton").click(function() {
		if(contactInputName() & contactInputEmail() & contactInputSubject() & contactTextAreaMessage()){
			return true;	
		} else{
			return false;
		}
	});
});
