var OrderForms = {
	total: 0,
	container: false,
	initTotalCount: function(container)
	{
		this.container = $(container);
		this.container.select('.orderform-productgroup input.number').each(function(el) {
			el.observe('keyup', this.updateTotal.bind(this));
		}, this);
	},
	updateTotal: function(event)
	{
		this.total = 0;
		var el = Event.element(event);
		el.value = el.value.gsub(/[^0-9]+/, '');
		this.container.select('.orderform-productgroup input.number').each(function(el) {
			var count = (el.value*1);
			var price = (el.next('input').value*1);
			this.total += (count*price);
		}, this);
		
		$('total').update(Math.round(this.total*100)/100);
	}
};
