// This file is for Javascript functions shared by OTIS and ECHO.
// Created by Greg Pelly on August 13, 2003

/************************************************************************
 * Takes as input the form element being examined and the "formIndex"
 * For example, if we were verifying the element document.forms[0].fac_name
 * the formIndex would be 0.  Ideally the function should determine which form
 * the element is part of, but this functionality has not been implemented yet  
 ***********************************************************************/
function isValidFacLength(element, formIndex) {
  var nameArray = element.value.split(" ");
  var nameCount = nameArray.length;  // checking to see how many words were entered
  for (var i = 0; i < nameCount; i++) {
    if (nameArray[i].length > 18) {
      alert('You may enter multiple words for a Facility Name, but each word must be at most 18 characters long.');
      eval("document.forms[" + formIndex + "]." + element.name + ".focus()");
      return false;
    }
  }
  return true;
} // end function



