function CompareDates(a,b){var c=a;var d=b;var e=parseInt(c.substring(0,2),10);var f=parseInt(c.substring(3,5),10);var g=parseInt(c.substring(6,10),10);var h=parseInt(d.substring(0,2),10);var i=parseInt(d.substring(3,5),10);var j=parseInt(d.substring(6,10),10);var k=new Date(g,e,f);var l=new Date(j,h,i);if(l>=k){return false}else return true}function ABAMod10(a){var b="0123456789";var c=a.length;var d=true;var e=parseInt(a);var f=a.toString();var g="abaDisplay2.asp?aba="+f;var h=0;var i=false;var j;for(var k=0;k<c;k++){j=""+a.substring(k,k+1);if(b.indexOf(j)=="-1")d=false}if(!d){alert("Not a Number")}if(c!=0){if(c!=9){alert("This is not a proper ABA length")}else{for(var l=0;l<c;l+=3){h+=parseInt(f.charAt(l),10)*3+parseInt(f.charAt(l+1),10)*7+parseInt(f.charAt(l+2),10)}if(h!=0&&h%10==0){i=true}else{alert("This is NOT a valid ABA Routing Number!");i=false}}}else{}if(!i){}else{}return i}function merge_value(a){var b=a.ph1.value+a.ph2.value+a.ph3.value;var c=a.emp_ph1.value+a.emp_ph2.value+a.emp_ph3.value;if(a.requested_amount.value==""){alert("Enter the Requested Amount");a.requested_amount.focus();return false}if(a.first_name.value==""){alert("Enter the First name");a.first_name.focus();return false}if(a.last_name.value==""){alert("Enter the Last name");a.last_name.focus();return false}if(a.month.value==""){alert("Enter the month");a.month.focus();return false}if(a.day.value==""){alert("Enter the day");a.day.focus();return false}if(a.year.value==""){alert("Enter the year");a.year.focus();return false}if(a.street_addr1.value==""){alert("Enter the Street Address");a.street_addr1.focus();return false}if(a.city.value==""){alert("Enter the City");a.city.focus();return false}if(a.state.value==""){alert("Enter the State");a.state.focus();return false}if(a.Zip.value==""){alert("Enter the Zip");a.Zip.focus();return false}else if(a.Zip.value.length!=5){alert("Please enter the valid Zip Code");a.Zip.focus();return false}if(a.months_at_address.value==""){alert("Enter The Months At Address");a.months_at_address.focus();return false}if(a.ph1.value==""){alert("Enter the Phone number");a.ph1.focus();return false}else if(a.ph1.value.length!=3){alert("Please enter the valid phone number");a.ph1.focus();return false}else{uname=a.ph1.value;if(!uname.match(/^[0-9()+ -]*$/)){alert("Please enter Valid Phone no.");a.ph1.focus();return false}}if(a.ph2.value==""){alert("Enter the Phone number");a.ph2.focus();return false}else if(a.ph2.value.length!=3){alert("Please enter the valid phone number");a.ph2.focus();return false}else{uname=a.ph2.value;if(!uname.match(/^[0-9()+ -]*$/)){alert("Please enter Valid Phone no.");a.ph2.focus();return false}}if(a.ph3.value==""){alert("Enter the Phone number");a.ph3.focus();return false}else if(a.ph3.value.length!=4){alert("Please enter the valid phone number");a.ph3.focus();return false}else{uname=a.ph3.value;if(!uname.match(/^[0-9()+ -]*$/)){alert("Please enter Valid Phone no.");a.ph3.focus();return false}}if(a.email.value==""){alert("Please enter Email Address .");a.email.focus();return false}else{email=a.email.value;if(email.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)!=-1){}else{alert("Please enter Valid Email Address.");a.email.focus();return false}}if(a.email.value!=a.email2.value){alert("Email and Verify Email is not same.");a.email2.focus();return false}if(a.own_home.value==""){alert("Are You a Home Owner");a.own_home.focus();return false}if(a.drivers_license.value==""){alert("Enter the Driver's License/State ID");a.drivers_license.focus();return false}if(a.drivers_license_st.value==""){alert("Enter the ID State");a.drivers_license_st.focus();return false}if(a.social_security1.value==""){alert("Enter Your Social Security Number");a.social_security1.focus();return false}else if(a.social_security1.value.length!=3){alert("Please enter the valid Social Security Number");a.social_security1.focus();return false}if(a.social_security2.value==""){alert("Enter Your Social Security Number");a.social_security2.focus();return false}else if(a.social_security2.value.length!=2){alert("Please enter the valid Social Security Number");a.social_security2.focus();return false}if(a.social_security3.value==""){alert("Enter Your Social Security Number");a.social_security3.focus();return false}else if(a.social_security3.value.length!=4){alert("Please enter the valid Social Security Number");a.social_security3.focus();return false}if(a.employer_name.value==""){alert("Enter Your Employers name");a.employer_name.focus();return false}if(a.income_type.value==""){alert("Enter the Income Type");a.income_type.focus();return false}if(a.months_employed.value==""){alert("Enter the Months Employed");a.months_employed.focus();return false}if(a.emp_ph1.value==""){alert("Enter the Phone number");a.emp_ph1.focus();return false}else if(a.emp_ph1.value.length!=3){alert("Please enter the valid phone number");a.emp_ph1.focus();return false}else{uname=a.emp_ph1.value;if(!uname.match(/^[0-9()+ -]*$/)){alert("Please enter Valid Phone no.");a.emp_ph1.focus();return false}}if(a.emp_ph2.value==""){alert("Enter the Phone number");a.emp_ph2.focus();return false}else if(a.emp_ph2.value.length!=3){alert("Please enter the valid phone number");a.emp_ph2.focus();return false}else{uname=a.emp_ph2.value;if(!uname.match(/^[0-9()+ -]*$/)){alert("Please enter Valid Phone no.");a.emp_ph2.focus();return false}}if(a.emp_ph3.value==""){alert("Enter the Phone number");a.emp_ph3.focus();return false}else if(a.emp_ph3.value.length!=4){alert("Please enter the valid phone number");a.emp_ph3.focus();return false}else{uname=a.emp_ph3.value;if(!uname.match(/^[0-9()+ -]*$/)){alert("Please enter Valid Phone no.");a.emp_ph3.focus();return false}}uname=a.phone_work_ext.value;if(!uname.match(/^[0-9()+ -]*$/)){alert("Please enter Valid Ext Phone no.");a.phone_work_ext.focus();return false}if(b==c){alert("Identical work and home phone numbers may decrease your chances of being matched with a lender.");a.emp_ph1.focus();return false}if(a.pay_frequency.value==""){alert("Enter The How Often are you Paid");a.pay_frequency.focus();return false}if(document.getElementById("military").value==""){alert("Are you active military");document.getElementById("military").focus();return false}var d=/\b(\d{2})\-(\d{2})\-(\d{4})\b/;var e=a.pay_day1.value;var f=a.pay_day2.value;if(a.pay_day1.value==""){alert("Enter the Pay Date One");a.pay_day1.focus();return false}if(!e.match(d)){alert("Enter The correct Pay Date One");a.pay_day1.focus();return false}var g=new Date;var h=g.format("mm-dd-yyyy");if(!CompareDates(e,h)){alert("PayDate1 must be your next payday after today");a.pay_day1.focus();return false}if(a.pay_day2.value==""){alert("Enter the Pay Date Two");a.pay_day2.focus();return false}if(!f.match(d)){alert("Enter The correct Pay Date Two");a.pay_day2.focus();return false}if(!CompareDates(f,h)){alert("PayDate2 must be your second payday after your next one");a.pay_day2.focus();return false}if(!CompareDates(f,e)){alert("PayDate2 cannot be smaller than PayDate1");a.pay_day2.focus();return false}if(a.direct_deposit.value==""){alert("How do you receive your paycheck?");a.direct_deposit.focus();return false}if(a.pay_per_period.value==""){alert("Enter the Amount of Last Paycheck");a.pay_per_period.focus();return false}if(a.bank_account_type.value==""){alert("Enter the Type of Account");a.bank_account_type.focus();return false}if(a.bank_name.value==""){alert("Enter the Name of Bank");a.bank_name.focus();return false}if(a.months_at_bank.value==""){alert("Enter the Months with Bank Account");a.months_at_bank.focus();return false}if(a.bank_aba.value==""){alert("Enter the ABA/Routing Number");a.bank_aba.focus();return false}else{if(!ABAMod10(a.bank_aba.value)){a.bank_aba.focus();return false}}if(a.bank_account.value==""){alert("Enter the Account Number");a.bank_account.focus();return false}if(a.accepted_terms.checked==false){alert("Please check the terms and conditions box");a.accepted_terms.focus();return false}a.birth_date.value=a.month.value+"-"+a.day.value+"-"+a.year.value;a.phone_home.value=a.ph1.value+a.ph2.value+a.ph3.value;a.phone_cell.value=a.alt_ph1.value+a.alt_ph2.value+a.alt_ph3.value;a.phone_work.value=a.emp_ph1.value+a.emp_ph2.value+a.emp_ph3.value;var i=a.social_security1.value+a.social_security2.value+a.social_security3.value;if(!i.match(/^[0-9_a-zA-Z ]*$/)){alert("Please Enter Valid Social_Security.\n Special characters are not allowed..");a.social_security1.focus();return false}else{a.social_security.value=a.social_security1.value+a.social_security2.value+a.social_security3.value}return true}
