
function hl(source){ 
	if (source.className == 'click-1') {
		source.className = 'click-2';
	} else if (source.className == 'click-2') {
		source.className = 'click-3';
	} else if (source.className == 'click-3') {
		source.className = 'click-1';
	} else {
		source.className = 'click-1';
	}
}

function ValidChars(sText,ValidChars) {
	var IsNumber=true;
	var Char;
	for (i = 0; i < sText.length && IsNumber == true; i++) { 
		Char = sText.charAt(i); 
		if (ValidChars.indexOf(Char) == -1)  {
			IsNumber = false;
		}
	}
	return IsNumber;
}
	
function clearYears() {
document.getElementById("loan_num_years").value = '';
}

function clearPayment() {
document.getElementById("loan_payment_amount").value = '';
}

function checkform (form) {
	if (form.loan_amount.value == "") {
		alert( "Please enter the debt amount" );
		form.loan_amount.focus();
		return false;
	}
	if (!ValidChars(form.loan_amount.value,"0123456789.")) {
		alert( "Please enter only numbers for the debt amount (no commas)" );
		form.loan_amount.focus();
		return false;
	}
	if (form.loan_percent.value == "") {
		alert( "Please enter the interest rate" );
		form.loan_percent.focus();
		return false;
	}
	if (form.loan_num_years.value == "" && form.loan_payment_amount.value == "") {
		alert( "Please enter the number of years or the payment" );
		form.loan_num_years.focus();
		return false;
	}
	if (!ValidChars(form.loan_percent.value,"0123456789.")) {
		alert( "Please enter only numbers for the interest rate" );
		form.loan_percent.focus();
		return false;
	}
}

