
function ShowHideDivValue(div,field) {

	fieldID=checkFieldIsNum(field);

	if (fieldID == true) {
		if (field.value >= 3) {
			document.getElementById(div).style.display='none';
		} else {
			document.getElementById(div).style.display='block';
		}	
	}
}

function checkTerms() {
		if ( document.forms.apply.terms_agree.checked == false )
		    {
		        alert ( "Please check the Terms & Conditions box." );
		        return false;
		    } 
return true;}


function SingleIncomeCalc(field) {

	fieldID=checkFieldIsNum(field);
	var apply=document.forms.apply;
	if (fieldID == true) {
		apply.total_income.value=Number(apply.annual_base_income.value)+Number(apply.other_employment.value)+Number(apply.other_income.value)+Number(apply.rental_income.value);
	}
}

function JointIncomeCalc(field) {
	fieldID=checkFieldIsNum(field);
	var apply=document.forms.apply;
	if (fieldID == true) {
		var apply=document.forms.apply;
		apply.joint_total_income.value=Number(apply.joint_annual_base_income.value)+Number(apply.joint_other_employment.value)+Number(apply.joint_other_income.value);
		apply.total_income_complete.value=Number(apply.total_income.value)+Number(apply.joint_total_income.value);
	}
}

function checkFieldIsNum(field) {
	thisFieldID=field.id;
	if (Number(field.value)) {
		return true;
	}
	else {
		alert("Please only enter numbers in this field. No commas or spaces."); 
		setTimeout("document.getElementById(thisFieldID).focus();",1);
		setTimeout("document.getElementById(thisFieldID).select();",1);
	}
}
