function formValidator(){
	// Make quick references to our fields
var Name = document.getElementById('Name');
var CompanyName = document.getElementById('CompanyName');
var Telephone = document.getElementById('Telephone');
var Email = document.getElementById('EmailAddress');

	
	// Check each input in the order that it appears in the form!
if(isEmpty(Name, "Please enter your Name.")){
if(isEmpty(CompanyName, "Please enter your Company Name.")){
if(isNumeric(Telephone, "Please enter a valid Telephone number.")){
if(emailValidator(Email, "Please enter a valid Email address.")){

return true;
}
}
}
}
	
	
return false;
	
}

// If the length of the element's string is 0 then display helper message
function isEmpty(elem, helperMsg){
	if(elem.value == ""){
		alert(helperMsg);
		elem.focus(); // set the focus to this input
		return false;
	}
	return true;
}

function isNumeric(elem, helperMsg){
	var numericExpression = /^[0-9]+$/;
	if(elem.value.match(numericExpression)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

function isAlphabet(elem, helperMsg){
	var alphaExp = /^[a-zA-Z]+$/;
	if(elem.value.match(alphaExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		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;
	}
}