     //global variable for error flag
     var errfound = false;
     //function to validate by length
     function ValidLength(item, len)
         { return (item.length >= len); }
     //function to validate an email address
     function ValidEmail(item)
         { if (!ValidLength(item, 5)) return false;
           if (item.indexOf ('@', 0) == -1) return false;
           return true; }
     // display an error alert
     function error(elem, text)
         { // abort if we already found an error
           if (errfound) return; window.alert(text);
           elem.select(); elem.focus(); errfound = true;
          }
     // student discount validation function
     function Validate2()
          { errfound = false;
            if (!ValidLength(document.schoolorder.os0.value,6))
               error(document.schoolorder.os0,"Invalid Name");
                  return !errfound; /* true if there are no errors */
          }
     // e-book validation function
     function Validate3()
          { errfound = false;
            if (!ValidEmail(document.ebook.os0.value))
               error(document.ebook.os0, "Invalid Email Address");
                  return !errfound; /* true if there are no errors */
          }
