// Validates user login credentials
function credentials(f){
  var bSubmitForm = false;
  if (!bSubmitForm) {
    f.elements["login"].value = checkInput(f.elements["login"].value);
    f.elements["password"].value = checkInput(f.elements["password"].value);
    bSubmitForm = ((f.elements["login"].value.length > 5) &&
      (f.elements["password"].value.length > 5));
    if (!bSubmitForm)
      alert("User ID and password are required.\nEach must contain at least 6 characters.");
    return bSubmitForm;
  };
};

// Strict
function checkInputStrict(str){
  if (window.RegExp)
    str = str.replace(/[^0-9A-Za-z_\-\.\@]/gi, "");
  return str;
}

// Permits internal spaces
function checkInput(str){
  if (window.RegExp)
    str = str.replace(/^\s+|[^0-9A-Za-z_\-\.\@\s]|\s+/gi, "");
  return str;
}

// Toggle display of block elements
function toggleDisplayAttr(el){
  with (el.style) {
    display = (display != "block") ? "block" : "none";
    visibility = (display != "none") ? "visible" : "hidden";
  }
  return false;
}