<!-- hide this script from non-javascript-enabled browsers

////////////////////////////////////////////////////////////
// Checks to see whether a value contains non-numeric
// data.
////////////////////////////////////////////////////////////
function isANumber(inputValue){

    // Assume everything is okay
    var result = true

    // If parseFloat() returns false, a non-numeric character
    // was detected in the first position
    if (!parseFloat(inputValue)) {
        result = false
    }

    // Otherwise, we still have to check the rest of the digits,
    // so step through the inputValue one character at
    // a time and set result = false if any non-numeric
    // digits are encountered.
    else {
	for (var i=0; i<inputValue.length; i++) {
           if (inputValue.charAt(i) != " ") {
               if (!parseFloat(inputValue.charAt(i))) {
                   result = false
                   break
	         }
	     }
	}
    }

    // Return true (inputValue is a valid number) or
    // false (it's invalid).
    return result
}

////////////////////////////////////////////////////////////
// Checks to see whether an input value contains "@" and
// "."
////////////////////////////////////////////////////////////
function isAValidEmail(inputValue) {

    var foundAt = false
    var foundDot = false
    var atPosition = -1
    var dotPosition = -1  

    // Step through the inputValue looking for
    // "@" and "."

    for (var i=0; i<=inputValue.length; i++) {
      if (inputValue.charAt(i) == "@" ) {
          foundAt = true
	  atPosition = i
      }
      else if (inputValue.charAt(i) == ".") {
          foundDot = true
	  dotPosition = i
      }
    }
  
    // If both "@" and "." were found, assume
    // the e-mail address is valid; otherwise,
    // return false so the calling code knows
    // the e-mail address is invalid.

    if ((foundAt && foundDot) && (atPosition < dotPosition)){
        return true
    }
    else {
        return false
    }
}

////////////////////////////////////////////////////////////
// Checks to see if an input value contains 10 or more
// numbers.  This approach lets users type in U.S.-style
// phone formats, such as (123)456-7890,  as well as
// European-style 123.456.7890
////////////////////////////////////////////////////////////
function isAValidPhoneNumber(inputValue) {
    var digitsFound = 0

    // Step through the inputValue to see how
    // many digits it contains

    for (var i=0; i<=inputValue.length; i++) {
      if (isANumber(inputValue.charAt(i))) {
          digitsFound++
      }
    }
  
    // If inputValue contains at least 10
    // digits, assume it is a valid phone number
    if (digitsFound >= 10) {
        return true
    }
    else {
        return false
    }
}

////////////////////////////////////////////////////////////
// Checks for the existence of characters.  (Spaces aren't
// counted.)
////////////////////////////////////////////////////////////

function exists(inputValue) {

    var aCharExists = false

    // Step through the inputValue, using the charAt()
    // method to detect non-space characters.

    for (var i=0; i<=inputValue.length; i++) {
      if (inputValue.charAt(i) != " " && inputValue.charAt(i) != "") {
          aCharExists = true
          break
      }
    }

    return aCharExists
}

////////////////////////////////////////////////////////////
// Checks that all required fields have been filled in
// when submit button is pressed.
////////////////////////////////////////////////////////////
function validateMailForm() {

   var rc = true

   /////////////////////////////////////////////////////////////
   // 
   /////////////////////////////////////////////////////////////

     if (!document.contact.Name.value ){
           alert("The required Name field has not been filled in! Please go back and enter your name.")
       rc = false
   }
  if (!document.contact.Country.value ){
           alert("The required Country field has not been filled in! Please go back and enter your country of residence.")
       rc = false
   }
   if (!document.contact.Email.value ){
           alert("The required Email field has not been filled in! Please go back and enter a valid email address.")
       rc = false
   }
    if (!document.contact.Subject.value ){
           alert("The required Subject field has not been filled in! Please go back and enter a Subject.")
       rc = false
   }
    




   if (rc) {
       // If the rc variable is non-zero, then the form data
       // passed with flying colors!
       alert("Thanks for taking the time to comment! I'll reply shortly.")
   }
   return rc
}

// -->
