// JavaScript Document

function formValidator(){
	// Make quick references to our fields
	var contactName = document.getElementById('contactName');
	var contactPhone = document.getElementById('contactPhone');
	var contactEmail = document.getElementById('contactEmail');
	var contactQuestion = document.getElementById('contactQuestion');
	
	
	// Check each input in the order that it appears in the form!
	if(isEmpty(contactName, "Please enter your name")){
			return false;
	}
		if(isEmpty(contactPhone, "Please enter your phone")){
				return false;
	}
			if(isEmpty(contactEmail, "Please enter your email address")){
					return false;
	}
				if(isEmpty(contactQuestion, "Please select your question")){
						return false;
	}
		
							
					
}

function isEmpty(elem, helperMsg){
	if(elem.value.length == 0){
		alert(helperMsg);
		elem.focus(); // set the focus to this input
		elem.style.background = 'Yellow';
		return true;
	}
	return false;
}
