
function validation()
{	

	if(document.form1.name.value == "")
	{
		alert("Name is complusory field");
		document.form1.name.focus();
		return false;
	}
	if(isNaN(document.form1.name.value) == false)
    {
       	alert("Name should be in alphabets");
       	document.form1.name.value = "";
		document.form1.name.focus();
        return false;
	}
	
	if(containswrong(document.form1.name.value))
		{
		alert("Name Contains junk!");
		document.form1.name.value = "";
		document.form1.name.focus();
		return false;
		}
	
	


	 if(document.form1.emailid.value == "")
    {
       alert("Email Id is Required.");
       document.form1.emailid.focus();
       return false;
    }                                    
   	   var intAt = document.form1.emailid.value.indexOf("@");
   	  var intDot=document.form1.emailid.value.lastIndexOf(".");
  	   if((intDot - intAt) < 3)
   	{
      alert("Invalid Email Id.");
      document.form1.emailid.value = "";
      document.form1.emailid.focus();
      return false;                
	}




	
	if(document.form1.mobile.value == "")
	{
		alert("Mobile no is complusory");
		document.form1.mobile.focus();
		return false;
	}
	if(isNaN(document.form1.mobile.value) == true)
    {
		 alert("Mobile no should be in digits");
       	 document.form1.mobile.value = "";
		 document.form1.mobile.focus();
         return false;
   }
	if(document.form1.mobile.value.length < 8 || document.form1.mobile.value.length > 11 )
	{
		alert("Mobile no should be of aleast of eigth digit and maximum of eleven digits");
		document.form1.mobile.value = "";
		document.form1.mobile.focus();
		return false;
	}


if(containswrong(document.form1.mobile.value))
		{
		alert("Name Contains junk!");
		document.form1.mobile.value = "";
		document.form1.mobile.focus();
		return false;
		}


	
	
}




function containswrong(param){
strLen1 = param.length;

for(i=0;i<strLen1;i++)
{
if((param.charAt(i)==";") || (param.charAt(i)=="=") || (param.charAt(i)=="+") || (param.charAt(i)=="*") || (param.charAt(i)=="#") || (param.charAt(i)=="$") || (param.charAt(i)=="%") || (param.charAt(i)=="^") || (param.charAt(i)=="?") || (param.charAt(i)=="@")||(param.charAt(i)=="/") || (param.charAt(i)=="<") || (param.charAt(i)==">")|| (param.charAt(i)=="-") || (param.charAt(i)=="~"))
{
return true;
}
}
return false;

}