$(window).load(function(){
	if ($('#signupForm')) {
		$('#signupForm').submit(
			function() {
				var error		= '';				
				var txtFname	= $.trim($('#fname').attr('value'));
				var txtLname	= $.trim($('#lname').attr('value'));
				
				var txtEmail	= $.trim($('#email').attr('value'));
				
				var txtPassword	= $.trim($('#pass').attr('value'));
				var txtRepassword= $.trim($('#repassword').attr('value'));
				var txtPh		= $.trim($('#phone').attr('value'));
				
				
				if (txtFname == '')
				{
					error += 'Please enter the first name..\n';
					$('#fname').focus();
				}
				if (txtLname == '') 
				{
					error += 'Please enter the last name..\n';
					$('#lname').focus();
				}
				if (txtPassword == '')
				{
					error += 'Please enter the password..\n';
					$('#pass').focus();
				}
				
			else if(txtPassword !='')
			{
				
			if(txtPassword != txtRepassword)
				{
					error += 'Please enter the same confirm password..\n';
					$('#repassword').focus();
				}
			}
				 if (txtPh =='') 
				   {
						error += 'Please enter Your Phone number..\n';
						$('#phone').focus();
					}
				else if (txtPh !='') 
				 {
					 if (!isNumeric(txtPh)) 
					{
						error += 'Please enter only numeric values in phone first box..\n';
						$('#phone').focus();
					}
					if((txtPh.length<10) || (txtPh.length>10))
					{
					error +='Please Enter a 10 digit Phone number..\n';
					$('#phone').focus();
					}
				}
						
				if (txtEmail == '')
				{
					error += 'Please enter the email..\n';
					$('#email').focus();
				} 
				else if (txtEmail !='')
				{
					var re = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
					if (!re.test(txtEmail))
					{
						error += "Please Enter Valid Email Id.\n";
						$('#email').focus();
					}
				}
				
						
			
				if ($.trim(error)) {
					alert(error);
					return false;
				}
				return true;
			}
		);
	}
});

function isNumeric(form_value) { 
    if (form_value.match(/^\d+$/) == null) 
        return false; 
    else 
        return true; 
}


