// Error.js
// Copyright (C)2000 NetTek, LLC
// Tim McAdoo - 1/14/2000
// This is an error display routine
// 8/9/2000 - McAdoo - added element type checking

// error flag
var ErrorFound = false;

function Error (elem, text)
  // Tim McAdoo 1/14/2000 - this will display an error message and change the focus
  // 1. check to seet if another error reported
  // 2. give an error message
  // 3. select the element with the problem
  // 4. change focus to the element
  // 5. set the error flag to true
  {
    // check if an error has been found before - if no error before
    if (!ErrorFound)
      {
        // give an alert
        window.alert (text);

        // check if the element is not a select field
        if ( (elem.type != "select-one") && (elem.type != "select-multiple") )
          {
            // change the selection
            elem.select ();

            // change the focus
            elem.focus ();
          }

        // set the flag to indicate an error
        ErrorFound = true;
      }
  }
