// This gives the user a running total of the loan, based on the parameters passed to the function
function totaliser(totalTarget) {
	var runningTotal = 0;
	// Loops through all the arguments after the first one passed to the function
	for (i=1; i<arguments.length; i++) {
		// The new number we're adding to the total
		var newValue = document.getElementById('ctl00_ContentPlaceHolder_ctl00_' + arguments[i]).value;

		// Basic validation
		if ((newValue == '') || (isNaN(newValue))) {
			newValue = 0;
		}
		// Makes newValue a number, then adds it to the running total
		runningTotal = runningTotal + parseFloat(newValue);
	}

	totalTarget = document.getElementById('ctl00_ContentPlaceHolder_ctl00_' + totalTarget);
	totalTarget.innerHTML = runningTotal;
}
// Added by Martin Spinks - 27/03/2006
// This is to account for Calculator changes to the way the expenditure totals are
// displayed on the page.
// This gives the user a running total of the loan, based on the parameters passed to the function
function totaliserCardBalance(totalTarget) {
	var totalValue = 0;
	// Loops through all the arguments after the first one passed to the function
	for (i=1; i<arguments.length; i++) {
		// The new number we're adding to the total
		var newValue = document.getElementById(arguments[i]).value;
		// Basic validation
		if ((newValue == '') || (isNaN(newValue))) {
			newValue = 0;
		}
		// Makes newValue a number, then adds it to the running total
		totalValue = parseFloat(newValue) * 0.05;
	}
	totalTarget = document.getElementById(totalTarget);
	totalTarget.value = totalValue;
}