var registrationForm = {
	calculateTotalCost : function(){
		var totalCost = 0;
		$$('.has-cost').each(function(item){
			var option = item.options[item.selectedIndex];
			$w(option.className).each(function(className){
				if(className.startsWith('cost-')){
					totalCost += Number(className.replace('cost-',''));
				}
			});
		});
		if($('submit')) $('submit').value = ((totalCost > 0)?'Next: Enter Payment Details':'Complete Registration');
	}
};

document.observe('dom:loaded',function(){
	$$('.has-cost').each(function(item){
		item.observe('change',registrationForm.calculateTotalCost);
	});
	registrationForm.calculateTotalCost();
}.bindAsEventListener(window));
