var ready=true;
var message="Please correct the following errors:\n\n";

// remove multiple, leading or trailing spaces
function cleanWhiteSpace(s){
	s = String(s);
	s = cleanLeftRight(s);
	s = cleanDouble(s);
	s = cleanReturn(s);
	return s;
}
function cleanLeftRight(s){
	s = s.replace(/(^\s*)|(\s*$)/gi,"");
	return s;
}
function cleanDouble(s){
	s = s.replace(/[ ]{2,}/gi," ");
	return s;
}
function cleanReturn(s){
	s = s.replace(/\n /,"\n");
	return s;
}
function replaceItem(itemName, newVal){
	document.getElementById(itemName).value=newVal;
}

function getInput(itemName) {
	t=document.getElementById(itemName).value;
	return t
}

function getCheckedRadio(groupName) {
    var radioButtons = document.getElementsByName(groupName);
    for (var x = 0; x < radioButtons.length; x ++) {
        if (radioButtons[x].checked) {
			//alert(groupName+": "+radioButtons[x].value);
			return radioButtons[x].value;
        }
	}
	//alert(groupName+": -10");
	return -10;
}

function getSelectedListItem(listName){
	var e = document.getElementById(listName);
	var strUser = e.options[e.selectedIndex].value;
}



//make sure any integer numbers are not greater than the largest int
function cleanInt(i){
	//translate 'good', 'fair', and 'poor' as would be received by condition inputs
	//into int values good=1, fair=0, poor=-1
	if(i==undefined){
		i=0;
	}else if(i=='good'){
		i=1;
	} else if(i=='fair'){
		i=0;
	} else if(i=='poor'){
		i=-1;
	} else {
		//remove anything after a period
		i=String(i);
		tempArray=i.split(".");
		i=tempArray[0];
	
		//remove any non-numeric characters
		i = i.replace(/\D/gi,"");
	
		if(i<0 && i!='') {
			i=0;
		} else if(i>2147483647) {
			i=2147483647;
		}
	}
	return i;
}
//make sure any date/times are properly formatted to be accepted by the db
//sets the ready flag to false and adds a message to be displayed
//3/29/2011 07:36:44 AM
function cleanDateTime(d, field){
	finalDate=d;
	//make sure the basic format is matched
	if(!d.match(/\d{2}\/\d{2}\/\d{4}/)){
		ready=false;
		message+="You have entered an invalid date in the "+field+" field.\n\n";
	} else {
		//split the date into month (d[0]), day (d[1]), and year (d[2])
		tempArray=d.split("/");
		
		//make sure month is within proper parameters
		if(tempArray[0] > 12) {
			tempArray[0]=12;
		} else if(tempArray[0]<1){
			tempArray[0]=1;
		}
		
		//make sure day is within proper parameters
		//if month is february, check for leap year 
		if(tempArray[0]==2){
			//Years divisible by 400 or divisible by 4 and not by 100 are leap Years
			if(tempArray[2] % 400==0 || (tempArray[2]%4==0 && tempArray[2]%100!=0)){
				//for february in a leap year, verify the day is not greater than 29
				if(tempArray[1] > 29){
					tempArray[1]=29;
				}
			//for february in a non-leap year, verify the day is not greater than 28
			} else {
				if(tempArray[1] > 28){
					tempArray[1]=28;
				}
			}
		//if month is april, june, september, or november, verify day is not greater than 30
		} else if(tempArray[0]==4 || tempArray[0]==6 || tempArray[0]==9 || tempArray[0]==11){
			if(tempArray[1] > 30){
				tempArray[1]=30;
			}
		//otherwise, verify the day is not greater than 31
		} else{
			if(tempArray[1] > 31){
				tempArray[1]=31;
			}
		}
		//verify the day is not less than 1
		if(tempArray[1]<1){
			tempArray[1]=1;
		}
		
		//verify the year is between 1895 and the current year + 1
		da = new Date();
		curr_year = da.getFullYear();
		if(tempArray[2] < 1895 || tempArray[2] > (curr_year+1)){
			ready=false;
			message+="You have entered an invalid date in the "+field+" field.\n\n";
		}		
		
		//piece the month, day, and year back together
		finalDate=tempArray[0]+"/"+tempArray[1]+"/"+tempArray[2];
	}
	return finalDate;
}
//TODO: add into cleanDate?
function cleanYear(year, field){
	year=cleanInt(year);
	da = new Date();
	curr_year = da.getFullYear();
	if(year < 1895 || year > (curr_year+1)){
			ready=false;
			message+="You have entered an invalid year in the "+field+" field.\n\n";
	}
	return year;

}
//make sure any varchars are not larger than allowed & remove harmful input
function cleanVarChar(s, num){
	//TODO: replace at some point
	s=String(s);
	//s=s.replace(/<script[^>]*?>.*?</script>/gi, ""); //remove scripts
	s=s.replace(/<[\/\!]*?[^<>]*?>/gi,""); //remove html
	s=s.replace(/<![\s\S]*?--[ \t\n\r]*>/gi, ""); //remove multi line comments 
	if(s.length >= num){
		s=s.substring(0, num);
	}
	return s;
}
//make sure any tiny integer numbers are not greater than the largest tiny int
function cleanTinyInt(ti){
	if(ti < 0){
		ti=0;
	} else if (ti > 255) {
		ti=255;
	}
	
	return ti;
}
//make sure anything submitted as a bit is truly 0 or 1
//convert and trues to 1 and falses to 0
//if req=0, field is not required
//if req=1, field is required
function cleanBit(b, question, req){
	if(b==-10 && req==1){
		ready=false;
		message+="You must respond to the following question: "+question+"\n\n";
	}
}
//make sure money is properly formated to be accepted by the db
//make sure the number is within the proper range
function cleanMoney(m){

	newM=m.replace(/[^\d\.\-\ ]/g, '');
	if(newM < 0){
		newM=0;
	} else if(newM > 922337203685477.5807){
		newM=922337203685477.58;
	}

	//verifies only 2 decimal places are allowed
	return newM
}
//make sure decimals are properly formatted to be accepted by the db
//make sure the number is within the proper range
//note: the only field which is decimal is 'miles', so I set the high bound to be 100,000,000 to EASILY be able to contain any 
//actual mileage entered without being succeptible to overflow issues
function cleanDecimal(d){
	//alert("start miles: "+d);
	if(!d){
		d=0.00;
	} else {
		d=d.replace(/[^\d\.\-\ ]/g, '');
	}
	d=d*1.0;
	if(d < 0){
		d=0;
	} else if(d > 100000000){
		d=100000000;
	}
	d=Math.round(d*100)/100;
	//alert("end miles: " +d);
	return d;
}




//allow no punctuation except , - 
//allow alphanum
function validateName(n, mi){
	n =String(n);
	if(mi){
		return cleanVarChar(n.replace(/([^A-Za-z0-9\-\, ])/gi,""), 1);
	}else{
		return cleanVarChar(n.replace(/([^A-Za-z0-9\-\, ])/gi,""), 50);
	}
}


//remove all punctuation & whitespace
//remove any beginning 1's
//make sure phone number is 7, 10, or 11 digits long after
//type 0=not required, type 1=required
//if type 0, only return invalid if it's not empty
function validatePhone(ph, field, type){
	newPH = ph;
	//remove any non numeric characters
	ph=newPH.replace( /\D/g, '' );
	
	//if they included a 0 or 1 as a prefix, remove them
	if(ph.charAt(0)==1 || ph.charAt(0)==0){
		ph=ph.substring(1,ph.length);
	}
	if(type==1){
	//verify it is the proper length
		if(ph.length!=7 && ph.length!=10){
			ready=false;
			message+="You have entered an invalid phone number in the "+field+" field.\n\n";
		}
	}
	return ph;
}

//remove all punctuation & whitespace
//make sure ssn is 9 digits long after
function validateSSN(ssn, field){
	newSSN=ssn;
	//remove any non numeric characters
	ssn=newSSN.replace( /\D/g, '' );
	
	//verify it is the proper length
	if((ssn < 1000000)||(ssn > 999999999)){
		ready=false;
		message+="You have entered an invalid social security number in the "+field+" field.\n\n";
	}
	if(ssn.charAt(0)=='0'){
		ssn=ssn.substring(1,ssn.length);
	}
	if(ssn.charAt(0)=='0'){
		ssn=ssn.substring(1, ssn.length);
	}
	if(ssn < 10000000){
			ssn='00'+ssn;
	} else if(ssn < 100000000){
		ssn='0'+ssn;
	}
	return ssn;
}

//make sure email matches email regex
function validateEmail(e, field){
	var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ 
	if(!e.match(re) && e){
		ready=false;
		message+="You have entered an invalid email in the "+field+" field.\n\n";
	} else {
		e=cleanVarChar(e, 50);
	}
	return e;
}

/*function cleanRadio(val, m){
	if(val==-10){
		ready=false;
		message+=m;
	}
}*/


//MAIN FUNCTIONS
function validate_app(){
	ready=true;
	message="Please correct the following errors:\n\n";
	
	//GET VARIABLES
	logTime=document.getElementById('Logtime').value;
	
	//applicant
	applicantPrefix=cleanInt(getSelectedListItem('ApplicantPrefix')); //dropdown
	applicantFirstName=validateName(getInput('ApplicantFirstName'), false);
	applicantMiddleName=validateName(getInput('ApplicantMiddleName'), true);
	applicantLastName=validateName(getInput('ApplicantLastName'), false);
	applicantSSN=validateSSN(getInput('ApplicantSSNWeb'), "Applicant Social Sec No.");
	applicantHomePhone=validatePhone(getInput('ApplicantHomePhoneWeb'), "Applicant Home Phone", 1);
	applicantCellPhone=validatePhone(getInput('ApplicantCellPhoneWeb'), "Applicant Cell Phone", 0);
	applicantDOB=cleanDateTime(getInput('ApplicantDob'), "Applicant Date of Birth");
	applicantEmail=validateEmail(getInput('ApplicantEmail'), "Applicant Email Address");
	
	//applicant address history
	applicantResAddr1=cleanVarChar(getInput('ApplicantResAddr1'), 50);
	applicantResCity1=cleanVarChar(getInput('ApplicantResCity1'), 50);
	applicantResSt1=cleanVarChar(getInput('ApplicantResSt1'), 15);
	applicantResZip1=cleanVarChar(getInput('ApplicantResZip1'), 10);
	applicantResYears1=cleanInt(getInput('ApplicantResYears1'));
	applicantResMonths1=cleanInt(getInput('ApplicantResMonths1'));
	
	applicantResAddr2=cleanVarChar(getInput('ApplicantResAddr2'), 50);
	applicantResCity2=cleanVarChar(getInput('ApplicantResCity2'), 50);
	applicantResSt2=cleanVarChar(getInput('ApplicantResSt2'), 15);
	applicantResZip2=cleanVarChar(getInput('ApplicantResZip2'), 10);
	applicantResYears2=cleanInt(getInput('ApplicantResYears2'));
	applicantResMonths2=cleanInt(getInput('ApplicantResMonths2'));
	
	applicantResAddr3=cleanVarChar(getInput('ApplicantResAddr3'), 50);
	applicantResCity3=cleanVarChar(getInput('ApplicantResCity3'), 50);
	applicantResSt3=cleanVarChar(getInput('ApplicantResSt3'), 15);
	applicantResZip3=cleanVarChar(getInput('ApplicantResZip3'), 10);
	applicantResYears3=cleanInt(getInput('ApplicantResYears3'));
	applicantResMonths3=cleanInt(getInput('ApplicantResMonths3'));
	
	//applicant employment history
	applicantEmpName1=cleanVarChar(getInput('ApplicantEmpName1'), 50);
	applicantEmpPhone1=validatePhone(getInput('ApplicantEmpPhone1Web'), "Applicant Employer Phone 1", 0);
	applicantEmpDesc1=cleanVarChar(getInput('ApplicantEmpDesc1'), 50);
	applicantEmpYears1=cleanInt(getInput('ApplicantEmpYears1'));
	applicantEmpMonths1=cleanInt(getInput('ApplicantEmpMonths1'));
	
	applicantEmpName2=cleanVarChar(getInput('ApplicantEmpName2'), 50);
	applicantEmpPhone2=validatePhone(getInput('ApplicantEmpPhone2Web'), "Applicant Employer Phone 2", 0);
	applicantEmpDesc2=cleanVarChar(getInput('ApplicantEmpDesc2'), 50);
	applicantEmpYears2=cleanInt(getInput('ApplicantEmpYears2'));
	applicantEmpMonths2=cleanInt(getInput('ApplicantEmpMonths2'));
	
	applicantEmpName3=cleanVarChar(getInput('ApplicantEmpName3'), 50);
	applicantEmpPhone3=validatePhone(getInput('ApplicantEmpPhone3Web'), "Applicant Employer Phone 3", 0);
	applicantEmpDesc3=cleanVarChar(getInput('ApplicantEmpDesc3'), 50);
	applicantEmpYears3=cleanInt(getInput('ApplicantEmpYears3'));
	applicantEmpMonths3=cleanInt(getInput('ApplicantEmpMonths3'));
	
		//applicant income info
	//applicantIncomeType=cleanRadio(getCheckedRadio('ApplicantIncomeType'), "applicant select one: hourly / salary / commission\n\n");
	applicantIncomeType=getCheckedRadio('ApplicantIncomeType');
	applicantIsFullTime=cleanBit(getCheckedRadio('ApplicantIsFullTime'), "applicant work type: part time / full time");
	applicantMonthlyIncomeAmount=cleanMoney(getInput('ApplicantMonthlyIncomeAmountWeb'));
	applicantGetsCommissionAlso=cleanBit(getCheckedRadio('ApplicantGetsCommissionAlso'), "applicant also gets commission?", 0);
	applicantCommissionAmount=cleanMoney(getInput('ApplicantCommissionAmountWeb'));
	applicantOtherIncomeAmount=cleanMoney(getInput('ApplicantOtherIncomeAmountWeb'));
	applicantOtherIncomeSource=cleanVarChar(getInput('ApplicantOtherIncomeSource'), 50);
	
	//applicant housing info
	applicantIsBuyingCurrentResidence=cleanBit(getCheckedRadio('ApplicantIsBuyingCurrentResidence'), "applicant housing: renting / buying");
	applicantMonthlyHousingPaymentAmount=cleanMoney(getInput('ApplicantMonthlyHousingPaymentAmountWeb'));
	applicantCurrentMtgCompanyName=cleanVarChar(getInput('ApplicantCurrentMtgCompanyName'), 50);
	applicantCurrentOnMortgage=cleanBit(getCheckedRadio('ApplicantCurrentOnMortgage'), "applicant current on mortgage");
	applicantHasSecondMortgage=cleanBit(getCheckedRadio('ApplicantHasSecondMortgage'), "applicant has second mortgage");
	applicantSecondMortgagePaymentAmount=cleanMoney(getInput('ApplicantSecondMortgagePaymentAmountWeb'));
	
	//joint applicant
	hasJointApplicant=getInput('HasJointApplicant');//cleanBit(getCheckedRadio('HasJointApplicant'), "do you have a joint applicant?");
	if(hasJointApplicant==1){
		jointApplicantPrefix=cleanInt(getSelectedListItem('JointApplicantPrefix')); 
		jointApplicantFirstName=validateName(getInput('JointApplicantFirstName'), false);
		jointApplicantMiddleName=validateName(getInput('JointApplicantMiddleName'), true);
		jointApplicantLastName=validateName(getInput('JointApplicantLastName'), false);
		jointApplicantSSN=validateSSN(getInput('JointApplicantSSNWeb'), "Joint Applicant Social Sec No.");
		jointApplicantHomePhone=validatePhone(getInput('JointApplicantHomePhoneWeb'), "Joint Applicant Home Phone", 1);
		jointApplicantCellPhone=validatePhone(getInput('JointApplicantCellPhoneWeb'), "Joint Applicant Cell Phone", 0);
		jointApplicantDOB=cleanDateTime(getInput('JointApplicantDob'), "Applicant Date of Birth");
		jointApplicantEmail=validateEmail(getInput('JointApplicantEmail'), "Applicant Email Address");
		
		//joint applicant address history
		jointApplicantResAddr1=cleanVarChar(getInput('JointApplicantResAddr1'), 50);
		jointApplicantResCity1=cleanVarChar(getInput('JointApplicantResCity1'), 50);
		jointApplicantResSt1=cleanVarChar(getInput('JointApplicantResSt1'), 15);
		jointApplicantResZip1=cleanVarChar(getInput('JointApplicantResZip1'), 10);
		jointApplicantResYears1=cleanInt(getInput('JointApplicantResYears1'));
		jointApplicantResMonths1=cleanInt(getInput('JointApplicantResMonths1'));
		
		jointApplicantResAddr2=cleanVarChar(getInput('JointApplicantResAddr2'), 50);
		jointApplicantResCity2=cleanVarChar(getInput('JointApplicantResCity2'), 50);
		jointApplicantResSt2=cleanVarChar(getInput('JointApplicantResSt2'), 15);
		jointApplicantResZip2=cleanVarChar(getInput('JointApplicantResZip2'), 10);
		jointApplicantResYears2=cleanInt(getInput('JointApplicantResYears2'));
		jointApplicantResMonths2=cleanInt(getInput('JointApplicantResMonths2'));
			
		jointApplicantResAddr3=cleanVarChar(getInput('JointApplicantResAddr3'), 50);
		jointApplicantResCity3=cleanVarChar(getInput('JointApplicantResCity3'), 50);
		jointApplicantResSt3=cleanVarChar(getInput('JointApplicantResSt3'), 15);
		jointApplicantResZip3=cleanVarChar(getInput('JointApplicantResZip3'), 10);
		jointApplicantResYears3=cleanInt(getInput('JointApplicantResYears3'));
		jointApplicantResMonths3=cleanInt(getInput('JointApplicantResMonths3'));
		
		//joint applicant employment history
		jointApplicantEmpName1=cleanVarChar(getInput('JointApplicantEmpName1'), 50);
		jointApplicantEmpPhone1=validatePhone(getInput('JointApplicantEmpPhone1Web'), "Joint Applicant Employer Phone 1", 0);
		jointApplicantEmpDesc1=cleanVarChar(getInput('JointApplicantEmpDesc1'), 50);
		jointApplicantEmpYears1=cleanInt(getInput('JointApplicantEmpYears1'));
		jointApplicantEmpMonths1=cleanInt(getInput('JointApplicantEmpMonths1'));
		
		jointApplicantEmpName2=cleanVarChar(getInput('JointApplicantEmpName2'), 50);
		jointApplicantEmpPhone2=validatePhone(getInput('JointApplicantEmpPhone2Web'), "Joint Applicant Employer Phone 2", 0);
		jointApplicantEmpDesc2=cleanVarChar(getInput('JointApplicantEmpDesc2'), 50);
		jointApplicantEmpYears2=cleanInt(getInput('JointApplicantEmpYears2'));
		jointApplicantEmpMonths2=cleanInt(getInput('JointApplicantEmpMonths2'));
		
		jointApplicantEmpName3=cleanVarChar(getInput('JointApplicantEmpName3'), 50);
		jointApplicantEmpPhone3=validatePhone(getInput('JointApplicantEmpPhone3Web'), "Joint Applicant Employer Phone 3", 0);
		jointApplicantEmpDesc3=cleanVarChar(getInput('JointApplicantEmpDesc3'), 50);
		jointApplicantEmpYears3=cleanInt(getInput('JointApplicantEmpYears3'));
		jointApplicantEmpMonths3=cleanInt(getInput('JointApplicantEmpMonths3'));
	
		//joint applicant income info
		//jointApplicantIncomeType=cleanRadio(getCheckedRadio('JointApplicantIncomeType'), "joint applicant select one: hourly / salary / commission\n\n");
		jointApplicantIncomeType=getCheckedRadio('JointApplicantIncomeType');
		jointApplicantIsFullTime=cleanBit(getCheckedRadio('JointApplicantIsFullTime'), "joint applicant work type: part time / full time");
		jointApplicantMonthlyIncomeAmount=cleanMoney(getInput('JointApplicantMonthlyIncomeAmountWeb'));
		jointApplicantGetsCommissionAlso=cleanBit(getCheckedRadio('co_bool_monthly_comm'), "joint applicant also gets commission?");
		jointApplicantCommissionAmount=cleanMoney(getInput('co_monthly_comm'));
		jointApplicantOtherIncomeAmount=cleanMoney(getInput('co_monthly_other'));
		jointApplicantOtherIncomeSource=cleanVarChar(getInput('co_other_source'), 50);

	} else {	
		jointApplicantPrefix='';
		jointApplicantFirstName='';
		jointApplicantMiddleName='';
		jointApplicantLastName='';
		jointApplicantSSN='';
		jointApplicantHomePhone='';
		jointApplicantCellPhone='';
		jointApplicantDOB='';
		jointApplicantEmail='';
		
		//joint applicant address history
		jointApplicantResAddr1='';
		jointApplicantResCity1='';
		jointApplicantResSt1='';
		jointApplicantResZip1='';
		jointApplicantResYears1='';
		jointApplicantResMonths1='';
		
		jointApplicantResAddr2='';
		jointApplicantResCity2='';
		jointApplicantResSt2='';
		jointApplicantResZip2='';
		jointApplicantResYears2='';
		jointApplicantResMonths2='';
		
		jointApplicantResAddr3='';
		jointApplicantResCity3='';
		jointApplicantResSt3='';
		jointApplicantResZip3='';
		jointApplicantResYears3='';
		jointApplicantResMonths3='';
		
		//joint applicant employment history
		jointApplicantEmpName1='';
		jointApplicantEmpPhone1='';
		jointApplicantEmpDesc1='';
		jointApplicantEmpYears1='';
		jointApplicantEmpMonths1='';
		
		jointApplicantEmpName2='';
		jointApplicantEmpPhone2='';
		jointApplicantEmpDesc2='';
		jointApplicantEmpYears2='';
		jointApplicantEmpMonths2='';
		
		jointApplicantEmpName3='';
		jointApplicantEmpPhone3='';
		jointApplicantEmpDesc3='';
		jointApplicantEmpYears3='';
		jointApplicantEmpMonths3='';
		
	
	
		//joint applicant income info
		jointApplicantIncomeType='';
		jointApplicantIsFullTime='';
		jointApplicantMonthlyIncomeAmount='';
		jointApplicantGetsCommissionAlso='';
		jointApplicantCommissionAmount='';
		jointApplicantOtherIncomeAmount='';
		jointApplicantOtherIncomeSource='';
	}

	//attorney
	attorneyPrefix=cleanInt(getSelectedListItem('AttorneyPrefix')); 
	attorneyFirstName=validateName(getInput('AttorneyFirstName'), false);
	attorneyMiddleName=validateName(getInput('AttorneyMiddleName'), true);
	attorneyLastName=validateName(getInput('AttorneyLastName'), false);
	attorneyPhone=validatePhone(getInput('AttorneyPhoneWeb'), "Attorney Phone", 1);
	attorneyFax=validatePhone(getInput('AttorneyFaxWeb'), "Attorney Fax", 0);
	attorneyEmail=validateEmail(getInput('AttorneyEmail'), "Attorney Email Address");
	attorneyFirm=cleanVarChar(getInput('AttorneyFirm'), 50);
	
	
	//case
	//interestedIn=cleanRadio(getCheckedRadio('InterestedIn'), "interested in...\n\n");
	interestedIn=getCheckedRadio('InterestedIn');
	caseNumber=cleanInt(getInput('CaseNumber'));
	//caseHasBeenFiled=cleanRadio(getCheckedRadio('CaseHasBeenfiled'), "has your case been filed?\n\n"); //radio group
	caseHasBeenFiled=getCheckedRadio('CaseHasBeenfiled'); //radio group
	if(caseHasBeenFiled==1){
		dateFiled=cleanDateTime(getInput('Datefiled'), "Date Bankruptcy was Filed\n\n");
	} else if(caseHasBeenFiled==0){
		dateToFile=cleanDateTime(getInput('Datetofile'), "Date Bankruptcy will be Filed\n\n");
	}
	//bankruptcyType=cleanRadio(getCheckedRadio('BankruptcyType'), "bankruptcy type\n\n"); //radio group
	bankruptcyType=getCheckedRadio('BankruptcyType'); //radio group
	converted13To7=cleanBit(getCheckedRadio('Converted13To7'), "bankruptcy converted from 13 to 7?\n\n"); //radio group
	
	//history & title info
	previousBankruptcy=cleanBit(getCheckedRadio('bkcy_10_yrs'), "Previous Bankruptcy? \n\n"); //radio group
	previousRepossessions=cleanBit(getCheckedRadio('repo_10_yrs'), "Previous Repossession? \n\n"); //radio group
	usBankCreditor=cleanBit(getCheckedRadio('us_creditor'), "US Bank Creditor?"); //radio group
	HasSecondLien=cleanBit(getCheckedRadio('hsl'), "Second Lien?"); //radio group
	hasCoSigner=cleanBit(getCheckedRadio('hcs'), "do you have a cosigner?"); //radio group
	coSignerName=cleanVarChar(getInput('current_loan_cosigner'), 50);
	otherOnTitle=cleanBit(getCheckedRadio('other_on_title_bool'), "is there anyone else on your title?"); //radio group
	otherNameOnTitle=cleanVarChar(getInput('other_on_title'), 50);
	
	//vehicle payment info
	vehicleInfoLeased=cleanBit(getCheckedRadio('leased'), "is your vehicle leased?\n\n"); //radio group
	vehicleInfoMonthlyPayment=cleanMoney(getInput('curr_monthly_car_pymt'));
	vehicleInfoPaymentsRemaining=cleanInt(getInput('num_pymt_left'));
	vehicleInfoPayee=cleanVarChar(getInput('name_of_creditor'), 50);
	
	//vehicle info
	vehicleInfoOwners=cleanVarChar(getInput('name_on_title'), 50);
	vehicleInfoYear=cleanInt(getInput('year'));
	vehicleInfoMake=cleanVarChar(getInput('make'), 50);
	vehicleInfoModel=cleanVarChar(getInput('model'), 50);
	vehicleInfoVIN=cleanVarChar(getInput('vin'), 50);
	vehicleInfoMiles=cleanDecimal(getInput('miles'));
	vehicleInfoColor=cleanVarChar(getInput('color'), 50);
	
	vehicleInfoFeaturesCruise=cleanBit(getCheckedRadio('cruise'), "cruise"); //radio group
	vehicleInfoFeaturesTTops=cleanBit(getCheckedRadio('t_tops'), "t tops"); //radio group
	vehicleInfoFeaturesTheftDeterent=cleanBit(getCheckedRadio('theft_deter'), "theft deterrent"); //radio group
	vehicleInfoFeaturesSunroof=cleanBit(getCheckedRadio('sunroof'), "sun roof"); //radio group
	vehicleInfoFeaturesAbsBrakes=cleanBit(getCheckedRadio('abs'), "antilock brakes"); //radio group
	vehicleInfoFeaturesPwrSunroof=cleanBit(getCheckedRadio('pwr_sun'), "power sunroof"); //radio group
	vehicleInfoFeaturesTiltWheel=cleanBit(getCheckedRadio('tilt_wheel'), "tilt wheel"); //radio group
	vehicleInfoFeaturesAMFM=cleanBit(getCheckedRadio('am_fm'), "am/fm radio"); //radio group
	vehicleInfoFeaturesPwrWindows=cleanBit(getCheckedRadio('pwr_win'), "power windows"); //radio group
	vehicleInfoFeaturesTapeCD=cleanBit(getCheckedRadio('tape_cd'), "tape/cd player"); //radio group
	vehicleInfoFeaturesPwrSeats=cleanBit(getCheckedRadio('pwr_seats'), "power seats"); //radio group
	vehicleInfoFeaturesAutomatic=cleanBit(getCheckedRadio('auto'), "automatic transmission"); //radio group
	vehicleInfoFeaturesPwrDoorLocks=cleanBit(getCheckedRadio('pwr_locks'), "power door locks"); //radio group
	vehicleInfoFeatures4Speed=cleanBit(getCheckedRadio('4_speed'), "4 speed transmission"); //radio group
	vehicleInfoFeaturesLeatherInt=cleanBit(getCheckedRadio('leather'), "leather interior"); //radio group
	vehicleInfoFeatures5Speed=cleanBit(getCheckedRadio('5_speed'), "5 speed transmission"); //radio group
	vehicleInfoFeaturesAirConditioning=cleanBit(getCheckedRadio('air_cond'), "air conditioning"); //radio group
	vehicleInfoFeatures4x4=cleanBit(getCheckedRadio('4wd'), "4 wheel drive"); //radio group
	vehicleInfoFeaturesOther=cleanVarChar(getInput('other_items_car'), 8000);
	
	vehicleInfoConditionGrill=cleanInt(getCheckedRadio('grill_cond')); //radio group
	vehicleInfoConditionLeftFender=cleanInt(getCheckedRadio('lfender_cond')); //radio group
	vehicleInfoConditionFrontBumper=cleanInt(getCheckedRadio('lfbumper_cond')); //radio group
	vehicleInfoConditionLeftDoors=cleanInt(getCheckedRadio('ldoors_cond')); //radio group
	vehicleInfoConditionHood=cleanInt(getCheckedRadio('hood_cond')); //radio group
	vehicleInfoConditionLeftQtrPanel=cleanInt(getCheckedRadio('lqp_cond')); //radio group
	vehicleInfoConditionRightFender=cleanInt(getCheckedRadio('rfender_cond')); //radio group
	vehicleInfoConditionInterior=cleanInt(getCheckedRadio('int_cond')); //radio group
	vehicleInfoConditionRightDoors=cleanInt(getCheckedRadio('rdoor_cond')); //radio group
	vehicleInfoConditionEngine=cleanInt(getCheckedRadio('eng_cond')); //radio group
	vehicleInfoConditionRightQtrPanel=cleanInt(getCheckedRadio('rqp_cond')); //radio group
	vehicleInfoConditionTransmission=cleanInt(getCheckedRadio('tran_cond')); //radio group
	vehicleInfoConditionLights=cleanInt(getCheckedRadio('lights_cond')); //radio group
	vehicleInfoConditionBrakes=cleanInt(getCheckedRadio('brakes_cond')); //radio group
	vehicleInfoConditionRearBumper=cleanInt(getCheckedRadio('rbump_cond')); //radio group
	vehicleInfoConditionPaintFinish=cleanInt(getCheckedRadio('paint_cond')); //radio group
	vehicleInfoConditionRoof=cleanInt(getCheckedRadio('roof_cond')); //radio group
	vehicleInfoConditionTires=cleanInt(getCheckedRadio('tires_cond')); //radio group
	vehicleInfoConditionOther=cleanVarChar(getInput('other_notes_car'), 8000);
	
	//other from app
	comments=cleanVarChar(getInput('comments'), 8000);
	originatorID=cleanInt(getSelectedListItem('employee')); //drop down
	referralID=cleanInt(getCheckedRadio('ReferralID')); //radio group
	
	//VERIFY ALL REQUIRED FIELDS ARE SET
	if(!applicantFirstName || !applicantLastName || !applicantSSN || !applicantDOB || !applicantHomePhone) {
		ready=false;
		alert("Please fill in all of the required fields in the 'Applicant Information' section");
	} else if(!attorneyFirstName || !attorneyLastName || !attorneyPhone){
		ready=false;
		alert("Please fill in all of the required fields in the 'Attorney Information' section");
	} else if(interestedIn==-10|| caseHasBeenFiled==-10 || bankruptcyType==-10){
		ready=false;
		alert("Please fill in all of the required fields in the 'Additional Information' section");
	} else if(applicantIncomeType==-10 || applicantIsFullTime==-10 || !applicantMonthlyIncomeAmount || 
	applicantIsBuyingCurrentResidence==-10 || (applicantIsBuyingCurrentResidence==1 && (applicantCurrentOnMortgage==-10 || 
	!applicantCurrentMtgCompanyName || applicantHasSecondMortgage==-10)) || !applicantMonthlyHousingPaymentAmount){
		ready=false;
		alert("Please fill in all of the required fields regarding the Applicant's income and housing information");
	} else if(hasJointApplicant==1){
		if(!jointApplicantFirstName || !jointApplicantLastName || !jointApplicantSSN || !jointApplicantHomePhone || !jointApplicantDOB){
			ready=false;
			alert("Please fill in all of the required fields in the 'Joint Applicant Information' section. If you do not wish to have a joint applicant, please answer 'no' to the question 'Will there be a joint applicant?'");
		} else if(jointApplicantIncomeType==-10 || jointApplicantIsFullTime==-10 || !jointApplicantMonthlyIncomeAmount){
			ready=false;
			alert("Please fill in all of the required fields regarding the Joint Applicant's income. If you do not wish to have a joint applicant, please answer 'no' to the question 'Will there be a joint applicant?'");
		}
	} else if(previousBankruptcy==-10 || previousRepossessions==-10 || usBankCreditor==-10 || HasSecondLien==-10 || hasCoSigner==-10 || otherOnTitle==-10){
		ready=false;
		alert("Please fill in all of the fields in Section C");
	} else if(interestedIn!=2){
		if(!vehicleInfoOwners || !vehicleInfoYear || !vehicleInfoMake || !vehicleInfoModel || !vehicleInfoVIN || !vehicleInfoMiles || !vehicleInfoColor ||
		vehicleInfoLeased==-10 || !vehicleInfoMonthlyPayment || !vehicleInfoPaymentsRemaining || !vehicleInfoPayee){
			ready=false;
			alert("Please fill in all of the required fields in Section D");
		}
	}

	
	//ASSIGN MODIFIED VALUES TO FORM
	
	//applicant
	replaceItem('AppPrefixVal', applicantPrefix);
	replaceItem('ApplicantFirstName', applicantFirstName);
	replaceItem('ApplicantMiddleName', applicantMiddleName);
	replaceItem('ApplicantLastName', applicantLastName);
	replaceItem('ApplicantSSNWeb', applicantSSN);
	replaceItem('ApplicantDob', applicantDOB);
	replaceItem('ApplicantHomePhoneWeb', applicantHomePhone);
	replaceItem('ApplicantCellPhoneWeb', applicantCellPhone);
	replaceItem('ApplicantEmail', applicantEmail);
	
	//applicant address history
	replaceItem('ApplicantResAddr1', applicantResAddr1);
	replaceItem('ApplicantResCity1', applicantResCity1);
	replaceItem('ApplicantResSt1', applicantResSt1);
	replaceItem('ApplicantResZip1', applicantResZip1);
	replaceItem('ApplicantResYears1', applicantResYears1);
	replaceItem('ApplicantResMonths1', applicantResMonths1);
	
	replaceItem('ApplicantResAddr2', applicantResAddr2);
	replaceItem('ApplicantResCity2', applicantResCity2);
	replaceItem('ApplicantResSt2', applicantResSt2);
	replaceItem('ApplicantResZip2', applicantResZip2);
	replaceItem('ApplicantResYears2', applicantResYears2);
	replaceItem('ApplicantResMonths2', applicantResMonths2);
	
	replaceItem('ApplicantResAddr3', applicantResAddr3);
	replaceItem('ApplicantResCity3', applicantResCity3);
	replaceItem('ApplicantResSt3', applicantResSt3);
	replaceItem('ApplicantResZip3', applicantResZip3);
	replaceItem('ApplicantResYears3', applicantResYears3);
	replaceItem('ApplicantResMonths3', applicantResMonths3);
	
	
	//applicant employment history
	replaceItem('ApplicantEmpName1', applicantEmpName1);
	replaceItem('ApplicantEmpPhone1Web', applicantEmpPhone1);
	replaceItem('ApplicantEmpDesc1', applicantEmpDesc1);
	replaceItem('ApplicantEmpYears1', applicantEmpYears1);
	replaceItem('ApplicantEmpMonths1', applicantEmpMonths1);
	
	replaceItem('ApplicantEmpName2', applicantEmpName2);
	replaceItem('ApplicantEmpPhone2Web', applicantEmpPhone2);
	replaceItem('ApplicantEmpDesc2', applicantEmpDesc2);
	replaceItem('ApplicantEmpYears2', applicantEmpYears2);
	replaceItem('ApplicantEmpMonths2', applicantEmpMonths2);
	
	replaceItem('ApplicantEmpName3', applicantEmpName3);
	replaceItem('ApplicantEmpPhone3Web', applicantEmpPhone3);
	replaceItem('ApplicantEmpDesc3', applicantEmpDesc3);
	replaceItem('ApplicantEmpYears3', applicantEmpYears3);
	replaceItem('ApplicantEmpMonths3', applicantEmpMonths3);
	
	
	//applicant income info
	replaceItem('appIncomeTypeVal', applicantIncomeType);
	replaceItem('appFullTimeVal', applicantIsFullTime);
	replaceItem('ApplicantMonthlyIncomeAmountWeb', applicantMonthlyIncomeAmount);
	replaceItem('appGetsCommissionVal', applicantGetsCommissionAlso);
	replaceItem('ApplicantCommissionAmountWeb', applicantCommissionAmount);
	replaceItem('ApplicantOtherIncomeAmountWeb', applicantOtherIncomeAmount);
	replaceItem('ApplicantOtherIncomeSource', applicantOtherIncomeSource);
	
	//applicant housing info
	replaceItem('appBuyingResVal', applicantIsBuyingCurrentResidence);
	replaceItem('ApplicantMonthlyHousingPaymentAmountWeb', applicantMonthlyHousingPaymentAmount);
	replaceItem('ApplicantCurrentMtgCompanyName', applicantCurrentMtgCompanyName);
	replaceItem('appCurrentOnMtgVal', applicantCurrentOnMortgage);
	replaceItem('appHasSecMtgVal', applicantHasSecondMortgage);
	replaceItem('ApplicantSecondMortgagePaymentAmountWeb', applicantSecondMortgagePaymentAmount);
	
	//joint applicant
	replaceItem('jointPrefixVal', jointApplicantPrefix);
	replaceItem('JointApplicantFirstName', jointApplicantFirstName);
	replaceItem('JointApplicantMiddleName', jointApplicantMiddleName);
	replaceItem('JointApplicantLastName', jointApplicantLastName);
	replaceItem('JointApplicantSSNWeb', jointApplicantSSN);
	replaceItem('JointApplicantHomePhoneWeb', jointApplicantHomePhone);
	replaceItem('JointApplicantCellPhoneWeb', jointApplicantCellPhone);
	replaceItem('JointApplicantDob', jointApplicantDOB);
	replaceItem('JointApplicantEmail', jointApplicantEmail);
	
	//joint applicant address history
	replaceItem('JointApplicantResAddr1', jointApplicantResAddr1);
	replaceItem('JointApplicantResCity1', jointApplicantResCity1);
	replaceItem('JointApplicantResSt1', jointApplicantResSt1);
	replaceItem('JointApplicantResZip1', jointApplicantResZip1);
	replaceItem('JointApplicantResYears1', jointApplicantResYears1);
	replaceItem('JointApplicantResMonths1', jointApplicantResMonths1);
	
	replaceItem('JointApplicantResAddr2', jointApplicantResAddr2);
	replaceItem('JointApplicantResCity2', jointApplicantResCity2);
	replaceItem('JointApplicantResSt2', jointApplicantResSt2);
	replaceItem('JointApplicantResZip2', jointApplicantResZip2);
	replaceItem('JointApplicantResYears2', jointApplicantResYears2);
	replaceItem('JointApplicantResMonths2', jointApplicantResMonths2);
	
	replaceItem('JointApplicantResAddr3', jointApplicantResAddr3);
	replaceItem('JointApplicantResCity3', jointApplicantResCity3);
	replaceItem('JointApplicantResSt3', jointApplicantResSt3);
	replaceItem('JointApplicantResZip3', jointApplicantResZip3);
	replaceItem('JointApplicantResYears3', jointApplicantResYears3);
	replaceItem('JointApplicantResMonths3', jointApplicantResMonths3);
	
	//joint applicant employment history
	replaceItem('JointApplicantEmpName1', jointApplicantEmpName1);
	replaceItem('JointApplicantEmpPhone1Web', jointApplicantEmpPhone1);
	replaceItem('JointApplicantEmpDesc1', jointApplicantEmpDesc1);
	replaceItem('JointApplicantEmpYears1', jointApplicantEmpYears1);
	replaceItem('JointApplicantEmpMonths1', jointApplicantEmpMonths1);
	
	replaceItem('JointApplicantEmpName2', jointApplicantEmpName2);
	replaceItem('JointApplicantEmpPhone2Web', jointApplicantEmpPhone2);
	replaceItem('JointApplicantEmpDesc2', jointApplicantEmpDesc2);
	replaceItem('JointApplicantEmpYears2', jointApplicantEmpYears2);
	replaceItem('JointApplicantEmpMonths2', jointApplicantEmpMonths2);
	
	replaceItem('JointApplicantEmpName3', jointApplicantEmpName3);
	replaceItem('JointApplicantEmpPhone3Web', jointApplicantEmpPhone3);
	replaceItem('JointApplicantEmpDesc3', jointApplicantEmpDesc3);
	replaceItem('JointApplicantEmpYears3', jointApplicantEmpYears3);
	replaceItem('JointApplicantEmpMonths3', jointApplicantEmpMonths3);
	
	//joint applicant income info
	replaceItem('jointIncomeTypeVal', jointApplicantIncomeType);
	replaceItem('jointFullTimeVal', jointApplicantIsFullTime);
	replaceItem('JointApplicantMonthlyIncomeAmountWeb', jointApplicantMonthlyIncomeAmount);
	replaceItem('jointGetsCommVal', jointApplicantGetsCommissionAlso);
	replaceItem('co_monthly_comm', jointApplicantCommissionAmount);
	replaceItem('co_monthly_other', jointApplicantOtherIncomeAmount);
	replaceItem('co_other_source', jointApplicantOtherIncomeSource);
	
	//attorney
	replaceItem('AttPrefixVal', attorneyPrefix);
	replaceItem('AttorneyFirstName', attorneyFirstName);
	replaceItem('AttorneyMiddleName', attorneyMiddleName);
	replaceItem('AttorneyLastName', attorneyLastName);
	replaceItem('AttorneyPhoneWeb', attorneyPhone);
	replaceItem('AttorneyFaxWeb', attorneyFax);
	replaceItem('AttorneyEmail', attorneyEmail);
	replaceItem('AttorneyFirm', attorneyFirm);
	
	//case
	replaceItem('InterestedVal', interestedIn);
	replaceItem('CaseNumber', '');
	//replaceItem('caseFiledVal', caseHasBeenFiled);
	if(caseHasBeenFiled==1){
		replaceItem('Datefiled', dateFiled);
		replaceItem('Datetofile', '');
	} else if(caseHasBeenFiled==0){
		replaceItem('Datetofile', dateToFile);
		replaceItem('Datefiled', '');
	} else {
		replaceItem('Datefiled', '');
		replaceItem('Datetofile', '');
	}
	//replaceItem('BkcyTypeVal', bankruptcyType);
	//replaceItem('con13to7val', converted13To7);
	
	//history & title info
	replaceItem('prevBkcyVal', previousBankruptcy);
	replaceItem('prevRepoVal', previousRepossessions);
	replaceItem('usbCredVal', usBankCreditor);
	replaceItem('hasSecLienVal', HasSecondLien);
	replaceItem('hasCoSignerVal', hasCoSigner);
	replaceItem('current_loan_cosigner', coSignerName);
	replaceItem('otherOnTitleVal', otherOnTitle);
	replaceItem('other_on_title', otherNameOnTitle);	
	
	//vehicle payment info
	replaceItem('leasedVal', vehicleInfoLeased);
	replaceItem('curr_monthly_car_pymt', vehicleInfoMonthlyPayment);
	replaceItem('num_pymt_left', vehicleInfoPaymentsRemaining);
	replaceItem('name_of_creditor', vehicleInfoPayee);
	
	//vehicle info
	replaceItem('name_on_title', vehicleInfoOwners);
	replaceItem('year', vehicleInfoYear);
	replaceItem('make', vehicleInfoMake);
	replaceItem('model', vehicleInfoModel);
	replaceItem('vin', vehicleInfoVIN);
	replaceItem('miles', vehicleInfoMiles);
	replaceItem('color', vehicleInfoColor);
	
	replaceItem('cruiseVal', vehicleInfoFeaturesCruise);
	replaceItem('ttopsVal', vehicleInfoFeaturesTTops);
	replaceItem('antitheftVal', vehicleInfoFeaturesTheftDeterent);
	replaceItem('sunroofVal', vehicleInfoFeaturesSunroof);
	replaceItem('absVal', vehicleInfoFeaturesAbsBrakes);
	replaceItem('pwrSunVal', vehicleInfoFeaturesPwrSunroof);
	replaceItem('tiltVal', vehicleInfoFeaturesTiltWheel);
	replaceItem('amfmVal', vehicleInfoFeaturesAMFM);
	replaceItem('pwrWinVal', vehicleInfoFeaturesPwrWindows);
	replaceItem('tapeVal', vehicleInfoFeaturesTapeCD);
	replaceItem('pwrSeatsVal', vehicleInfoFeaturesPwrSeats);
	replaceItem('autoVal', vehicleInfoFeaturesAutomatic);
	replaceItem('pwrLocksVal', vehicleInfoFeaturesPwrDoorLocks);
	replaceItem('4SpeedVal', vehicleInfoFeatures4Speed);
	replaceItem('leatherVal', vehicleInfoFeaturesLeatherInt);
	replaceItem('5SpeedVal', vehicleInfoFeatures5Speed);
	replaceItem('airCondVal', vehicleInfoFeaturesAirConditioning);
	replaceItem('4wdVal', vehicleInfoFeatures4x4);
	replaceItem('other_items_car', vehicleInfoFeaturesOther);
	
	replaceItem('grillCondVal', vehicleInfoConditionGrill);
	replaceItem('lFenderCondVal', vehicleInfoConditionLeftFender);
	replaceItem('lfbumperCondVal', vehicleInfoConditionFrontBumper);
	replaceItem('lDoorsVal', vehicleInfoConditionLeftDoors);
	replaceItem('hoodCondVal', vehicleInfoConditionHood);
	replaceItem('lqpCondVal', vehicleInfoConditionLeftQtrPanel);
	replaceItem('rFenderVal', vehicleInfoConditionRightFender);
	replaceItem('intCondVal', vehicleInfoConditionInterior);
	replaceItem('rDoorsVal', vehicleInfoConditionRightDoors);
	replaceItem('engCondVal', vehicleInfoConditionEngine);
	replaceItem('rqpCondVal', vehicleInfoConditionRightQtrPanel);
	replaceItem('tranCondVal', vehicleInfoConditionTransmission);
	replaceItem('lightsCondVal', vehicleInfoConditionLights);
	replaceItem('brakesCondVal', vehicleInfoConditionBrakes);
	replaceItem('rBumpCondVal', vehicleInfoConditionRearBumper);
	replaceItem('paintCondVal', vehicleInfoConditionPaintFinish);
	replaceItem('roofCondVal', vehicleInfoConditionRoof);
	replaceItem('tiresCondVal', vehicleInfoConditionTires);
	replaceItem('other_notes_car', vehicleInfoConditionOther);
	
	//other from app
	replaceItem('comments', comments);
	replaceItem('employeeVal', originatorID);
	replaceItem('RefIDVal', referralID);
	
	if(!ready){
		alert(message);
	}
	
	//RETURN STATEMENT
	//return ready;
	return ready;
}
function validate_intake(){
	ready=true;
	message="Please correct the following errors:\n\n";
	cusName = document.getElementById('name').value;
	cusPhone = document.getElementById('phone').value;
	cusEmail = document.getElementById('email').value;
	attyName = document.getElementById('atty').value;
	attyPhone = document.getElementById('attyPhone').value;
	attyEmail = document.getElementById('attyEmail').value;
	vehYear = document.getElementById('year').value;
	vehMake = document.getElementById('make').value;
	vehModel = document.getElementById('model').value;
	vehMiles = document.getElementById('miles').value;
	paymentAmnt = document.getElementById('payment').value;
	numPayments = document.getElementById('numRemaining').value;
	referral = getSelectedListItem('referral');
	employee = getSelectedListItem('employee');
	
	if(!cusName || !cusPhone || !cusEmail || !attyName || !vehYear ||
	!vehMake || !vehModel || !vehMiles || !paymentAmnt || !numPayments || !attyPhone || !attyEmail){
		alert("You must fill in all required fields");
		ready=false;
	} else {
		cusName=validateName(cusName, false);
		cusPhone=validatePhone(cusPhone, "Customer Phone", 1);
		cusEmail=validateEmail(cusEmail, "Customer Email Address");
		attyName=validateName(attyName, false);
		attyPhone = validatePhone(attyPhone, "Attorney Phone", 1);
		attyEmail=validateEmail(attyEmail, "Attorney Email Address");
		vehYear=cleanYear(vehYear, "Vehicle Year");
		vehMake=cleanVarChar(vehMake, 50);
		vehModel=cleanVarChar(vehModel, 50);
		vehMiles=cleanDecimal(vehMiles);
		paymentAmnt=cleanMoney(paymentAmnt);
		numPayments=cleanInt(numPayments);
		
		document.getElementById('name').value = cusName;
		document.getElementById('phone').value = cusPhone;
		document.getElementById('email').value = cusEmail;
		document.getElementById('atty').value = attyName;
		document.getElementById('attyPhone').value = attyPhone;
		document.getElementById('attyEmail').value = attyEmail;
		document.getElementById('year').value = vehYear;
		document.getElementById('make').value = vehMake;
		document.getElementById('model').value = vehModel;
		document.getElementById('miles').value = vehMiles;
		document.getElementById('payment').value = paymentAmnt;
		document.getElementById('numRemaining').value = numPayments;
	}
	if(!ready){
		alert(message);
	}
	return ready;
}


