//javascript here performs form validation
//author: reid burkhardt

<!--
var whitespace = " \t\n\r";
/* Define validations to run */

validations = new Array();

validations[0] = ["document.form.email", "validemail"];

function isEmpty(s)
{
   var i;
   if((s == null) || (s.length == 0))
     return true;
   // Search string looking for characters that are not whitespace
    for (i = 0; i < s.length; i++)
    {   
        var c = s.charAt(i);
        if (whitespace.indexOf(c) == -1) 
              return false;
    }
    // All characters are whitespace.
    return true;
}

function isEmail(field)
{ 
  var positionOfAt;
  var s = field.value;
  if (isEmpty(s))
   {
       alert("An email address is required.");
       field.focus();
       return false;
   }
  positionOfAt = s.indexOf('@',1);  
  if ( ( positionOfAt == -1) || (positionOfAt == (s.length-1))  )
   {
    alert("Please enter a valid email address.");
    field.focus();
    return false;
   }
   return true;
}

function validate()
{
 var i;
 var checkToMake;
 var field;

 for (i = 0; i < validations.length; i++)
   {
     checkToMake = validations[i][1];
     field = eval(validations[i][0]); 
     switch (checkToMake)
      {
       case 'notblank': if (isEmpty(field.value))
                          {
                           alert("Please complete all fields before we send your comments.");
                            field.focus();
                           return false;
                          }
                         break;
         case 'validemail' : if (!isEmail(field))
                               return false;
                               break;

       }
  }    
  {
                           return true;
                          }
}
-->
