function CurrencyFormatted(amount)
{
	var i = parseFloat(amount);
	if(isNaN(i)) { i = 0.00; }
	var minus = '';
	if(i < 0) { minus = '-'; }
	i = Math.abs(i);
	i = parseInt((i + .005) * 100);
	i = i / 100;
	s = new String(i);
	if(s.indexOf('.') < 0) { s += '.00'; }
	if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
	s = minus + s;
	return s;
}

function savingsCalc() {	
	var x = document.getElementById('bottlesno').value;
	var y = document.getElementById('bottleprice').value;
	var z = document.getElementById('coolersno').value;
	var total = 12*((x*y)+(z*10)-39.95*z);
	total = Math.round(total*100)/100;
	if (total < 0) {
		total = 0;
	}
	$('sum').update(CurrencyFormatted(total));
}