

var cart = {

    add: function (el, product_id) {
        //el.value = 'Wait a moment...';
        el.disabled = true;
        var res = app.get('cart_response');
        res.style.display = 'block';
        res.innerHTML = 'Wait a moment...';
        res.style.display = 'block';
        var ret = ajax.exec('POST', '/application/api/cart.add.php', 'product_id=' + product_id);
        //if (ajax.http.status != 200) return alert('It was not possible to add this product to the cart');;
        //alert(r);
        //res.style.display = 'block';
        res.innerHTML = 'Added to <a href="/cart/"><b>cart</b></a>';
        //FadeColor('cart_response', '#ffff00', '#ffffff', 1000);

        var msg = app.get('cart_message');
        msg.innerHTML = ret;
        //el.value = 'Add to cart';
        el.disabled = false;
    }
    /*,
    addToWishlist: function (el, product_id) {
        el.disabled = true;
        var ret = ajax.exec('/application/api/wishlist.add.php', 'product_id=' + product_id);
        var res = app.get('cart_response');
        res.style.display = 'block';
        res.innerHTML = 'added to <a href="/cart/wishlist">wishlist</b>';
        FadeColor('cart_response', '#ffff00', '#ffffff', 1000);
        //alert(r);
        el.disabled = false;
    }
    */
}
