function doSubmit(){
      var newUrl = window.parent.location;
      var bir_year = document.Applicant.dob_year.value;
      var bir_month= document.Applicant.dob_month.value;
      var bir_day  = document.Applicant.dob_day.value;
      if(bir_month.length==1)bir_month="0"+bir_month;
      if(bir_day.length==1)bir_day="0"+bir_day;

      var birthday =bir_year+bir_month+bir_day;
    return false;
   //    if(document.Applicant.employed_flag.checked ==false){
   //        alert("Sorry, you must be currently employed or receiving recurring income. ");
  //         window.parent.location=newUrl;
   //    }else  if(document.Applicant.income_flag.checked ==false){
   //        alert("Sorry, you must make at least $1,000 / month.");
 //          window.parent.location=newUrl;
  //     }else  if(document.Applicant.ageverify_flag.checked ==false){
  //         alert("Sorry, you must be a US citizen and be at least 18 years of age.");
 //          window.parent.location=newUrl;
  //         alert("Sorry, you are less than 18 years of age.");
 //          window.parent.location=newUrl;
  //     }else{
  //         Applicant.submit();
 //      }

    }
function updateState_short_form()
{
    var license_state, job_employer_state;
    license_state = document.forms["Applicant"].elements["license_state"].value;
    document.forms["Applicant"].elements["job_employer_state"].value = license_state;
}
function getAge(dateString) {
/*
   parameters: dateString dateType
   returns: boolean
   dateString date format require:
   type 1 : 19970529
*/
    var now = new Date();
    var today = new Date(now.getYear(),now.getMonth(),now.getDate());
    var yearNow = now.getYear();
    if (yearNow < 2000) yearNow += 1900;
    var monthNow = now.getMonth();
    var dateNow = now.getDate();
    var dob = new Date(dateString.substring(0,4), dateString.substring(4,6)-1, dateString.substring(6,8));
    var yearDob = dob.getYear();
    if (yearDob < 2000) yearDob += 1900;
    var monthDob = dob.getMonth();
    var dateDob = dob.getDate();
    yearAge = yearNow - yearDob;

    if (monthNow >= monthDob)
        var monthAge = monthNow - monthDob;
    else {
        yearAge--;
        var monthAge = 12 + monthNow -monthDob;
    }
    if (dateNow >= dateDob)
        var dateAge = dateNow - dateDob;
    else {
        monthAge--;
        var dateAge = 31 + dateNow - dateDob;
        if (monthAge < 0) {
            monthAge = 11;
            yearAge--;
        }
    }
    return yearAge;
}

function updatePayday2()
{
    // calculating the second pay date
    var y, m, d;
    y = parseInt(document.forms["Applicant"].elements["income_nextpayday1_year"].value);
    m = parseInt(document.forms["Applicant"].elements["income_nextpayday1_month"].value);
    d = parseInt(document.forms["Applicant"].elements["income_nextpayday1_day"].value);

    var thedate = new Date();
    thedate.setYear(y);
    thedate.setDate(d);
    thedate.setMonth(m-1);
    thedate.setHours(0);
    thedate.setMinutes(0);
    thedate.setSeconds(0);

    var payfreq = document.forms["Applicant"].elements["income_pay_frequency"].value;

    if (payfreq == 'WEEKLY')
        dateAdd("D", +7, thedate);

    if (payfreq == 'BIWEEKLY')
        dateAdd("D", +14, thedate);

    if (payfreq == 'MONTHLY')
        dateAdd("M", +1, thedate);

    if (payfreq == 'TWICEMONTHLY')
        dateAdd("D", +14, thedate);

    var new_y, new_m, new_d
    new_y = (thedate.getYear()<1000)?1900+thedate.getYear():thedate.getYear();
    new_m = thedate.getMonth()+1;
    new_d = thedate.getDate();
    thedate = correctPayday(new_y, new_m, new_d);

    new_y = (thedate.getYear()<1000)?1900+thedate.getYear():thedate.getYear();
    new_m = thedate.getMonth()+1;
    new_d = thedate.getDate()

    var rN=new Array(12);rN[0]="Jan";rN[1]="Feb";rN[2]="Mar";rN[3]="Apr";rN[4]="May";rN[5]="Jun";rN[6]="Jul";rN[7]="Aug";rN[8]="Sep";rN[9]="Oct";rN[10]="Nov";rN[11]="Dec";
    //document.forms["Applicant"].elements["income_nextpayday2_month"].value = rN[new_m-1];
    document.forms["Applicant"].elements["income_nextpayday2_month"].value = new_m;
    document.forms["Applicant"].elements["income_nextpayday2_day"].value = new_d;
    document.forms["Applicant"].elements["income_nextpayday2_year"].value = new_y;
}



function updateCal()
{
    // do not process
    return;

    var sNewDate;
    var y, m, d;
    y = document.forms["Applicant"].elements["income_nextpayday1_year"].value;
    m = document.forms["Applicant"].elements["income_nextpayday1_month"].value;
    d = document.forms["Applicant"].elements["income_nextpayday1_day"].value;

    if ( !(m=='' || d=='') )
    {
        var i_y, i_m, i_d;
        i_y = parseInt(y);
        i_m = parseInt(m);
        i_d = parseInt(d);

        var correctedDate;
        correctedDate = correctPayday(i_y, i_m, i_d);

        //alert( "Changed to --> " + correctedDate);
        //alert(correctedDate.getYear()<1000)?1900+correctedDate.getYear():correctedDate.getYear());


        var new_y, new_m, new_d
        new_y = (correctedDate.getYear()<1000)?1900+correctedDate.getYear():correctedDate.getYear();
        new_m = correctedDate.getMonth()+1;
        new_d = correctedDate.getDate()

        document.forms["Applicant"].elements["income_nextpayday1_month"].value = new_m;
        document.forms["Applicant"].elements["income_nextpayday1_day"].value = new_d;
        document.forms["Applicant"].elements["income_nextpayday1_year"].value = new_y;


        sNewDate = new_m + "/" + new_d + "/" + new_y;
        document.forms["Applicant"].elements["cal_date"].value = sNewDate;

        updatePayday2();
    }
}

function updateState()
{
    var state, license_state, job_employer_state;
    state = document.forms["Applicant"].elements["state"].value;
    license_state = document.forms["Applicant"].elements["license_state"].value;
    job_employer_state = document.forms["Applicant"].elements["job_employer_state"].value;
    //if ( license_state == '' )
        document.forms["Applicant"].elements["license_state"].value = state;

    //if ( job_employer_state == '' )
        document.forms["Applicant"].elements["job_employer_state"].value = state;
}

function validateSSN(){
    var ssn=document.getElementById('ssn3_check').value;
    var doby=document.getElementById('dobY_check').value;
    if(ssn.length<4){
        document.getElementById('ssn_error').innerHTML="<font color='#BB1111' size='2'>SSN length should be 4</font><br><br>";
        return false;
    }
    if(doby==''){
        document.getElementById('ssn_error').innerHTML="<font color='#BB1111' size='2'>Please select the birth year</font><br><br>";
        return false;
    }
    var patrn=/^[0-9]{4}$/;
    if (patrn.exec(ssn)){
        return true;
    }else{
        document.getElementById('ssn_error').innerHTML="<font color='#BB1111' size='2'>ssn should be number</font><br><br>";
        return false;
    }
}
