var Cart = {
	cont: null,
	init: function(){
		$$(".cart-btn").each(function(el){
			el = $(el);
			el.observe("click", this.addToCart.bind(this, el));
		}.bind(this));
		this.cont = $("cart-cont");
	},
	addToCart: function(el){
		var id = el.readAttribute("_id");
		el.fade();
		this.cont.fade({duration: 0.5});
		Main.request(js_url+"ajax_general.php", {
			parameters: {"cmd" : "add-to-cart", "item_id": id},
			onSuccess: function(js){
				setTimeout(function(cart){
					this.cont.update(cart);
					this.cont.appear();
				}.bind(this, js['cart']), 450);
			},
			scope: this
		});
	}
};
Main.onReady(Cart.init, Cart);
