/* if enter_submit is set to "1" then the enter key submited the form */
document.write("<input type='hidden' name='enter_submit' value='0'>");

var NS4 = (navigator.appVersion.indexOf("MSIE") != -1) ? false : true;

if (NS4) {
//  document.captureEvents(Event.KEYPRESS);   // can't get Netscape to work now
//  document.onkeypress = chkKey;
}
else {
  document.onkeypress = chkKey;
}

if (document.forms.length > 0) {
  var field = document.forms[0];
  for (i = 0; i < field.length; i++) {
    if ((field.elements[i].type == "text") 
        || (field.elements[i].type == "textarea")) {
      document.forms[0].elements[i].focus();
      break;
    }
  }
}
function chkKey(e) {
  var intKey = (NS4) ? e.which : event.keyCode;
  if (!NS4) {         // can't get Netscape to work now
    if (intKey == 13) {
      if (document.search.action == "/index.asp")
      {
        if (document.search.business_name.value == "")
        {
          document.login.submit();
        }
        else
        {
          submitSearch(1);
        }
      }
      if (document.search.action == "/index_phone.asp")
      {
        if (document.search.phone_number.value == "")
        {
          document.login.submit();
        }
        else
        {
          submitSearch(1);
        }
      }
      if (document.search.action == "/index_executive.asp")
      {
        if (document.search.first_name.value == "" || document.search.last_name.value == "")
        {
          document.login.submit();
        }
        else
        {
          submitSearch(1);
        }
      }
      if (document.search.action == "/index_address.asp")
      {
        if (document.search.streetNumber.value == "" || document.search.streetName.value == "")
        {
          document.login.submit();
        }
        else
        {
          submitSearch(1);
        }
      }
      if (document.search.action == "/index_ucclisting.asp")
      {
        if (document.search.debtor.value == "" || document.search.securedParty.value == "" || document.search.filingNumber.value == "")
        {
          document.login.submit();
        }
        else
        {
          submitSearch(1);
        }
      }
      if (document.search.action == "/index_websiteURL.asp")
      {
        if (document.search.webAddress.value == "")
        {
          document.login.submit();
        }
        else
        {
          submitSearch(1);
        }
      }
      if (document.search.action == "/index_people.asp")
      {
        if (document.search.first_name.value == "" || document.search.last_name.value == "" || document.search.phone_number.value == "")
        {
          document.login.submit();
        }
        else
        {
          submitSearch(1);
        }
      }
//      defaultSubmit();
    }
  }
}

