// JavaScript Document

function Form1_validator(theform)
{
if (theform.txtName.value == "")
{
alert("Please enter your Name.")
theform.txtName.focus();
return false;
}

if (theform.txtName.value != "")
	{
		f=0;
		FName=theform.txtName.value;
		accept = "`!@#$%^*-+=\{}[:]|;<>?/" ;
		for (z = 0; z<FName.length; z++) 
		{ 
  			chart = FName.charAt(z);
  			if (accept.indexOf(chart) != -1) 
			{
				f=1;
				break;
			}
		}

		if (f==1)
		{
			alert("Special characters except ' \" _ ( ) & are not allowed for name field ");	 			
			theform.txtName.focus();
			return false;
		}
	}

if (theform.txtEmail.value == "")
{
alert("Please enter Email.")
theform.txtEmail.focus();
return false;
}

f=0;
st=document.Form1.txtEmail.value;

if (st.charAt(0)=="@")
{
alert("E-Mail id is invalid!");
document.Form1.txtEmail.focus();
}
else
if (st.charAt(st.length-1)=="@")
{
alert("E-Mail id is invalid!");
document.Form1.txtEmail.focus();
}

else
 if (st!="")
{
for (i=0;i<st.length;i++)
   {
    if (st.charAt(i)=="@")
      {
       f=1;
       break;
      } 
   }
if (f==0)
{
alert("E-Mail id is invalid!");
document.Form1.txtEmail.value="";
document.Form1.txtEmail.focus();
return false;
}

else
if (st.indexOf(".")==-1)
{
alert("invalid mail");
document.Form1.txtEmail.focus();
return false;
}
  }
  
return true;
}
