function formValidator(){
	// Make quick references to our fields
	var fname = document.getElementById('fname');
	var cemail = document.getElementById('cemail');
	var phone = document.getElementById('phone');
	
	// Check each input in the order that it appears in the form!
	if(isEmpty(fname, "Please enter your name")){
		return false; }
	else if(emailValidator(cemail, "Please enter a valid email address")){
		return false; }
	else if(isEmpty(phone, "Please enter a phone number")){
		return false; }
	else { return true; }
}

function isEmpty(elem, helperMsg){
	if(elem.value.length == 0){
		alert(helperMsg);
		elem.focus(); // set the focus to this input
		return true;
	}
	else { 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 false; }
	else{
		alert(helperMsg);
		elem.focus();
		return true;
	}
}