function validForm(frmName)
{
	
	if(!getRadioStatus(frmName, 'financed_vihical','4', 'Please Select Type Vehicle Being Financed'))
		return false;
	//Start of seller section
	if(!getRadioStatus(frmName, 'seller_type','2', 'Please Select Seller Type'))
		return false;
	//end of seller section
	
	//start applicant section
	if(!validBlank(frmName, 'appli_fname','Please Enter First Name'))
		return false;
	if(!validBlank(frmName, 'appli_lname','Please Enter Last Name'))
		return false;
	if(!validBlank(frmName, 'appli_ssn','Please Enter Ssn Number'))
		return false;
	if(!getValidLimit(frmName, 'appli_ssn',9,'Please Enter 9 Digit Ssn Number'))
		return false;
	if(!validBlank(frmName, 'appli_month','Please Select Month'))
		return false;
	if(!validBlank(frmName, 'appli_day','Please Select Day'))
		return false;
	if(!validDigit(frmName, 'appli_year','Please Enter Year in 4 Digit'))
		return false;
	
	if(!getValidLimit(frmName, 'appli_year',4,'Please Enter 4 Digit Year'))
		return false;
	
	
	if(!validBlank(frmName, 'appli_address','Please Enter Address'))
		return false;	
	if(!validBlank(frmName, 'appli_city','Please Enter City'))
		return false;	
	if(!validBlank(frmName, 'appli_state','Please Enter State'))
		return false;	
	if(!validBlank(frmName, 'appli_zip','Please Enter Zip'))
		return false;
		
	if(!getValidLimit(frmName, 'appli_zip',5,'Please Enter 5 Digit Zip Code'))
		return false;	
		
	if(!validBlank(frmName, 'appli_how_long','Please Enter This Address Year in Digit'))
		return false;
	if(!validBlank(frmName, 'appli_home_phone','Please Enter Main Phone'))
		return false;
	if(!validBlank(frmName, 'appli_work_phone','Please Enter Work Phone'))
		return false;
	if(!validBlank(frmName, 'appli_occupation','Please Enter Occupation/Title'))
		return false;
	if(!validBlank(frmName, 'appli_employer','Please Enter Employer'))
		return false;
	if(!validBlank(frmName, 'appli_years_currentjob','Please Enter Current Job years'))
		return false;
	if(!validBlank(frmName, 'appli_gross_income','Please Enter Gross Monthly Income'))
		return false;
	if(!validBlank(frmName, 'appli_email','Please Enter Email Address'))
		return false;
	if(!validemail(frmName, 'appli_email','Please Enter Valid Email Address'))
		return false;
	//end applicant section
	
	//start co-applicant section
	obj = eval("document."+frmName+".appli_is_joint[0]");
	if(obj.checked)
	{
		if(!validBlank(frmName, 'co_fname','Please Enter Co applicant First Name'))
			return false;
		if(!validBlank(frmName, 'co_lname','Please Enter Co applicant Last Name'))
			return false;
		if(!validBlank(frmName, 'co_ssn','Please Enter Co applicant Ssn'))
			return false;
		if(!getValidLimit(frmName, 'co_ssn',9,'Please Enter 9 Digit Ssn Number'))
			return false;
		if(!validBlank(frmName, 'co_Month','Please Select Co applicant Birth Month'))
			return false;
		if(!validBlank(frmName, 'co_Date','Please Select Co applicant Birth Day'))
			return false;
		if(!validDigit(frmName, 'co_Year','Please Enter Co applicant Birth Year in 4 Digit'))
			return false;
			
		if(!getValidLimit(frmName, 'co_Year',4,'Please Enter 4 Digit Year'))
			return false;
			
		if(!validBlank(frmName, 'co_mstatus','Please Select Co applicant Marital Status'))
			return false;	
		if(!validBlank(frmName, 'co_address','Please Enter Co applicant Address'))
			return false;	
		if(!validBlank(frmName, 'co_city','Please Enter Co applicant City'))
			return false;	
		if(!validBlank(frmName, 'co_state','Please Enter Co applicant State'))
			return false;	
		if(!validBlank(frmName, 'co_zip','Please Enter Co applicant Zip'))
			return false;			
		
		if(!getValidLimit(frmName, 'co_zip',5,'Please Enter Co applicant 5 Digit Zip Code'))
			return false;
		
		if(!validBlank(frmName, 'co_how_long','Please Enter Co applicant This Address Year in Digit'))
			return false;
		if(!validBlank(frmName, 'co_home_phone','Please Enter Co applicant Main Phone'))
			return false;
		if(!validBlank(frmName, 'co_work_phone','Please Enter Co applicant Work Phone'))
			return false;
		if(!validBlank(frmName, 'co_occupation','Please Enter Co applicant Occupation/Title'))
			return false;
		if(!validBlank(frmName, 'co_employer','Please Enter Co applicant Employer'))
			return false;
		if(!validBlank(frmName, 'co_years_currentjob','Please Enter Co applicant Current Job years'))
			return false;
		if(!validBlank(frmName, 'co_gross_mincome','Please Enter Co applicant Gross Monthly Income'))
			return false;
			
		if(!validatePhoneNumber(window.document.frmApplyOnline.co_home_phone))
			return false;
		if(!validatePhoneNumber(window.document.frmApplyOnline.co_work_phone))
			return false;
		if(!validatePhoneNumber(window.document.frmApplyOnline.co_cell_phone))
			return false;
			
		if(!validateSSN(window.document.frmApplyOnline.co_ssn))
		return false;
		
		if(!validDate(window.document.frmApplyOnline.co_Month,window.document.frmApplyOnline.co_Date,window.document.frmApplyOnline.co_Year))
		return false;
		
			
	}
	//end co-applicant section
	
	//Start Item(s) Being Financed
	if(!getRadioStatus(frmName, 'item_isnew1','2', 'Please Select New or Used Item'))
		return false;
	if(!validBlank(frmName, 'item_amt_financed','Please Enter Estimated Amount Financed'))
		return false;
	if(!getValidLimitedAmount(frmName, 'item_amt_financed',2500,'Amount must be at least $2,500'))
		return false;
	//End Item(s) Being Financed
	
	/*******************************/
	
	if(!validatePhoneNumber(window.document.frmApplyOnline.appli_home_phone))
		return false;
	if(!validatePhoneNumber(window.document.frmApplyOnline.appli_work_phone))
		return false;
	if(!validatePhoneNumber(window.document.frmApplyOnline.appli_cell_phone))
		return false;
	
	if(!validatePhoneNumber(window.document.frmApplyOnline.seller_phone))
		return false;
		
		
	if(!validateSSN(window.document.frmApplyOnline.appli_ssn))
		return false;
	
	if(!validDate(window.document.frmApplyOnline.appli_month,window.document.frmApplyOnline.appli_day,window.document.frmApplyOnline.appli_year))
		return false;
	
	/*******************************/
	
	
	
	if(document.frmApplyOnline.radAccept.checked)
		return true;
	else
	{
			alert("Please Accept Transmission Signature");
			return false;
	}
	
return true;
}


function validatePhoneNumber(phone)
{	
	var pv = phone.value;
	if(pv != '')
	{
		var MainPhone = new RegExp('^\\d{3}-\\d{3}-\\d{4}$');
		if(pv.match(MainPhone))
		{
			return true;
		}
		else
		{	
			alert("Phone must be in format xxx-xxx-xxxx.");
			phone.focus();
			return false;
		}
	}
	else
	{
		return true;
	}
}

function validateSSN(ssn)
{
	sv = ssn.value;
	
	if(sv != '')
	{
		var ssn_no = new RegExp('^\\d{3}-\\d{2}-\\d{4}$');
		
		if(sv.match(ssn_no))
		{
			return true;
		}
		else
		{
			alert("SSN must be in format xxx-xx-xxxx.");
			ssn.focus();
			return false;
		}					
	}
	else
	{
		return true;
	}
}


function fnOnOff(frmName, txtBoxValue)
{
	if(document.frmApplyOnline.appli_is_joint[0].checked)
	{
		eval("document."+frmName+"."+"hid_Joint_Application").value = txtBoxValue;
		document.getElementById('div_co_applicatnt').style.display = 'block';
	}
	else
	{
		eval("document."+frmName+"."+"hid_Joint_Application").value = txtBoxValue;
	   document.getElementById('div_co_applicatnt').style.display = 'none';
	}
}

function fn_Hid_textBox(frmName, txtBoxName, txtBoxValue)
{
	eval("document."+frmName+"."+txtBoxName).value = txtBoxValue;
	return true;
}

function fn_Hid_chkBox(frmName, txtBoxName, checkBoxName, txtBoxValue)
{
	if(eval("document."+frmName+"."+checkBoxName).checked)
		eval("document."+frmName+"."+txtBoxName).value = txtBoxValue;
	else
		eval("document."+frmName+"."+txtBoxName).value = "";
	return true;
}

