// JavaScript Document

function doValidation(theForm)
{

  if (theForm.name.value == "")
  {
    alert("Please enter your Name.");
    theForm.name.focus();
    return (false);
  }
  
  if (theForm.name.value.length > 256)
  {
    alert("Please enter at most 256 characters in the \"Name\" field.");
    theForm.name.focus();
    return (false);
  }
  
  if (theForm.bestphone.value == "")
  {
    alert("Please enter the best contact phone number.");
    theForm.bestphone.focus();
    return (false);
  }
  
    if (theForm.bestphone.value.length < 10)
  {
    alert("Please enter a valid best contact phone number");
    theForm.bestphone.focus();
    return (false);
  }

  if(theForm.email.value == "" || theForm.email.value.lastIndexOf("@")==-1 || theForm.email.value.lastIndexOf(".")==-1)
  {
          alert("Please enter a valid email address.");
          theForm.email.focus();
          return (false);
  }
	
    var emailArr=theForm.email.value.split("@");
	user=emailArr[0];
	domainAddress=emailArr[1];
	var domainAddressArr=domainAddress.split(".");
	domain=domainAddressArr[0];
	net=domainAddressArr[1];

	if(user.length==0 || domain.length==0 || net.length==0)
	{
          alert("Please enter a valid email address.");
          theForm.email.focus();
          return (false);
	}
	
 
  return (true);

}

