//
// Require Prototype 1.6
//

var gUpdatePricePath = '';

document.observe('dom:loaded', function() {
	var variants = $('variants'), form = $('cartForm'), price = $('price');
	if (!variants || !form || !price) return;
	variants.select('select').invoke('observe', 'change', function(e) {
		new Ajax.Updater(price, gUpdatePricePath, {
			method: 'put', parameters: form.serialize(),
			onSuccess: function() {
				price.highlight({ duration: 1 });
			},
			onFailure: function() {
				alert('Le prix n’a pas pu être rechargé');
			}
		});
	});
});
