/**
 * DHTML date validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */
// Declaring valid date character, minimum year and maximum year
var dtCh= "/";
var minYear=1900;
var maxYear=2100;

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function isDate(dtStr){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strMonth=dtStr.substring(0,pos1)
	var strDay=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		alert("The date format should be : mm/dd/yyyy")
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		alert("Please enter a valid month")
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		alert("Please enter a valid day")
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		alert("Please enter a valid date")
		return false
	}
return true
}


function chkEmail(field){
	var emailPat = /^(\".*\"|[A-Za-z]\w*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z]\w*(\.[A-Za-z]\w*)+)$/;
	var matchArray = field.match(emailPat);
	if(!emailPat.test(field)){
		alert("Your email address is invalid.  Please try again !!");
  		return false;
		}
	}



/*if (isDate(dt.value)==false){
		dt.focus()
		return false;
	}*/



function Validate1(x)
 {
 

 var retValue=false;
 var invalidChars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$%^&*(){}|\':;?/<>,.@-+=[]~`_ ";
 var i;
  
for(i=0;i<invalidChars.length;i++)
 {
  if(x.indexOf(invalidChars.charAt(i))>-1)
  {
     retValue=true;
     break;
   }
 }
 
return retValue;
 }




function validate_login() {

	if (document.login.myuserid.value==""){
	alert("Please Enter User ID");
        document.login.myuserid.select();
	document.login.myuserid.focus();
	return false;
	}

	if (document.login.mypassword.value==""){
	alert("Please Enter Password ");
        document.login.mypassword.select();
	document.login.mypassword.focus();
	return false;
	}

	document.login.method="POST";
	document.login.action="checklogin.php";
	document.login.submit();
}


function validate_myaccount() {
	if (document.myaccount.myuserid.value==""){
	alert("Please Enter your User ID");
    document.myaccount.myuserid.select();
	document.myaccount.myuserid.focus();
	return false;
	}
	if (document.myaccount.mypassword.value==""){
	alert("Please Enter your Password");
    document.myaccount.mypassword.select();
	document.myaccount.mypassword.focus();
	return false;
	}
document.myaccount.method = "POST";
document.myaccount.action = "checkmyaccount.php";
document.myaccount.submit();
}



function validate_register() {

var invalid = " "; // Invalid character is a space
var minLength = 6; // Minimum length
var pw1 = document.registerform.password.value;
var pw2 = document.registerform.repassword.value;

	if (document.registerform.fname.value==""){
	alert("Please Enter First Name");
    document.registerform.fname.select();
	document.registerform.fname.focus();
	return false;
	}

	if (document.registerform.lname.value==""){
	alert("Please Enter Last Name");
    document.registerform.lname.select();
	document.registerform.lname.focus();
	return false;
	}

/*	if (document.registerform.email.value==""){
	alert("Please Enter Email ");
	document.registerform.email.select();
	document.registerform.email.focus();
	return false;
	}
	if(chkEmail(document.registerform.email.value)==false){
	document.registerform.email.select();
        document.registerform.email.focus();
        return false;
	}*/

	if (document.registerform.home_phone.value==""){
	alert("Please Enter Home Phone ");
        document.registerform.home_phone.select();
	document.registerform.home_phone.focus();
	return false;
	}
    if(isNaN(document.registerform.home_phone.value)){
	alert("Home Phone should be Numeric");
	document.registerform.home_phone.select();
	document.registerform.home_phone.focus();
	return false;
	}

      if (document.registerform.email.value==""){
        alert("Please Enter Email ");
        document.registerform.email.select();
        document.registerform.email.focus();
        return false;
        }
        if(chkEmail(document.registerform.email.value)==false){
        document.registerform.email.select();
        document.registerform.email.focus();
        return false;
        }


/*	if (document.registerform.userid.value==""){
	alert("Please Enter User ID");
    document.registerform.userid.select();
	document.registerform.userid.focus();
	return false;
	}*/

	// check for a value in both fields.
if (pw1 == '' || pw2 == '') {
alert('Please enter your password twice.');
return false;
}
// check for minimum length
if (document.registerform.password.value.length < minLength) {
alert('Your password must be at least ' + minLength + ' characters long. Try again.');
return false;
}

// check for spaces
if (document.registerform.password.value.indexOf(invalid) > -1) {
alert("Sorry, spaces are not allowed.");
return false;
}
//else {
if (pw1 != pw2) {
alert ("You did not enter the same new password twice. Please re-enter your password.");
return false;
}
//}
document.registerform.action="register_insert.php";
document.registerform.method="POST";
//document.registerform.submit();
}



function validate_updateregister() {

var invalid = " "; // Invalid character is a space
var minLength = 6; // Minimum length
var pw1 = document.registerform.password.value;
var pw2 = document.registerform.repassword.value;

	if (document.registerform.fname.value==""){
	alert("Please Enter First Name");
    document.registerform.fname.select();
	document.registerform.fname.focus();
	return false;
	}

	if (document.registerform.lname.value==""){
	alert("Please Enter Last Name");
    document.registerform.lname.select();
	document.registerform.lname.focus();
	return false;
	}

/*	if (document.registerform.email.value==""){
	alert("Please Enter Email ");
	document.registerform.email.select();
	document.registerform.email.focus();
	return false;
	}
	if(chkEmail(document.registerform.email.value)==false){
	document.registerform.email.select();
        document.registerform.email.focus();
        return false;
	}*/

	if (document.registerform.home_phone.value==""){
	alert("Please Enter Home Phone ");
        document.registerform.home_phone.select();
	document.registerform.home_phone.focus();
	return false;
	}
    if(isNaN(document.registerform.home_phone.value)){
	alert("Home Phone should be Numeric");
	document.registerform.home_phone.select();
	document.registerform.home_phone.focus();
	return false;
	}

      if (document.registerform.email.value==""){
        alert("Please Enter Email ");
        document.registerform.email.select();
        document.registerform.email.focus();
        return false;
        }
        if(chkEmail(document.registerform.email.value)==false){
        document.registerform.email.select();
        document.registerform.email.focus();
        return false;
        }


/*	if (document.registerform.userid.value==""){
	alert("Please Enter User ID");
    document.registerform.userid.select();
	document.registerform.userid.focus();
	return false;
	}*/

	// check for a value in both fields.
if (pw1 == '' || pw2 == '') {
alert('Please enter your password twice.');
return false;
}
// check for minimum length
if (document.registerform.password.value.length < minLength) {
alert('Your password must be at least ' + minLength + ' characters long. Try again.');
return false;
}

// check for spaces
if (document.registerform.password.value.indexOf(invalid) > -1) {
alert("Sorry, spaces are not allowed.");
return false;
}
//else {
if (pw1 != pw2) {
alert ("You did not enter the same new password twice. Please re-enter your password.");
return false;
}
//}
document.registerform.action="register-update.php";
document.registerform.method="POST";
//document.registerform.submit();
}




function validate_short() {
	if (document.index.fname.value==""){
	alert("Please Enter First Name");
    document.index.fname.select();
	document.index.fname.focus();
	return false;
	}

	if (document.index.lname.value==""){
	alert("Please Enter Last Name");
    document.index.lname.select();
	document.index.lname.focus();
	return false;
	}

	if (document.index.email.value==""){
	alert("Please Enter Email ");
	document.index.email.select();
	document.index.email.focus();
	return false;
	}
	if(chkEmail(document.index.email.value)==false){
	document.index.email.select();
    document.index.email.focus();
    return false;
	}

document.index.action="https://www.billpayloan.com/form.php";
document.index.method="POST";
document.index.submit();
}




function chkEmail(field){
	var emailPat = /^(\".*\"|[A-Za-z]\w*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z]\w*(\.[A-Za-z]\w*)+)$/;
	var matchArray = field.match(emailPat);
	if(!emailPat.test(field)){
		alert("Your email address is invalid.  Please try again !!");
  		return false;
		}
	}

function validate()
{
if (document.frmLoanApplication.tdcApp_Customer_txtCustFName.value==""){
	alert("Please Enter First Name");
    document.frmLoanApplication.tdcApp_Customer_txtCustFName.select();
	document.frmLoanApplication.tdcApp_Customer_txtCustFName.focus();
	return false;
	}


if (document.frmLoanApplication.tdcApp_Customer_txtCustLName.value==""){
	alert("Please Enter Last Name");
    document.frmLoanApplication.tdcApp_Customer_txtCustLName.select();
	document.frmLoanApplication.tdcApp_Customer_txtCustLName.focus();
	return false;
	}
if (document.frmLoanApplication.tdcApp_Customer_txtCustEmail.value==""){
	alert("Please Enter Email ");
	document.frmLoanApplication.tdcApp_Customer_txtCustEmail.focus();
	return false;
}
if(chkEmail(document.frmLoanApplication.tdcApp_Customer_txtCustEmail.value)==false){
	document.frmLoanApplication.tdcApp_Customer_txtCustEmail.select();
    document.frmLoanApplication.tdcApp_Customer_txtCustEmail.focus();
    return false;
 }


	
if (!(document.frmLoanApplication.tdcApp_Customer_cboDOBMo.value) || !(document.frmLoanApplication.tdcApp_Customer_cboDOBDay.value) || !(document.frmLoanApplication.tdcApp_Customer_cboDOBYr.value)){
	alert("Please Select Date of Birth ");
	if (!(document.frmLoanApplication.tdcApp_Customer_cboDOBMo.value)){
	document.frmLoanApplication.tdcApp_Customer_cboDOBMo.focus();
	return false;
	}
	if (!(document.frmLoanApplication.tdcApp_Customer_cboDOBDay.value)){
	document.frmLoanApplication.tdcApp_Customer_cboDOBDay.focus();
	return false;
	}
	if (!(document.frmLoanApplication.tdcApp_Customer_cboDOBYr.value)){
	document.frmLoanApplication.tdcApp_Customer_cboDOBYr.focus();
	return false;
	}
	return false;
}
if(!(document.frmLoanApplication.tdcApp_Customer_cboDOBYr.value==""))
	{
if(document.frmLoanApplication.tdcApp_Customer_cboDOBYr.value >"1983")
	{
	alert("Age is Less Than 23 Years So Kindly Select another one");
document.frmLoanApplication.tdcApp_Customer_cboDOBYr.focus();
//document.frmLoanApplication.tdcApp_Customer_cboDOBYr.select();
return false;
		}
		}
if (!(document.frmLoanApplication.tdcApp_Customer_txtCustHomePhone.value) || !(document.frmLoanApplication.tdcApp_Customer_txtCustHomePhonesec.value) || !(document.frmLoanApplication.tdcApp_Customer_txtCustHomePhonethird.value)){
	alert("Please Enter HOME PHONE");
	if (!(document.frmLoanApplication.tdcApp_Customer_txtCustHomePhone.value)){
	document.frmLoanApplication.tdcApp_Customer_txtCustHomePhone.focus();
	return false;
	}
	if (!(document.frmLoanApplication.tdcApp_Customer_txtCustHomePhonesec.value)){
	document.frmLoanApplication.tdcApp_Customer_txtCustHomePhonesec.focus();
	return false;
	}
	if (!(document.frmLoanApplication.tdcApp_Customer_txtCustHomePhonethird.value)){
	document.frmLoanApplication.tdcApp_Customer_txtCustHomePhonethird.focus();
	return false;
	}
	return false;
}

if(isNaN(document.frmLoanApplication.tdcApp_Customer_txtCustHomePhone.value)){
	alert("HOME PHONE1 should be Numeric");
	document.frmLoanApplication.tdcApp_Customer_txtCustHomePhone.select();
	document.frmLoanApplication.tdcApp_Customer_txtCustHomePhone.focus();
	return false;
	}
if(isNaN(document.frmLoanApplication.tdcApp_Customer_txtCustHomePhonesec.value)){
	alert("HOME PHONE2 should be Numeric");
	document.frmLoanApplication.tdcApp_Customer_txtCustHomePhonesec.select();
	document.frmLoanApplication.tdcApp_Customer_txtCustHomePhonesec.focus();
	return false;
	}

if(isNaN(document.frmLoanApplication.tdcApp_Customer_txtCustHomePhonethird.value)){
	alert("HOME PHONE3 should be Numeric");
	document.frmLoanApplication.tdcApp_Customer_txtCustHomePhonethird.select();
	document.frmLoanApplication.tdcApp_Customer_txtCustHomePhonethird.focus();
	return false;
	}

/* if (!(document.frmLoanApplication.tdcApp_Customer_txtCustFax.value) || !(document.frmLoanApplication.tdcApp_Customer_txtCustFaxsec.value) || !(document.frmLoanApplication.tdcApp_Customer_txtCustFaxthird.value)){
	alert("Please Enter FAX NUMBER");
	if (!(document.frmLoanApplication.tdcApp_Customer_txtCustFax.value)){
	document.frmLoanApplication.tdcApp_Customer_txtCustFax.focus();
	return false;
	}
	if (!(document.frmLoanApplication.tdcApp_Customer_txtCustFaxsec.value)){
	document.frmLoanApplication.tdcApp_Customer_txtCustFaxsec.focus();
	return false;
	}
	if (!(document.frmLoanApplication.tdcApp_Customer_txtCustFaxthird.value)){
	document.frmLoanApplication.tdcApp_Customer_txtCustFaxthird.focus();
	return false;
	}
	return false;
}

if(isNaN(document.frmLoanApplication.tdcApp_Customer_txtCustFax.value)){
	alert("FAX NUMBER1 should be Numeric");
	document.frmLoanApplication.tdcApp_Customer_txtCustFax.select();
	document.frmLoanApplication.tdcApp_Customer_txtCustFax.focus();
	return false;
	}
if(isNaN(document.frmLoanApplication.tdcApp_Customer_txtCustFaxsec.value)){
	alert("FAX NUMBER2 should be Numeric");
	document.frmLoanApplication.tdcApp_Customer_txtCustFaxsec.select();
	document.frmLoanApplication.tdcApp_Customer_txtCustFaxsec.focus();
	return false;
	}

if(isNaN(document.frmLoanApplication.tdcApp_Customer_txtCustFaxthird.value)){
	alert("FAX NUMBER3 should be Numeric");
	document.frmLoanApplication.tdcApp_Customer_txtCustFaxthird.select();
	document.frmLoanApplication.tdcApp_Customer_txtCustFaxthird.focus();
	return false;
	} */

if (!(document.frmLoanApplication.tdcApp_Customer_txtCustSSN1.value) || !(document.frmLoanApplication.tdcApp_Customer_txtCustSSN2.value) || !(document.frmLoanApplication.tdcApp_Customer_txtCustSSN3.value)){
	alert("Please Enter SSN NUMBER");
	if (!(document.frmLoanApplication.tdcApp_Customer_txtCustSSN1.value)){
	document.frmLoanApplication.tdcApp_Customer_txtCustSSN1.focus();
	return false;
	}
	if (!(document.frmLoanApplication.tdcApp_Customer_txtCustSSN2.value)){
	document.frmLoanApplication.tdcApp_Customer_txtCustSSN2.focus();
	return false;
	}
	if (!(document.frmLoanApplication.tdcApp_Customer_txtCustSSN3.value)){
	document.frmLoanApplication.tdcApp_Customer_txtCustSSN3.focus();
	return false;
	}
	return false;
}

if(isNaN(document.frmLoanApplication.tdcApp_Customer_txtCustSSN1.value)){
	alert("SSN NUMBER1 should be Numeric");
	document.frmLoanApplication.tdcApp_Customer_txtCustSSN1.select();
	document.frmLoanApplication.tdcApp_Customer_txtCustSSN1.focus();
	return false;
	}
if(isNaN(document.frmLoanApplication.tdcApp_Customer_txtCustSSN2.value)){
	alert("SSN NUMBER2 should be Numeric");
	document.frmLoanApplication.tdcApp_Customer_txtCustSSN2.select();
	document.frmLoanApplication.tdcApp_Customer_txtCustSSN2.focus();
	return false;
	}

if(isNaN(document.frmLoanApplication.tdcApp_Customer_txtCustSSN3.value)){
	alert("SSN NUMBER3 should be Numeric");
	document.frmLoanApplication.tdcApp_Customer_txtCustSSN3.select();
	document.frmLoanApplication.tdcApp_Customer_txtCustSSN3.focus();
	return false;
	}

if (document.frmLoanApplication.tdcApp_Customer_txtCustDLNo.value==""){
	alert("Please Enter Driver LicenseID");
    document.frmLoanApplication.tdcApp_Customer_txtCustDLNo.select();
	document.frmLoanApplication.tdcApp_Customer_txtCustDLNo.focus();
	return false;
	}
	
if (document.frmLoanApplication.tdcApp_Customer_txtCustAdd1.value==""){
	alert("Please Enter ADDRESS1");
    document.frmLoanApplication.tdcApp_Customer_txtCustAdd1.focus();
	document.frmLoanApplication.tdcApp_Customer_txtCustAdd1.select();
   	return false;
	}
	
	if (document.frmLoanApplication.tdcApp_Customer_txtCustCity.value==""){
	alert("Please Enter CITY");
    document.frmLoanApplication.tdcApp_Customer_txtCustCity.focus();
	document.frmLoanApplication.tdcApp_Customer_txtCustCity.select();
   	return false;
	}
	
	if (document.frmLoanApplication.tdcApp_Customer_cboCustState.value==""){
	alert("Please Enter STATE");
    document.frmLoanApplication.tdcApp_Customer_cboCustState.focus();
//	document.frmLoanApplication.tdcApp_Customer_cboCustState.select();
   	return false;
	}
if(document.frmLoanApplication.tdcApp_Customer_txtCustZip.value == '' )
{
	alert("Please Enter Zip Code");
    document.frmLoanApplication.tdcApp_Customer_txtCustZip.select();
	document.frmLoanApplication.tdcApp_Customer_txtCustZip.focus();
	return false;
	}
var pattern2 = /^\d{5}$/ ;
if(!pattern2.test(document.frmLoanApplication.tdcApp_Customer_txtCustZip.value))
{
if(!pattern2.test(document.frmLoanApplication.tdcApp_Customer_txtCustZip.value) ==true)
{
alert('Invalid Zip Code!\nMust be in form 12345.\n' + 'Please re-enter.');
document.frmLoanApplication.tdcApp_Customer_txtCustZip.select();
document.frmLoanApplication.tdcApp_Customer_txtCustZip.focus();
return false;
}
}

if(document.frmLoanApplication.tdcApp_Customer_txtYrsAtCurrAdd.value == "" )
{
	alert("Please Enter RESIDENCE YEARS");
    document.frmLoanApplication.tdcApp_Customer_txtYrsAtCurrAdd.select();
	document.frmLoanApplication.tdcApp_Customer_txtYrsAtCurrAdd.focus();
	return false;
	}
if(document.frmLoanApplication.tdcApp_Customer_txtMnthsAtCurrAdd.value == "" )
{
	alert("Please Enter RESIDENCE MONTHS");
    document.frmLoanApplication.tdcApp_Customer_txtMnthsAtCurrAdd.select();
	document.frmLoanApplication.tdcApp_Customer_txtMnthsAtCurrAdd.focus();
	return false;
	}

if(document.frmLoanApplication.tdcApp_Customer_cboCustDLState.value == "" )
{
	alert("Please Select DRIVER'S LICENSE STATE");
    //document.frmLoanApplication.tdcApp_Customer_cboCustDLState.select();
	document.frmLoanApplication.tdcApp_Customer_cboCustDLState.focus();
	return false;
	}

if(document.frmLoanApplication.tdcApp_Customer_cboLoanAmount.value == "" )
{
	alert("Please Enter LOAN AMOUNT");
    //document.frmLoanApplication.tdcApp_Customer_cboLoanAmount.select();
	document.frmLoanApplication.tdcApp_Customer_cboLoanAmount.focus();
	return false;
	}

if (document.frmLoanApplication.tdcApp_Employer_txtJobTitle.value==""){
	alert("Please Enter JOBTITLE");
    document.frmLoanApplication.tdcApp_Employer_txtJobTitle.select();
	document.frmLoanApplication.tdcApp_Employer_txtJobTitle.focus();
	return false;
	}

if (!(document.frmLoanApplication.tdcApp_Employer_txtEmpPhone.value) || !(document.frmLoanApplication.tdcApp_Employer_txtEmpPhonesec.value) || !(document.frmLoanApplication.tdcApp_Employer_txtEmpPhonethird.value)){
	alert("Please Enter WORKPHONENUMBER");
	if (!(document.frmLoanApplication.tdcApp_Employer_txtEmpPhone.value)){
	document.frmLoanApplication.tdcApp_Employer_txtEmpPhone.focus();
	return false;
	}
	if (!(document.frmLoanApplication.tdcApp_Employer_txtEmpPhonesec.value)){
	document.frmLoanApplication.tdcApp_Employer_txtEmpPhonesec.focus();
	return false;
	}
	if (!(document.frmLoanApplication.tdcApp_Employer_txtEmpPhonethird.value)){
	document.frmLoanApplication.tdcApp_Employer_txtEmpPhonethird.focus();
	return false;
	}
	return false;
}
if(isNaN(document.frmLoanApplication.tdcApp_Employer_txtEmpPhone.value))
	{alert("WORKPHONENUMBER1 should be Numeric");
document.frmLoanApplication.tdcApp_Employer_txtEmpPhone.focus();
document.frmLoanApplication.tdcApp_Employer_txtEmpPhone.select();
	return false;
	}
if(isNaN(document.frmLoanApplication.tdcApp_Employer_txtEmpPhonesec.value))
	{alert("WORKPHONENUMBER2 should be Numeric");
document.frmLoanApplication.tdcApp_Employer_txtEmpPhonesec.focus();
document.frmLoanApplication.tdcApp_Employer_txtEmpPhonesec.select();
	return false;
	}
if(isNaN(document.frmLoanApplication.tdcApp_Employer_txtEmpPhonethird.value))
	{alert("WORKPHONENUMBER3 should be Numeric");
document.frmLoanApplication.tdcApp_Employer_txtEmpPhonethird.focus();
document.frmLoanApplication.tdcApp_Employer_txtEmpPhonethird.select();
	return false;
	}

/*if(!(document.frmLoanApplication.tdcApp_Employer_txtEmpPhoneExt.value==""))
	{ if(isNaN(document.frmLoanApplication.tdcApp_Employer_txtEmpPhoneExt.value){
	alert("EXTENSION  should be Numeric");
	//document.frmLoanApplication.tdcApp_Employer_txtEmpPhoneExt.select();
	document.frmLoanApplication.tdcApp_Employer_txtEmpPhoneExt.focus();
	return false;
	}
    
		alert("padma");
	//document.frmLoanApplication.tdcApp_Employer_txtEmpPhoneExt.focus();
	return false;
	}*/
if(document.frmLoanApplication.tdcApp_Employer_cboEmpState.value=="")
	{
	alert("Please Select STATE");
   document.frmLoanApplication.tdcApp_Employer_cboEmpState.focus();
   	return false;
	}

if(document.frmLoanApplication.tdcApp_Employer_txtEmpZip.value == '' )
{
	alert("Please Enter Zip Code");
    document.frmLoanApplication.tdcApp_Employer_txtEmpZip.select();
	document.frmLoanApplication.tdcApp_Employer_txtEmpZip.focus();
	return false;
	}
var pattern2 = /^\d{5}$/ ;
if(!pattern2.test(document.frmLoanApplication.tdcApp_Employer_txtEmpZip.value))
{
if(!pattern2.test(document.frmLoanApplication.tdcApp_Employer_txtEmpZip.value) ==true)
{
alert('Invalid Zip Code!\nMust be in form 12345.\n' + 'Please re-enter.');
document.frmLoanApplication.tdcApp_Employer_txtEmpZip.select();
document.frmLoanApplication.tdcApp_Employer_txtEmpZip.focus();
return false;
}
}

if (document.frmLoanApplication.tdcApp_Employer_txtEmpName.value==""){
	alert("Please Enter EMPLOYER NAME");
    document.frmLoanApplication.tdcApp_Employer_txtEmpName.focus();
	document.frmLoanApplication.tdcApp_Employer_txtEmpName.select();
   	return false;
	}

/*if (document.frmLoanApplication.tdcApp_Employer_txtEmpAdd1.value==""){
	alert("Please Enter ADDRESS1");
    document.frmLoanApplication.tdcApp_Employer_txtEmpAdd1.focus();
	document.frmLoanApplication.tdcApp_Employer_txtEmpAdd1.select();
   	return false;
	}*/
	
	if (document.frmLoanApplication.tdcApp_Employer_txtEmpCity.value==""){
	alert("Please Enter CITY");
    document.frmLoanApplication.tdcApp_Employer_txtEmpCity.focus();
	document.frmLoanApplication.tdcApp_Employer_txtEmpCity.select();
   	return false;
	}
if ((document.frmLoanApplication.tdcApp_Payroll_optEmplType_0.checked == false) && (document.frmLoanApplication.tdcApp_Payroll_optEmplType_1.checked== false)){
	alert("Please Check the TYPE OF EMPLOYMENT");
	document.frmLoanApplication.tdcApp_Payroll_optEmplType_0.focus();
	return false;
	}
if ((document.frmLoanApplication.tdcApp_Payroll_optPayBankruptcy_0.checked == false) && (document.frmLoanApplication.tdcApp_Payroll_optPayBankruptcy_1.checked== false)){
	alert("Have You Recently Filed For bankcruptcy?");
	document.frmLoanApplication.tdcApp_Payroll_optPayBankruptcy_0.focus();
	return false;
	}
if ((document.frmLoanApplication.tdcApp_Payroll_optTypeOfPayroll_0.checked == false) && (document.frmLoanApplication.tdcApp_Payroll_optTypeOfPayroll_1.checked== false)){
	alert("How do You Receive Your PAYCHECK?");
	document.frmLoanApplication.tdcApp_Payroll_optTypeOfPayroll_0.focus();
	return false;
	}
if ((document.frmLoanApplication.tdcApp_Payroll_optPeriodicity_0.checked == false) && (document.frmLoanApplication.tdcApp_Payroll_optPeriodicity_1.checked== false)&& (document.frmLoanApplication.tdcApp_Payroll_optPeriodicity_2.checked== false)&& (document.frmLoanApplication.tdcApp_Payroll_optPeriodicity_3.checked== false)){
	alert("How Often do You Receive Your PAYCHECK?");
	document.frmLoanApplication.tdcApp_Payroll_optPeriodicity_0.focus();
	return false;
	}
	if (document.frmLoanApplication.tdcApp_Payroll_txtAvgSalary.value==""){
	alert("Please Enter AMOUNT PAY PER CHECK");
    document.frmLoanApplication.tdcApp_Payroll_txtAvgSalary.focus();
	document.frmLoanApplication.tdcApp_Payroll_txtAvgSalary.select();
   	return false;
	}
if(isNaN(document.frmLoanApplication.tdcApp_Payroll_txtAvgSalary.value))
	{alert("AMOUNT PAY PER CHECK should be Numeric");
document.frmLoanApplication.tdcApp_Payroll_txtAvgSalary.focus();
document.frmLoanApplication.tdcApp_Payroll_txtAvgSalary.select();
	return false;
	}


if(document.frmLoanApplication.tdcApp_Payroll_cboLastPayDate.value=="")
	{
alert("Please Select Last PAY Date ");
return false;
}
else
	{
var last = document.frmLoanApplication.tdcApp_Payroll_cboLastPayDate.value;

//alert(last);
 var month_numeric;
var lastpaydaymonth = last.split("-");
/************Functioncalling************/
lastpaydatemonth_Actual =  monthmanipulation(lastpaydaymonth[0]);
/******* End of functioncalling and assigning******/
var lastpaydate_leadpoint = lastpaydaymonth[2]+"-"+lastpaydatemonth_Actual+"-"+lastpaydaymonth[1];
var lastpaydate_ezpayday = lastpaydatemonth_Actual+"/"+lastpaydaymonth[1]+"/"+lastpaydaymonth[2];
 document.frmLoanApplication.lastpaydate_modified.value = lastpaydate_leadpoint+"*"+lastpaydate_ezpayday;
 //alert(document.frmLoanApplication.lastpaydate_modified.value);
	}

if(document.frmLoanApplication.tdcApp_Payroll_cboNextPayDate.value=="")
	{
alert("Please Select NextPAY Date ");
return false;
}
else
	{
	var next = document.frmLoanApplication.tdcApp_Payroll_cboNextPayDate.value;
	//alert(next);
var	nextpaydaymonth = next.split("-");
nextpaydatemonth_Actual =  monthmanipulation(nextpaydaymonth[0]);
var nextpaydate_leadpoint = nextpaydaymonth[2]+"-"+nextpaydatemonth_Actual+"-"+nextpaydaymonth[1];
var nextpaydate_ezpayday = nextpaydatemonth_Actual+"/"+nextpaydaymonth[1]+"/"+nextpaydaymonth[2];
//alert(nextpaydate_leadpoint);
//alert(nextpaydate_ezpayday);

	document.frmLoanApplication.nextpaydate_modified.value = nextpaydate_leadpoint+"*"+nextpaydate_ezpayday;
	//alert(document.frmLoanApplication.nextpaydate_modified.value);
	}


if (document.frmLoanApplication.tdcApp_Bank_txtCustBankName.value==""){
	alert("Please Enter BANKNAME");
	document.frmLoanApplication.tdcApp_Bank_txtCustBankName.focus();
	document.frmLoanApplication.tdcApp_Bank_txtCustBankName.select();
   	return false;
	}
if ((document.frmLoanApplication.tdcApp_Bank_optCustAcctType_0.checked == false) && (document.frmLoanApplication.tdcApp_Bank_optCustAcctType_1.checked== false)){
	alert("Please Check ACCOUNT TYPE");
	document.frmLoanApplication.tdcApp_Bank_optCustAcctType_0.focus();
	return false;
	}
if (document.frmLoanApplication.tdcApp_Bank_txtCustABANo.value==""){
	alert("Please Enter ABANUMBER");
	document.frmLoanApplication.tdcApp_Bank_txtCustABANo.focus();
	document.frmLoanApplication.tdcApp_Bank_txtCustABANo.select();
   	return false;
	}
if(isNaN(document.frmLoanApplication.tdcApp_Bank_txtCustABANo.value)){
	alert("ABANUMBER should be Numeric");
	document.frmLoanApplication.tdcApp_Bank_txtCustABANo.select();
	document.frmLoanApplication.tdcApp_Bank_txtCustABANo.focus();
	return false;
	}
if (document.frmLoanApplication.tdcApp_Bank_txtCustAcctNo.value==""){
	alert("Please Enter ACCOUNTNUMBER");
	document.frmLoanApplication.tdcApp_Bank_txtCustAcctNo.focus();
	document.frmLoanApplication.tdcApp_Bank_txtCustAcctNo.select();
   	return false;
	}
if(isNaN(document.frmLoanApplication.tdcApp_Bank_txtCustAcctNo.value)){
        alert("BANK ACCOUNT NUMBER should be Numeric");
        document.frmLoanApplication.tdcApp_Bank_txtCustAcctNo.select();
        document.frmLoanApplication.tdcApp_Bank_txtCustAcctNo.focus();
        return false;
}

if(isNaN(document.frmLoanApplication.tdcApp_Bank_txtCustAcctNo.value)){
	alert("HOME PHONE1 should be Numeric");
	document.frmLoanApplication.tdcApp_Bank_txtCustAcctNo.select();
	document.frmLoanApplication.tdcApp_Bank_txtCustAcctNo.focus();
	return false;
	}


document.frmLoanApplication.btnSubmit.disabled="true";
document.frmLoanApplication.btnSubmit.value="Processing....";
document.getElementById('processing_txt').innerHTML = "<BR><b>Your Application is being Processed ... Please Wait ...</b>";
}


/*********************** FUnction to MAnipulate  lastpaydate and nextpaydate **********************/

function monthmanipulation(month1)
{
	//alert(month1);
	switch (month1)
   {
      case "January":
         month_numeric = '01';
         break;
      case "February":
         month_numeric = '02';
         break;
      case "March":
         month_numeric = '03';
         break;
      case "April":
         month_numeric = '04';
         break;
      case "May":
         month_numeric = '05';
         break;
      case "June":
         month_numeric = '06';
         break;
      case "July":
         month_numeric = '07';
         break;
      case "August":
         month_numeric = '08';
         break;
      case "September":
         month_numeric = '09';
         break;
      case "October":
         month_numeric = '10';
         break;
      case "November":
         month_numeric = '11';
         break;
      case "December":
         month_numeric = '12';
         break;
   }
   return month_numeric;
}
