//==================================================================================================
// HOME PAGE FUNCTIONS:
//--------------------------------------------------------------------------------------------------

function submitLoginForm_Click(e: Event) {
   if (!HById.InputElement('checkBoxLoginChecking').checked)
      return
   let accountCode = HById.InputElement('accountCodeBox').value.trim()
   if (accountCode == '') {
      alert('Account code is empty.')
      e.preventDefault()
      return
   }
   if (accountCode.startsWith(' ')) {
      alert('Account code must not start with space(s).')
      e.preventDefault()
      return
   }
   if (!(accountCode.length == 10 && accountCode.match('[0-9]+'))) {
      alert('Account code must contain exactly 10 digits.')
      e.preventDefault()
      return
   }
   if (Number.parseInt(accountCode) == 0) {
      alert('Positive account code (>0) is expected.')
      e.preventDefault()
      return
   }
   if (accountCode == "") {
      alert('User access code is empty.')
      e.preventDefault()
      return
   }
   if (HById.InputElement('accessCodeBox').value == "") {
      alert('Please, specify user access code.')
      e.preventDefault()
      return
   }
}

//==================================================================================================
// GLOBAL VARIABLES AND FUNCTION CALLS (PAGE SCRIPT):
//--------------------------------------------------------------------------------------------------

let submitLoginForm = document.getElementById('submitLoginForm')
if (submitLoginForm)
   submitLoginForm.addEventListener('click', submitLoginForm_Click)

//==================================================================================================
