<!-- Begin
// block error 
function blockError(){return true;}
window.onerror = blockError;

// count charachters in text field.
function CountLeft(field, max) 
{   
if (field.value.length > max) 
field.value = field.value.substring(0, max); 
} 

// validte email address
function validate_email(field,alerttxt)
{
with (field)
{
apos=value.indexOf("@")
dotpos=value.lastIndexOf(".")
if (apos<1||dotpos-apos<2) 
  {alert(alerttxt);return false}
else {return true}
}
}

// validate phone number field
function formatPhone(field)
{
     var theCount = 0;
     var theString = field.value;
     var newString = "";
     var myString = theString;
     var theLen = myString.length;
     for ( var i = 0 ; i < theLen ; i++ )
     {
     // Character codes for ints 1 - 9 are 48 - 57
          if ( (myString.charCodeAt(i) >= 48 ) && (myString.charCodeAt(i) <= 57) )
          newString = newString + myString.charAt(i);   
     }
// Now the validation to determine that the remaining string is 9 characters.
     if (newString.length == 10 )
     {
// Now the string has been stripped of other chars it can be reformatted to ###-##-#### 
          var newLen = newString.length;
          var newPhone = "";
          for ( var i = 0 ; i < newLen ; i++ )
          {
               if ( ( i == 2 ) || ( i == 5 ) )
               {
                    newPhone = newPhone + newString.charAt(i) + "-";
               }else{
                    newPhone = newPhone + newString.charAt(i);
               }
          }
          field.value = newPhone;
          return true;
     }else{
          alert("The phone number you entered "+newString+" does not contian the correct number of digits");
          field.focus();
          return false;
     }
}

  function checkForm(form)
  {

// regular expression to match alphanumeric characters and spaces
    var re = /^[\w ]*$/;
    
    // validation fails if the input doesn't match the regular expression
    if(!re.test(form.Comments.value)) {
      alert("Error: Comment Field contains invalid characters!");
      form.Comments.focus();
      return false;
    }
	else if(!re.test(form.name.value)) {
      alert("Error: Name Field contains invalid characters!");      
      return false;
    }
	
	else if(!re.test(form.Company.value)) {
      alert("Error: Company Field contains invalid characters!");      
      return false;
    }
	
	else if(!re.test(form.Address.value)) {
      alert("Error: Address Field contains invalid characters!");      
      return false;
    }
	else if(!re.test(form.CityStateZipe.value)) {
      alert("Error: CityStateZip Field contains invalid characters!");      
      return false;
    }
	
   else { 
    // validation was successful
    return true;
   }
   
  }


// -->


