function ValidateForm ( )
{
    valid = true;
    
     if ( document.CForm.fname.value == "" )
    {
        alert ( "Please enter your first name." );
        document.CForm.fname.focus()
        return false
    }

        

    if ( document.CForm.lname.value == "" )
    {
        alert ( "Please enter your last name." );
        document.CForm.lname.focus()
        return false
    }

    
  if ( document.CForm.Phone.value == "" )
    {
        alert ( "Please enter your telephone number." );
        document.CForm.Phone.focus()
         return false
    }

 if ( document.CForm.Subject2.value == "Pick a Subject" )
    {
        alert ( "Please select a subject." );
        document.CForm.Subject2.focus()
        return false
    }



  var iChars = "@#$%^&*+=[]\\;/{}|\":<>";
  
  
  for (var i = 0; i < document.CForm.fname.value.length; i++) {
  	if (iChars.indexOf(document.CForm.fname.value.charAt(i)) != -1) {
  	alert ("Your first name has special characters. \nThese are not allowed.\n Please remove them and try again.");
  	return false;
  	}
  }
 


  for (var i = 0; i < document.CForm.lname.value.length; i++) {
  	if (iChars.indexOf(document.CForm.lname.value.charAt(i)) != -1) {
  	alert ("Your last name has special characters. \nThese are not allowed.\n Please remove them and try again.");
  	return false;
  	}
  }
 


  
  for (var i = 0; i < document.CForm.Phone.value.length; i++) {
  	if (iChars.indexOf(document.CForm.Phone.value.charAt(i)) != -1) {
  	alert ("Your telephone number has special characters. \nThese are not allowed.\n Please remove them and try again.");
  	return false;
  	}
  }


function echeck(str) {
  var at="@"
  var dot="."
  var lat=str.indexOf(at)
  var lstr=str.length
  var ldot=str.indexOf(dot)
  if (str.indexOf(at)==-1){
     alert("Please enter a valid email")
     return false
  }
  if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
     alert("Please enter a valid email")
     return false
  }
  if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
      alert("Please enter a valid email")
      return false
  }
   if (str.indexOf(at,(lat+1))!=-1){
      alert("Please enter a valid email")
      return false
   }
   if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
      alert("Please enter a valid email")
      return false
   }
   if (str.indexOf(dot,(lat+2))==-1){
      alert("Please enter a valid email")
      return false
   }
   if (str.indexOf(" ")!=-1){
      alert("Please enter a valid email")
      return false
   }
   return true          
}


  var emailID=document.CForm.Email
  
 
  if (echeck(emailID.value)==false){
    emailID.value=""
    emailID.focus()
    return false
  }




    return true;
}
