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 e-mail")
     return false
  }
  if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
     alert("Please enter a valid e-mail")
     return false
  }
  if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
      alert("Please enter a valid e-mail")
      return false
  }
   if (str.indexOf(at,(lat+1))!=-1){
      alert("Please enter a valid e-mail")
      return false
   }
   if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
      alert("Please enter a valid e-mail")
      return false
   }
   if (str.indexOf(dot,(lat+2))==-1){
      alert("Please enter a valid e-mail")
      return false
   }
   if (str.indexOf(" ")!=-1){
      alert("Please enter a valid e-mail")
      return false
   }
   return true          
}





function ValidateForm ( )
{


	//special characters tha we won't allow
	 var iChars = "#%^*+=[]\\/{}|<>";	


	
    valid = true;

    if ( document.CForm.Name.value == "" )
    {
        alert ( "Please enter your name." );
        valid = false;
    }


	
	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;
	  	}
	  }


    if ( document.CForm.Address1.value == "" )
    {
        alert ( "Please enter your address." );
        valid = false;
    }



	
	for (var i = 0; i < document.CForm.Address1.value.length; i++) {
	  	if (iChars.indexOf(document.CForm.Address1.value.charAt(i)) != -1) {
	  	alert ("The first line of your address has special characters. \nThese are not allowed.\n Please remove them and try again.");
	  	return false;
	  	}
	  }



	
	for (var i = 0; i < document.CForm.Address2.value.length; i++) {
	  	if (iChars.indexOf(document.CForm.Address2.value.charAt(i)) != -1) {
	  	alert ("The second line of your address has special characters. \nThese are not allowed.\n Please remove them and try again.");
	  	return false;
	  	}
	  }



     if ( document.CForm.City.value == "" )
    {
        alert ( "Please enter your city." );
        valid = false;
    }


	
	for (var i = 0; i < document.CForm.City.value.length; i++) {
	  	if (iChars.indexOf(document.CForm.City.value.charAt(i)) != -1) {
	  	alert ("Your city has special characters. \nThese are not allowed.\n Please remove them and try again.");
	  	return false;
	  	}
	  }


      if ( document.CForm.State.value == "" )
    {
        alert ( "Please enter your state." );
        valid = false;
    }
  

	for (var i = 0; i < document.CForm.State.value.length; i++) {
	  	if (iChars.indexOf(document.CForm.State.value.charAt(i)) != -1) {
	  	alert ("Your state has special characters. \nThese are not allowed.\n Please remove them and try again.");
	  	return false;
	  	}
	  }


   if ( document.CForm.Zip.value == "" )
    {
        alert ( "Please enter your zip code." );
        valid = false;
    }

	for (var i = 0; i < document.CForm.Zip.value.length; i++) {
	  	if (iChars.indexOf(document.CForm.Zip.value.charAt(i)) != -1) {
	  	alert ("Your zip code 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 phone number has special characters. \nThese are not allowed.\n Please remove them and try again.");
	  	return false;
	  	}
	  }


var emailID=document.CForm.Email;
  
  if ((emailID.value==null)||(emailID.value=="")){
    alert("Please enter your e-mail address")
    emailID.focus()
    return false
  }
  if (echeck(emailID.value)==false){
    emailID.value=""
    emailID.focus()
    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 message has special characters. \nThese are not allowed.\n Please remove them and try again.");
	  	return false;
	  	}
	  }



    return valid;
}
