if(typeof(OrderController) == 'undefined') OrderController = new Object();
Object.extend(OrderController,
{
    
    updateTotal: function()
    {
        var total = 0;
		var ticketQuantity = 0;
		var frais = 0;
		$$('input.product-id').each(function(e) {
			var price = parseInt($F('product-price-'+ e.value));
			var quantity = parseInt($F('product-quantity-'+ e.value));
			ticketQuantity = ticketQuantity + quantity;
			if (typeof(price) && typeof(quantity))
				total += price * quantity;
		});
		
		$('order-subTotal').update('&nbsp;&nbsp;&nbsp;&nbsp;'+total+'&euro;');
		if (total > 0)
		{
			total = total + 8.03 + (ticketQuantity * 2.50);
			frais = 8.03 + (ticketQuantity * 2.50); 
		}
		else
		{
			frais = 8.03;
		}
		$('frais').update('&nbsp;+'+ frais +'&euro;');
		$('order-total').update('&nbsp;&nbsp;&nbsp;&nbsp;'+total+'&euro;');
    }
});
