






                           function checkRegistration()
{
var string=document.frmstep2;
if(!isValidEmail(string.EMAIL.value))
      {
      alert("Please Enter the valid email ID");
      document.frmstep2.EMAIL.focus();
      return false;
      }
if(string.LOAN.value=="")
{
    alert("Please Enter Amount you would like to borrow");
    string.LOAN.focus();
    return false;
}

if(string.name1.value!="")
            {
              if(!isValidFirstName(string.name1.value))
              {
                alert("Please enter the correct first name");
                string.name1.focus();
                return false;
              }
            }else
            {
              alert("Please enter the first name");
              string.name1.focus();
              return false;
            }
if(string.name2.value!="")
            {
              if(!isValidLastName(string.name2.value))
              {
                alert("Please enter the correct last name");
                string.name2.focus();
                return false;
              }
            }else
            {
              alert("Please enter the last name");
              string.name2.focus();
              return false;
            }

if(!isValidStreetAddress(document.frmstep2.HOME_ADDRESS.value))
      {
      alert("Please enter the correct home address");
      string.HOME_ADDRESS.focus();
      return false;
      }
      if(!isValidCity(string.CITY.value))
      {
      alert("Please enter the correct city");
      string.CITY.focus();
      return false;
      }
if(!isValidCity(string.CITY.value))
      {
      alert("Please enter the correct city");
      string.CITY.focus();
      return false;
      }
if(!validateZIP(document.frmstep2.ZIP.value))
      {
      string.ZIP.focus();
      return false;
      }
      if(string.YEARS.value=="")
      {
      alert("Please select how many years you lived here");
      string.YEARS.focus();
      return false;
      }
  if(string.MONTHS.value=="")
      {
      alert("Please select how many months you lived here");
      string.MONTHS.focus();
      return false;
      }
 if(!check_phone_isnumber(document.frmstep2.PHONE1.value))
      {
      alert("Home Phone number must have 10 digit only");
      document.frmstep2.PHONE1.focus();
      return false;
      }
  if(!check_phone_isnumber(document.frmstep2.W_PHONE.value))
      {
      alert("Work Phone number must have 10 digit only");
      document.frmstep2.W_PHONE.focus();
      return false;
      }
    if(string.SSN1.value=="")
  {
    alert("Please enter your SSN");
    string.SSN1.focus();
    return false;
  }

      if(string.SSN2.value=="")
  {
    alert("Please enter SSN");
    string.SSN2.focus();
    return false;
  }

      if(string.SSN3.value=="")
  {
    alert("Please enter your  SSN");
    string.SSN3.focus();
    return false;
  }
   if(string.DM.value=="")
  {
    alert("Please enter your Month of Birth");
    string.DM.focus();
    return false;
  }

       if(string.DD.value=="")
  {
    alert("Please enter your Day of Birth");
    string.DD.focus();
    return false;
  }

        if(string.DY.value=="")
  {
    alert("Please enter your Year of Birth");
    string.DY.focus();
    return false;
  }
   if(string.LICENCE.value=="")
  {
    alert("Please enter your Drivers Licence Number");
    string.LICENCE.focus();
    return false;
  }

      if(string.LICENCESTATE.value=="")
  {
    alert("Please Select your Drivers Licence State");
    string.LICENCESTATE.focus();
    return false;
  }
   if(string.BANKNAME.value=="")
  {
    alert("Please your Bank Name");
    string.BANKNAME.focus();
    return false;
  }
if(!checkABA(document.frmstep2.ROUTING.value))
  {
    alert("Please enter your correct Routing Number [Hint: Routing number is the 9 digit number on your check");
    string.ROUTING.focus();
    return false;
  }
if(string.ACCOUNT.value=="")
  {
    alert("Please your Bank Account Number");
    string.ACCOUNT.focus();
    return false;
  }
if(!isValidEntirePhone(document.frmstep2.BPHONE.value))
      {
      alert("Bank Phone number is invalid, Please correct");
      document.frmstep2.BPHONE.focus();
      return false;
      }
  if(string.INCOMESOURCE.value=="")
  {
    alert("Please Select Income Source");
    string.INCOMESOURCE.focus();
    return false;
  }
   if(string.WORK.value=="")
  {
    alert("Please your employers Name");
    string.WORK.focus();
    return false;
  }
  if(string.INCOME.value=="")
  {
    alert("Please Select Net Monthly Income");
    string.INCOME.focus();
    return false;
  }
  if(string.PAYCYCLE.value=="")
  {
    alert("Please your Pay Cycle");
    string.PAYCYCLE.focus();
    return false;
  }
  if(string.NEXT_PAY_MM1.value=="")
  {
    alert("Please your Next Pay Month");
    string.NEXT_PAY_MM1.focus();
    return false;
  }

if(string.NEXT_PAY_DD1.value=="")
  {
    alert("Please your Next Pay Day");
    string.NEXT_PAY_DD1.focus();
    return false;
  }

if(string.NEXT_PAY_YYYY1.value=="")
  {
    alert("Please your Next Pay Year");
    string.NEXT_PAY_YYYY1.focus();
    return false;
  }

if(string.NEXT_PAY_MM2.value=="")
  {
    alert("Please your Second Next Pay Month");
    string.NEXT_PAY_MM2.focus();
    return false;
  }

if(string.NEXT_PAY_DD2.value=="")
  {
    alert("Please your Second Next Pay Day");
    string.NEXT_PAY_DD2.focus();
    return false;
  }

if(string.NEXT_PAY_YYYY2.value=="")
  {
    alert("Please your Second Next Pay Year");
    string.NEXT_PAY_YYYY2.focus();
    return false;
  }
  if(!isValidStreetAddress(document.frmstep2.W_ADDRESS.value))
      {
      alert("Please enter the correct Work address");
      string.W_ADDRESS.focus();
      return false;
      }


  if(string.W_CITY.value=="")
  {
    alert("Please your Work City");
    string.W_CITY.focus();
    return false;
  }
if(string.W_STATE.value=="")
  {
    alert("Please your Work State");
    string.W_STATE.focus();
    return false;
  }

if(!validateZIP(document.frmstep2.W_ZIP.value))
      {
      string.W_ZIP.focus();
      return false;
      }
  if(string.MHIRE.value=="")
  {
    alert("Please your Month of Hire");
    string.MHIRE.focus();
    return false;
  }

if(string.YHIRE.value=="")
  {
    alert("Please your Year of Hire");
    string.YHIRE.focus();
    return false;
  }
 if(!check_phone_isnumber(document.frmstep2.SUP_PHONE.value))
      {
      alert("Employer Phone number must have 10 digit only");
      document.frmstep2.SUP_PHONE.focus();
      return false;
      }

if(string.DIRECTDEPOSIT.value=="")
  {
    alert("Please your Deposit type");
    string.DIRECTDEPOSIT.focus();
    return false;
  }
if(string.CHECKING.value=="")
  {
    alert("Please your Account  type");
    string.CHECKING.focus();
    return false;
  }
if(string.TIME.value=="")
      {
      alert("Please select best time to call");
      string.TIME.focus();
      return false;
      }
  if(string.SUP.value=="")
  {
    alert("Please Enter your Supervisors  Name");
    string.SUP.focus();
    return false;
  }

 if(string.NSF.value=="")
  {
    alert("Please your how many NSF");
    string.NSF.focus();
    return false;
  }
 if(string.OWN.value=="")
      {
      alert("Please select whether you rent or own a Home");
      string.OWN.focus();
      return false;
      }
if(string.POSITION.value=="")
      {
      alert("Please enter Job Title");
      string.POSITION.focus();
      return false;
      }
if(string.REFN1.value!="")
            {
              if(!isValidLastName(string.REFN1.value))
              {
                alert("Please enter your Ist references correct first name");
                string.REFN2.focus();
                return false;
              }
            }else
            {
              alert("Please enter your Ist References first name");
              string.REFN1.focus();
              return false;
            }

if(string.REFN2.value!="")
            {
              if(!isValidLastName(string.REFN2.value))
              {
                alert("Please enter your Ist references correct first name");
                string.REFN2.focus();
                return false;
              }
            }else
            {
              alert("Please enter your Ist References last name");
              string.REFN2.focus();
              return false;
            }



if(string.REFN3.value!="")
            {
              if(!isValidLastName(string.REFN3.value))
              {
                alert("Please enter your 2nd references correct first name");
                string.REFN3.focus();
                return false;
              }
            }else
            {
              alert("Please enter your 2nd References first name");
              string.REFN3.focus();
              return false;
            }

if(string.REFN4.value!="")
            {
              if(!isValidLastName(string.REFN4.value))
              {
                alert("Please enter your 2nd references correct first name");
                string.REFN4.focus();
                return false;
              }
            }else
            {
              alert("Please enter your 2nd References last name");
              string.REFN4.focus();
              return false;
            }

            if(!check_phone_isnumber(document.frmstep2.REFP1.value))
      {
      alert("Ist References Phone number must have 10 digit only");
      document.frmstep2.REFP1.focus();
      return false;
      }



if(!check_phone_isnumber(document.frmstep2.REFP2.value))
      {
      alert("2nd References Phone number must have 10 digit only");
      document.frmstep2.REFP2.focus();
      return false;
      }
if(string.REFR1.value=="")
  {
    alert("Please select your Ist Refernces Relationship");
    string.REFR1.focus();
    return false;
  }
if(string.REFR2.value=="")
  {
    alert("Please select your 2nd Refernces Relationship");
    string.REFR2.focus();
    return false;
  }

  return true;
  }



  function check_phone_isnumber(phone_number)
{

  if(phone_number.length=='10')
  {
      for(i=0;i<phone_number.length;i++)
      {
      // alert(phone_number.length);
      var c = phone_number.charAt(i);
      // alert(c);
      if((c<"0") || (c>"9"))
      return false;
      }
  }
  else
  {
    //alert("Phone number must contain  10 digits");
    return false;
  }
   return true;  // All characters are numbers.

}
