if(typeof(Offbeat) == 'undefined') var Offbeat = {}; Offbeat.Cart = Class.create(); Object.extend(Offbeat.Cart.prototype, { initialize: function(url) { this.url = url; }, removeItem: function(id) { new Ajax.Request(this.url + 'action/removeCartItem/', { parameters: { cartitem: id }, onSuccess: function(transport) { $('cart-item_' + id).remove(); $('total').update(transport.responseText); } }); }, changeQuantity: function(id, quantity) { new Ajax.Request(this.url + 'action/updateCartItemQuantity/', { parameters: { cartitem: id, quantity: quantity }, onSuccess: function(transport) { $('total').update(transport.responseText); } }); }, changeType: function(id, type) { new Ajax.Request(this.url + 'action/updateCartItemType/', { parameters: { cartitem: id, type: type }, onSuccess: function(transport) { $('total').update(transport.responseText); } }); }, next: function(parameters) { new Ajax.Updater('callout-panel', this.url + 'checkout/next', { evalscripts: true, parameters: parameters }); } });