   function validate_recommendation () {
      var firstname_entry   = document.theform.name_first.value;
      var lastname_entry    = document.theform.name_last.value;
      var from_email_entry  = document.theform.from_email.value;
      var to_email1_entry   = document.theform.to_email1.value;
      var to_email2_entry   = document.theform.to_email2.value;
      var to_email3_entry   = document.theform.to_email3.value;
      var to_email4_entry   = document.theform.to_email4.value;
      var to_email5_entry   = document.theform.to_email5.value;
      var to_email6_entry   = document.theform.to_email6.value;
      var to_email7_entry   = document.theform.to_email7.value;
      var to_email8_entry   = document.theform.to_email8.value;
      var to_email9_entry   = document.theform.to_email9.value;
      var to_email10_entry  = document.theform.to_email10.value;
      var subject_entry     = document.theform.subject.value;
      var message_entry     = document.theform.message.value;

      var emails_specified = 0;

      if ( ! check_for_text ( firstname_entry ) ) {
         error_message ( document.theform.name_first,
                         "Please enter your first name." );
         return false;
      }

      if ( ! check_for_text ( lastname_entry ) ) {
         error_message ( document.theform.name_last,
                         "Please enter your last name." );
         return false;
      }

      if ( ! check_for_text ( from_email_entry ) ) {
         error_message ( document.theform.from_email,
                         "Please enter your email address." );
         return false;
      }

      if ( ! validate_email ( from_email_entry,
                              document.theform.from_email ) ) {
         return false;
      }

      var emailIndex = 0;
      var emailArray = new Array( to_email1_entry, to_email2_entry,
                                  to_email3_entry, to_email4_entry,
                                  to_email5_entry, to_email6_entry,
                                  to_email7_entry, to_email8_entry,
                                  to_email9_entry, to_email10_entry );
      var email_elementArray = new Array( document.theform.to_email1,
                                          document.theform.to_email2,
                                          document.theform.to_email3,
                                          document.theform.to_email4,
                                          document.theform.to_email5,
                                          document.theform.to_email6,
                                          document.theform.to_email7,
                                          document.theform.to_email8,
                                          document.theform.to_email9,
                                          document.theform.to_email10 );

      for ( i = 0; i < emailArray.length; i++ ) {
         if ( check_for_text ( emailArray[i] ) ) {
            if ( ! validate_email ( emailArray[i],
                                    email_elementArray[i] ) ) {
               return false;
            }
            emails_specified++;
         }
      }

      if ( ! emails_specified ) {
         error_message ( document.theform.to_email1,
                         "You must enter at least one email address." );
         return false;
      }

      return true;
   }

   function validate_email ( email_val, email_element ) {
      if ( ! check_email ( email_val ) ) {
         error_message ( email_element,
                         email_val + " is not a valid email address." );
         return false;
      }

      return true;
   }

   function check_email ( email_value ) {
      var email_ats    = 0;
      var email_dots   = 0;
      var at_position  = 0;
      var dot_position = 0;
      var email_spaces = 0;
      var i;
 
      if ( email_value.length < 6 ) {
         return false;
      }

      for ( i = 0; i < email_value.length; i++ ) {
         if ( email_value.charAt (i) == "@" ) {
            email_ats++;
            at_position = i;
         }
         if ( email_value.charAt (i) == "." ) {
            email_dots++;
            dot_position = i;  // Will be set to last occurrence
         }
         if ( email_value.charAt (i) == " " ) {
            email_spaces++;
         }
      }

      if ( ( email_ats == 0 ) || ( email_ats > 1 ) ) {
         return false;
      }

      if ( email_dots == 0 ) {
         return false;
      }

      // Email must have characters after the @ sign:
      if ( ( email_value.charAt ( at_position + 1 ) == "" ) ||
           ( email_value.charAt ( at_position + 1 ) == " " ) ) {
         return false;
      }

      // Email must have characters after the dot:
      if ( ( email_value.charAt ( dot_position + 1 ) == "" ) ||
           ( email_value.charAt ( dot_position + 1 ) == " " ) ) {
         return false;
      }

      // Email must have characters before the @ sign:
      if ( ( email_value.charAt ( at_position - 1 ) == "" ) ||
           ( email_value.charAt ( at_position - 1 ) == " " ) ) {
         return false;
      }

      // Email must have characters before the dot:
      if ( ( email_value.charAt ( dot_position - 1 ) == "" ) ||
           ( email_value.charAt ( dot_position - 1 ) == " " ) ) {
         return false;
      }

      // Email must have dot after @ sign:
      if ( dot_position < at_position ) {
         return false;
      }

      if ( email_spaces > 0 ) {
         return false;
      }
 
      return true;
   }

   function check_for_text ( elem_value ) {
      var text_entry = 0;
      var i;

      for ( i = 0; i < elem_value.length; i++ ) {
         if ( elem_value.charAt (i) != " " ) {
            text_entry = 1;
         }
      }

      if ( text_entry == 0 ) {
         return false;
      }
      return true;
   }

   function error_message ( elem, text ) {
      window.alert ( text );
      elem.select ();
      elem.focus ();
   }
