function formValidator(){
	// Make quick references to our fields
	var visitornotes = document.commentsForm.visitornotes;
	var visitorname = document.commentsForm.visitorname;
	var visitoremail = document.commentsForm.visitoremail;
	
	// Check each input in the order that it appears in the form!


	if(lengthRestriction(visitorname, 3, 50)){					
		if(emailValidator(visitoremail, "Please enter a valid email address")){
		 	if(notesValidator(visitornotes, "Please add some comments")){
				return true;
			}		
		}				
	}
	

	
	return false;
	
}

function emailValidator(elem, helperMsg){
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if(elem.value.match(emailExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

function lengthRestriction(elem, min, max){
	var uInput = elem.value;
	if(uInput.length >= min && uInput.length <= max){
		return true;
	}else{
		alert("Please enter name " +min+ " and " +max+ " characters");
		elem.focus();
		return false;
	}
}

function notesValidator(elem, helperMsg){
	var uInput = elem.value;
	if(!uInput){
	 	alert(helperMsg);
		elem.focus();
		return false;
	}else{
		return true;
	}
}

