document.observe('dom:loaded', loadItems);

function loadItems() {
}

var Calculator = {
	weight: '',
	size: '',

	count: function() {
		if (document.getElementById("typea").checked == true) Calculator.counta()
		else if (document.getElementById("typeb").checked == true) Calculator.countb();
		Calculator.show();
	},
	
	counta: function() {
		Calculator.weight = Math.ceil($('deapth').getValue() * $('width').getValue() * $('height').getValue()/3000)/2;
		Calculator.size = Math.round($('deapth').getValue() * $('width').getValue() * $('height').getValue()/1000)/1000;
	},

	countb: function() {
		Calculator.weight = Math.round($('deapth').getValue() * $('width').getValue() * $('height').getValue()/30)/100;
		Calculator.size = Math.round($('deapth').getValue() * $('width').getValue() * $('height').getValue()/1000)/1000;
	},
	
	show: function() {
		$('results').style.display = 'block';
		$('paid-weight').innerHTML = Calculator.weight + ' kg';
		$('size').innerHTML = Calculator.size + ' m&sup3;';
		if (Calculator.weight > $('weight').getValue()) $('paid-for').innerHTML = Calculator.weight + ' kg';
		else $('paid-for').innerHTML = $('weight').getValue() + ' kg';
	}
}