// JavaScript Document


function validation()
{
var name = document.getElementById('txtName');
var add = document.getElementById('txtAdd');
var wphone = document.getElementById('txtWPhone');
var hphone = document.getElementById('txtHPhone');
var email = document.getElementById('txtEmail');
       if(isAlphabet(name, "Please enter only letters for your name")){
	    	     if(isNumeric(hphone, "Please enter a valid Home phone No:")){
						if(emailValidator(email, "Please enter a valid email address")){
			         			return true;
					 	  }
                  } 
	        }
        
		return false;
 }  



 	function isAlphabet(name, helperMsg){
	var alphaExp = /^[a-zA-Z]+$/;
	if(name.value.match(alphaExp)){
		return true;
	}else{
		alert(helperMsg);
		name.focus();
		return false;
		}
	}


function isNumeric(hphone, helperMsg){
	var numericExpression = /^[0-9]+$/;
	if(hphone.value.match(numericExpression)){
		return true;
	}else{
		alert(helperMsg);
		hphone.focus();
		return false;
	}
}

            function emailValidator(email, helperMsg){
			var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
			if(email.value.match(emailExp)){
			return true;
			}else{
			alert(helperMsg);
			email.focus();
			return false;
				}
			}

