function complaints(theForm)
{
if(theForm.cname.value == "")
{
alert ("Please enter your name.");
theForm.cname.select();
theForm.cname.focus();
return false;
}
else
{
for(var i=0;i<theForm.cname.value.length;i++)
{
if(theForm.cname.value.charAt(i)<'A' || theForm.cname.value.charAt(i)>'Z')
{
if(theForm.cname.value.charAt(i)<'a' || theForm.cname.value.charAt(i)>'z')
{
if(!((theForm.cname.value.charAt(i)=='.') || (theForm.cname.value.charAt(i)==' ')))
{
alert("Only alphabets, a space and a . are allowed in the name field.");
theForm.cname.select();
theForm.cname.focus();
return false;
}
}
}
}
}


/*if((theForm.emailid.value.indexOf(".") == -1 || theForm.emailid.value.indexOf("@") == -1) &&  theForm.emailid.value != "")
{
 alert("Please enter a valid email address");
 theForm.emailid.select(); 
 theForm.emailid.focus();
 return false;
}*/


if(theForm.emailid.value.indexOf(".") == -1 || theForm.emailid.value == "" || theForm.emailid.value.indexOf("@") == -1)
{
alert("Please enter a valid email address");
 theForm.emailid.focus();
 theForm.emailid.select(); 
  return false;
   }

if(theForm.address.value=="")
 {
  alert(" Please enter a valid address.");
  theForm.address.select();  
  theForm.address.focus();
  return false;
 }
if(theForm.comments.value=="")
 {
  alert(" Please enter a valid comments.");
  theForm.comments.select();  
  theForm.comments.focus();
  return false;
 }

return true;
}
