function ValidateForm ( )
{
    valid = true;

    if ( document.CForm.Name.value == "" )
    {
        alert ( "Please enter your name." );
        valid = false;
    }

      if ( document.CForm.message.value == "" )
    {
        alert ( "Please enter a question or comment." );
        valid = false;
    }
    
     if ( document.CForm.Product.value == "" )
    {
        alert ( "Please enter the product you have a question about." );
        valid = false;
    }




  var iChars = "@#$%^&*+=[]\\;/{}|\":<>";

  for (var i = 0; i < document.CForm.Name.value.length; i++) {
  	if (iChars.indexOf(document.CForm.Name.value.charAt(i)) != -1) {
  	alert ("Your name has special characters. \nThese are not allowed.\n Please remove them and try again.");
  	return false;
  	}
  }
 

 for (var i = 0; i < document.CForm.message.value.length; i++) {
  	if (iChars.indexOf(document.CForm.message.value.charAt(i)) != -1) {
  	alert ("Your comment has special characters. \nThese are not allowed.\n Please remove them and try again.");
  	return false;
  	}
  }

  for (var i = 0; i < document.CForm.Product.value.length; i++) {
  	if (iChars.indexOf(document.CForm.Product.value.charAt(i)) != -1) {
  	alert ("Your product 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;
}
