function dbg () {
    if (typeof(console) == 'object' && typeof(console.log) == 'function') {
        console.log.apply(console, arguments);
    }
}

function isset(variable) {
    return typeof(variable) != 'undefined';
}

var pp = {};

pp.cart = {};

pp.cart.view = {};

pp.cart.view.set_item_count = function (count) {
    $('.cart_view .item_count').text(count);
    $('.cart_view').show();
    $('.cart_empty').hide();
}

pp.cart.view.set_total = function (total) {
    $('.cart_view .total').text(total);
    $('.cart_view').show();
    $('.cart_empty').hide();
}

pp.cart.view.set_empty = function () {
    $('.cart_view').hide();
    $('.cart_empty').show();
}

pp.cart.update = function (new_item_count, new_total) {
    if (isset(new_item_count)) {
        pp.cart.view.set_item_count(new_item_count);
        pp.cart.view.set_total(new_total);
    }
    else {
        pp.cart.view.set_empty();
    }
}
