

	function validate(f) {
		var msg = "";
		// Application Information
		var msg_app = "";

		( !anyWithCheck(f.app_type) ) && ( msg_app += "  -You must select a financing type \r\n" );

		( !hasSelectionValue(f.app_bedmodel) ) && ( msg_app += "  -You must select a bed model \r\n" );

		//Personal information
		var msg_pers = "";

		( !hasContent(f.app_firstname) ) && ( msg_pers += "  -You must enter your first name \r\n" );

		( !hasContent(f.app_lastname) ) && ( msg_pers += "  -You must enter your last name \r\n" );

		( !hasContent(f.app_houseno) ) && ( msg_pers += "  -You must enter your house number \r\n" );

		( !hasContent(f.app_streetname) ) && ( msg_pers += "  -You must enter your street name \r\n" );

		( !hasContent(f.app_city) ) && ( msg_pers += "  -You must enter your city \r\n" );

		( !hasSelectionValue(f.app_state) ) && ( msg_pers += "  -You must select your state \r\n" );

		( !hasContent(f.app_zip) ) && ( msg_pers += "  -You must enter your zip code \r\n" );
		( hasContent(f.app_zip) && !validZip(f.app_zip.value) ) && ( msg_pers += "  -You must enter a valid zip code (ddddd or ddddd-dddd) \r\n" );
		
		( !hasContent(f.app_phone) ) && ( msg_pers += "  -You must enter your phone number \r\n" );
		( hasContent(f.app_phone) && !validPhone(f.app_phone.value) ) && ( msg_pers += "  -You must enter a valid phone number (ddd-ddd-dddd or ddd-ddd-dddd xddddd) \r\n" );

		( !hasContent(f.app_ssn) ) && ( msg_pers += "  -You must enter your social security number \r\n" );
		( hasContent(f.app_ssn) && !validSSN(f.app_ssn.value) ) && ( msg_pers += "  -You must enter a valid social security number (ddd-dd-dddd) \r\n" );

		( !hasContent(f.app_licenseno) ) && ( msg_pers += "  -You must enter your driver's license number \r\n" );

		( hasContent(f.app_email) && !validEmail(f.app_email.value) ) && ( msg_pers += "  -Your email address is invalid. Please enter a valid email address.\r\n" );

		( !hasContent(f.app_dob) ) && ( msg_pers += "  -You must enter your date of birth \r\n" );
		( hasContent(f.app_dob) && !validDate(f.app_dob.value) ) && ( msg_pers += "  -You must enter a valid date of birth \r\n" );

		//Employment information
		var msg_emp="";
		( !hasContent(f.app_income1_amt) ) && ( msg_emp += "  -You must enter your monthly income \r\n" );
		( hasContent(f.app_income1_amt) && isNaN(f.app_income1_amt.value) ) && ( msg_emp += "  -You must enter a valid number for your monthly income \r\n" );

		( !hasContent(f.app_employer) ) && ( msg_emp += "  -You must enter your employer's name \r\n" );

		( !hasContent(f.app_employerphone) ) && ( msg_emp += "  -You must enter your employer's phone number \r\n" );
		( hasContent(f.app_employerphone) && !validPhone(f.app_employerphone.value) ) && ( msg_emp += "  -You must enter a valid phone number for your employer \r\n" );

		( !hasContent(f.app_jobyears) ) && ( msg_emp += "  -You must enter the number of years at your job \r\n" );
		( hasContent(f.app_jobyears) && isNaN(f.app_jobyears.value) ) && ( msg_emp += "  -You must enter a valid number of years at your job \r\n" );
		( !hasContent(f.app_jobmonths) ) && ( msg_emp += "  -You must enter the number of months at your job \r\n" );
		( hasContent(f.app_jobmonths) && isNaN(f.app_jobmonths.value) ) && ( msg_emp += "  -You must enter a valid number of months at your job \r\n" );

		( hasContent(f.app_income2_amt) && isNaN(f.app_income2_amt.value) ) && ( msg_emp += "  -You must enter a valid number for your other income amount \r\n" );
		
		//Residence information
		var msg_res="";
		( !hasSelectionValue(f.app_res_rentown) ) && ( msg_res += "  -You must select either Rent, Own, or Other for your residence \r\n" );

		( hasContent(f.app_res_pmt) && isNaN(f.app_res_pmt.value) ) && ( msg_res += "  -You must enter a valid number for your residence payment \r\n" );

		( hasContent(f.app_res_mktval) && isNaN(f.app_res_mktval.value) ) && ( msg_res += "  -You must enter a valid number for your residence market value \r\n" );

		( !hasContent(f.app_res_years) ) && ( msg_res += "  -You must enter the number of years at your residence \r\n" );
		( hasContent(f.app_res_years) && isNaN(f.app_res_years.value) ) && ( msg_res += "  -You must enter a valid number of years at your residence \r\n" );
		( !hasContent(f.app_res_months) ) && ( msg_res += "  -You must enter the number of months at your residence \r\n" );
		( hasContent(f.app_res_months) && isNaN(f.app_res_months.value) ) && ( msg_res += "  -You must enter a valid number of months at your residence \r\n" );

		( hasContent(f.app_res_bal) && isNaN(f.app_res_bal.value) ) && ( msg_res += "  -You must enter a valid number for your residence balance \r\n" );

		//Reference information
		var msg_ref="";
		( !hasContent(f.app_ref_firstname) ) && ( msg_ref += "  -You must enter the reference's first name \r\n" );

		( !hasContent(f.app_ref_lastname) ) && ( msg_ref += "  -You must enter the reference's last name \r\n" );

		( !hasContent(f.app_ref_phone) ) && ( msg_ref += "  -You must enter the reference's phone number \r\n" );
		( hasContent(f.app_ref_phone) && !validPhone(f.app_ref_phone.value) ) && ( msg_ref += "  -You must enter a valid phone number for the reference (ddd-ddd-dddd or ddd-ddd-dddd xddddd \r\n" );
		
		( msg_app != "" ) && (msg += "Application Information: \r\n" + msg_app);
		( msg_pers != "" ) && (msg += "Personal Information: \r\n" + msg_pers); 
		( msg_emp != "" ) && (msg += "Employment/Income Information: \r\n" + msg_emp);
		( msg_res != "" ) && (msg += "Residence Information: \r\n" + msg_res);
		( msg_ref != "" ) && (msg += "Reference Information: \r\n" + msg_ref);

		if ( msg != "" ) {
			alert ("The following errors have been found on the form.\r\nPlease correct them and resubmit.\r\n\n" + msg);
		}
			
		return msg == "";
	}

