function validateform(theform)
{

/*if(theform.name.value=="")
{
alert("Please enter your name.");
theform.name.select();
theform.name.focus();
return false;
}

else*/
{
for(var i=0;i<theform.name.value.length;i++)
{
 if(theform.name.value.charAt(i)<'A' ||  theform.name.value.charAt(i)>'Z')
{
 if(theform.name.value.charAt(i)<'a' ||  theform.name.value.charAt(i)>'z')
{
 if(!((theform.name.value.charAt(i)=='.') || (theform.name.value.charAt(i)==' ')))
 {
  alert("Only alphabets, a space and a . are allowed in the name field.");
  theform.name.select();
  theform.name.focus();
  return false;
 }
}
}
}
}

if(theform.telephone.value=="" && theform.email.value=="" && theform.fax.value=="")
{
 alert("Either the phone number or the email-id or the fax number is compulsory.");
 theform.telephone.select();
 theform.telephone.focus();
 return false;
}


if (theform.telephone.value!="")
{
 a = theform.telephone.value;
 var i=0;
 for(i=0;i<a.length;i++)
 {
  if(a.charAt(i) < '0' || a.charAt(i) > '9') 
  {
  if(!(a.charAt(i) == ' ' || a.charAt(i) == '(' || a.charAt(i)==')' || a.charAt(i)==',' || a.charAt(i)=='/' || a.charAt(i)=='-' || a.charAt(i)=='+' || a.charAt(i)=='[' || a.charAt(i)==']')) 
    {
     alert("Characters and Special symbols are not allowed in the Phone field.");
     theform.telephone.select();
     theform.telephone.focus();
     return false;
  }
   }
 }
}


if (theform.fax.value!="")
{
 a = theform.fax.value;
 var i=0;
 for(i=0;i<a.length;i++)
 {
  if(a.charAt(i) < '0' || a.charAt(i) > '9') 
  {
  if(!(a.charAt(i) == ' ' || a.charAt(i) == '(' || a.charAt(i)==')' || a.charAt(i)==',' || a.charAt(i)=='/' || a.charAt(i)=='-' || a.charAt(i)=='+' || a.charAt(i)=='[' || a.charAt(i)==']')) 
    {
     alert("Characters and Special symbols are not allowed in the Fax field.");
     theform.fax.select();
     theform.fax.focus();
     return false;
  }
   }
 }
}

if((theform.email.value.indexOf(".") == -1 || theform.email.value.indexOf("@") == -1) &&  theform.email.value != "")
{
alert("Please enter a valid email address.");
 theform.email.focus();
 theform.email.select(); 
  return false;
}


if(theform.age.value!="")
{
a = theform.age.value;
 var i=0;
 for(i=0;i<a.length;i++)
 {
  if(a.charAt(i) < '0' || a.charAt(i) > '9') 
  {
     alert("Characters and Special symbols are not allowed in the field.");
     theform.age.select();
     theform.age.focus();
     return false;
    }
   }
}



if(theform.weight.value!="")
{
a = theform.weight.value;
 var i=0;
 for(i=0;i<a.length;i++)
 {
  if(a.charAt(i) < '0' || a.charAt(i) > '9') 
  {
     alert("Characters and Special symbols are not allowed in the field.");
     theform.weight.select();
     theform.weight.focus();
     return false;
    }
   }
}


/*
if (theform.city.value=="")
{
 alert("Please enter name of the city.");
 theform.city.focus();
 theform.city.select();
 return false;
}

if (theform.pincode.value=="")
{
 alert("Please enter the pincode.");
 theform.pincode.focus();
 theform.pincode.select();
 return false;
}
else
{
 a = theform.pincode.value;
 var i=0;
 for(i=0;i<a.length;i++)
 {
  if(a.charAt(i) < '0' || a.charAt(i) > '9') 
  {
 if(!(a.charAt(i) == ' ' || a.charAt(i) == '(' || a.charAt(i)==')' || a.charAt(i)==',' || a.charAt(i)=='/' || a.charAt(i)=='-' || a.charAt(i)=='+' || a.charAt(i)=='[' || a.charAt(i)==']')) 
    {
     alert("Characters and Special symbols are not allowed in the Pin Code field.");
     theform.pincode.select();
     theform.pincode.focus();
     return false;
    }
   }
 }

}
*/


return true;
}


