// window.onload = addPrices;

// window.onload = testBox;

var planPrice = 29.95;
var ticketPrice = 20;

function addPrices() 
{
	/*
	// Count number of offenses checked.
	var numOffenses = countChecked();
	
	var offensePrice = numOffenses * 20;
		
	var total = this.planPrice + offensePrice;
	*/
	
	var offensePrice = 20;
	var total = 0;
	
	total = this.planPrice + offensePrice;
	
	// Write total back to file
	document.getElementById("payment-due").innerHTML = total;
	
	// Add every 3 seconds
	setTimeout("addPrices()", 3000);
}

function testBox() 
{
	var numBoxes = document.addClientForm.butter.length;
	alert("Boxes: " + numBoxes);
}

function countChecked() {
	// Count the number of checkboxes.
	var numBoxes = document.addClientForm.offense.length;
	var i=0;
	var numChecked = 0;
	
	// Figure out how many have been checked.
	for (i=0; i<numBoxes; i++) {
		if (document.addClientForm.offense[i].checked) {
			numChecked++;	
		}
	}
	
	return numChecked;
}
