// JavaScript Document
<!--
var isNN = (navigator.appName.indexOf("Netscape")!=-1);
if(isNN) document.captureEvents(Event.KEYPRESS);

function Validator(theForm)
{

  if (theForm.frmUserID.value == "630635982000")
  {
    alert("You are not authorized to file partials electronically.");
	return (false);
  }
  	
  if (theForm.frmUserID.value == "631197114000")
  {
    alert("You are not authorized to file partials electronically.");
	return (false);
  }
  	
  if (theForm.frmUserID.value == "")
  {
    alert("Please enter your full 12 digit UC Partials registration number.");
    theForm.frmUserID.focus();
    return (false);
  }

  if (theForm.frmUserID.value.length < 12)
  {
    alert("Please enter your full 12 digit UC Partials registration number.");
    theForm.frmUserID.focus();
    return (false);
  }

  var checkOK = "0123456789";
  var checkStr = theForm.frmUserID.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only \"0123456789\" characters in the UC Partials registration number field.");
    theForm.frmUserID.focus();
    return (false);
  }

  if (theForm.frmUserName.value == "")
  {
    alert("Please enter your contact name.");
    theForm.frmUserName.focus();
    return (false);
  }

  if (theForm.frmUserPhoneNumber1.value == "")
  {
    alert("Please enter area code information in the \"Contact's Phone Number\" field.");
    theForm.frmUserPhoneNumber1.focus();
    return (false);
  }

  if (theForm.frmUserPhoneNumber1.value.length < 3)
  {
    alert("Please enter complete information in the \"Claimants Phone Number\" fields.");
    theForm.frmUserPhoneNumber1.focus();
    return (false);
  }

  var checkOK = "0123456789";
  var checkStr = theForm.frmUserPhoneNumber1.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only \"0123456789\" characters in the \"Contact's Phone Number\" field.");
    theForm.frmUserPhoneNumber1.focus();
    return (false);
  }

  if (theForm.frmUserPhoneNumber2.value == "")
  {
    alert("Please enter complete information in the \"Contact's Phone Number\" fields.");
    theForm.frmUserPhoneNumber2.focus();
    return (false);
  }

  if (theForm.frmUserPhoneNumber2.value.length < 3)
  {
    alert("Please enter complete information in the \"Claimants Phone Number\" fields.");
    theForm.frmUserPhoneNumber2.focus();
    return (false);
  }

  var checkOK = "0123456789";
  var checkStr = theForm.frmUserPhoneNumber2.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only \"0123456789\" characters in the \"Contact's Phone Number\" fields.");
    theForm.frmUserPhoneNumber2.focus();
    return (false);
  }

  if (theForm.frmUserPhoneNumber3.value == "")
  {
    alert("Please enter complete information in the \"Contact's Phone Number\" fields.");
    theForm.frmUserPhoneNumber3.focus();
    return (false);
  }
  if (theForm.frmUserPhoneNumber3.value.length < 4)
  {
    alert("Please enter complete information in the \"Contact's Phone Number\" fields.");
    theForm.frmUserPhoneNumber3.focus();
    return (false);
  }

  var checkOK = "0123456789";
  var checkStr = theForm.frmUserPhoneNumber3.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only \"0123456789\" characters in the \"Contact's Phone Number\" fields.");
    theForm.frmUserPhoneNumber3.focus();
    return (false);
  }

  return (true);
}

function autoTab(input,len, e){
  var keyCode = (isNN)?e.which:e.keyCode; 
  var filter = (isNN)?[0,8,9]:[0,8,9,16,17,18,37,38,39,40,46];
  if(input.value.length >= len && !containsElement(filter,keyCode)){
    input.value = input.value.slice(0,len);
    input.form[(getIndex(input)+1)%input.form.length].focus();
  }
  
  function containsElement(arr, ele){
    var found = false, index = 0;
    while(!found && index < arr.length)
      if(arr[index]==ele)
        found = true;
      else
        index++;
    return found;
  }
  
  function getIndex(input){
    var index = -1, i = 0, found = false;
    while (i < input.form.length && index==-1)
      if (input.form[i] == input)index = i;
      else i++;
    return index;
  }
  return true;
}
//-->

