

function validation()
{

	var message=""
    var invalidCharactersRegExp = /[^a-z ]/i;
	var invalidAlphaNumericRegExp = /[^a-z\d /#]/i;
	var invalidCharacterRegExp = /[^a-z]/i;
	var invalidNumberRegExp = /[^0-9]/i;
	var invalidNumberTimeRegExp = /[^a-z\d]/i;
	var validFormatRegExp = /^\w(\.?\w)*@\w(\.?[-\w])*\.[a-z]{2,4}$/i;
	var invalidSpaceRegExp = /[^ ]/i;
	var specialchars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?";
	var user_name = document.user_verfication.user_name.value;
	var password=document.user_verfication.password.value;
	var name=document.user_verfication.name.value;
	var email=document.user_verfication.email.value;
	
	var company=document.user_verfication.company.value;
	
	var phoneno=document.user_verfication.phoneno.value;
	var mobile=document.user_verfication.mobile.value;
	
                if(user_name.length<=0)
				 {
					
					message = "Enter the User Name";
					
					document.user_verfication.user_name.focus();
					document.user_verfication.user_name.select();
				    
					} 
				
				else if(user_name.length<6)
				 {
					
					message = "User name must be atleast  6 characters";
					
					document.user_verfication.user_name.focus();
					document.user_verfication.user_name.select();
					
				} 
				else  if(user_name.substring(0,1)==" ") 
				{
					message = "User Name should not start with space";
					
					document.user_verfication.user_name.focus();
					document.user_verfication.user_name.select();
				
				}
				/*else if(!invalidSpaceRegExp.test(.user_name)) 
				{
					message = "Space not allowed in User Name";
					document.user_verfication.user_name.focus();
					document.user_verfication.user_name.select();
				}*/
			
				else if(!invalidNumberRegExp.test(user_name)) 
				{
					message = "Numeric not allowed in User Name";
				
					document.user_verfication.user_name.focus();
					
					document.user_verfication.user_name.select();
					
				}
				
				 else if(password.length<=0)
				 {
					
					message = "Enter the Password";
					
					document.user_verfication.password.focus();
					document.user_verfication.password.select();
				
				} 
				else if(password.length<6)
				 {
					
					message = "Password must be atleast  6 characters";
					
					document.user_verfication.password.focus();
					document.user_verfication.password.select();
					
				} 	
				else  if(user_name.substring(0,1)==" ") 
				{
					message = "Password should not start with space";
					
					document.user_verfication.password.focus();
					document.user_verfication.password.select();
				
				}	
					
					
				
			  
			  
			  else if(name.length<=0)
				 {
					
					message = "Please Enter Your Name";
					
					document.user_verfication.name.focus();
					document.user_verfication.name.select();
				
					} 
				
				
				else  if(name.substring(0,1)==" ") 
				{
					message = " Name should not start with space";
					
					document.user_verfication.name.focus();
					document.user_verfication.name.select();
				
				}
				
			
				else if(!invalidNumberRegExp.test(name)) 
				{
					message = "Numeric not allowed in  Name";
				
					document.user_verfication.name.focus();
					
					document.user_verfication.name.select();
					
				}
				
				else if(document.user_verfication.email.value.length<=0) 
					{
							message = "Email ID is required";
							document.user_verfication.email.focus();
							document.user_verfication.email.select();
						} else if(!invalidSpaceRegExp.test(document.user_verfication.email.value))
						{
							message = "Space not allowed in email ID";
							document.user_verfication.email.focus();
							document.user_verfication.email.select();
						} 
						else if(!validFormatRegExp.test(document.user_verfication.email.value))
						{
							message = "Invalid email ID";
							document.user_verfication.email.focus();
							document.user_verfication.email.select();
					
					
					     }
				
						/*else if(invalidCharactersRegExp.test(company))
						{
							message = "Alphabets only in company name";
							document.user_verfication.company.focus();
							document.user_verfication.company.select();
						}*/
									
					else  if(company.substring(0,1)==" ") 
					{
						message = " Company Name should not start with space";
						
						document.user_verfication.company.focus();
						document.user_verfication.company.select();
					
					}
				
				
				 else if((document.user_verfication.phoneno.value.length >0) && (!invalidSpaceRegExp.test(document.user_verfication.phoneno.value))) 
				 {
					message = "Space not allowed in phone no";
					document.user_verfication.phoneno.focus();
					document.user_verfication.phoneno.select();
				 }
				else if((document.user_verfication.phoneno.value.length >0) && (document.user_verfication.phoneno.value.length<10) ) 
				{
					message = "Phone no should be 10 digits";
					document.user_verfication.phoneno.focus();
					document.user_verfication.phoneno.select();
				}
				else if((document.user_verfication.phoneno.value.length >0) && (invalidNumberRegExp.test(document.user_verfication.phoneno.value) ||                 parseInt(document.user_verfication.phoneno.value)==0)) 
				{
					message = "Invalid Phone no";
					document.user_verfication.phoneno.focus();
					document.user_verfication.phoneno.select();
				}  
							
				else if(document.user_verfication.mobile.value.length<=0) 
				{
					message = "Mobile no is required";
					document.user_verfication.mobile.focus();
					document.user_verfication.mobile.select();
				} else if(!invalidSpaceRegExp.test(document.user_verfication.mobile.value))
				{
					message = "Space not allowed in mobile no";
					document.user_verfication.mobile.focus();
					document.user_verfication.mobile.select();
				} else if(invalidNumberRegExp.test(document.user_verfication.mobile.value) || parseInt(document.user_verfication.mobile.value)==0) 
				{
					message = "Invalid Mobile no";
					document.user_verfication.mobile.focus();
					document.user_verfication.mobile.select();
				} else if(document.user_verfication.mobile.value.length<10 ) 
				
				{
					message = "Mobile no should be 10 digits";
					document.user_verfication.mobile.focus();
					document.user_verfication.mobile.select();
					
				}
			  	
				for (var i = 0; i < document.user_verfication.user_name.value.length; i++) 
				{
				if (specialchars.indexOf(document.user_verfication.user_name.value.charAt(i)) != -1)
				{
				alert ("Your username has special characters. \nThese are not allowed. Please remove them and try again.");
				document.user_verfication.user_name.focus();
				return false;
				}
			  }
			  for (var j = 0; j < document.user_verfication.password.value.length; j++) {
				if (specialchars.indexOf(document.user_verfication.password.value.charAt(j)) != -1) {
				alert ("Your password has special characters. \nThese are not allowed. Please remove them and try again.");
				return false;
				}
			  }
			  
			  
			  
			  
			  
			  
		
	         if(message.length!=0)
				{
					alert(message);
					
					return false;
				}
				return true;	
			
					
				}



/*
function valid()
{
var msg=""
   	
	var validFormatRegExp1 = /^\w(\.?\w)*@\w(\.?[-\w])*\.[a-z]{2,4}$/i;
	var invalidSpaceRegExp1 = /[^ ]/i;
    var mail = document.user_mail.mail.value;

 if(document. user_mail.mail.value.length<=0) 
{
		msg = "Email ID is required";
		document. user_mail.mail.focus();
		document. user_mail.mail.select();
	} else if(!invalidSpaceRegExp1.test(document.user_mail.mail.value))
	{
		msg = "Space not allowed in email ID";
		document. user_mail.mail.focus();
		document. user_mail.mail.select();
	} else if(!validFormatRegExp1.test(document.user_mail.mail.value))
	{
		msg = "Invalid email ID";
		document. user_mail.mail.focus();
		document. user_mail.mail.select();
   }
if(msg.length!=0)
	{
		alert(msg);
		return false;
	}
	return true;
	
}
	*/
