function keepWare(wareId) {
    if (!wareId) return;
    $.get('/cart/keep/' + wareId + '/', function( data ) {
        $('#ajaxCart').html(data);
    });
}

function removeWares(who) {
    if (!who) return;
    if (confirm('Вы уверены, что хотите удалить выделенные позиции из корзины?' )) {
        who.form.action = "/remove_wares.php";
        who.form.submit();
    } else {
        return false;
    }
}

function saveCart(who) {
    if (!who) return;
    who.form.action = "/save_cart.php";
}

function setInCart(wareId) {
    var keep = document.getElementById("keep_" + wareId);
    var inCart = document.getElementById("inCart_" + wareId);

    if (!keep || !inCart) {
        var keep = parent.document.getElementById("keep_" + wareId);
        var inCart = parent.document.getElementById("inCart_" + wareId);
    }

    if (!keep || !inCart) return;

    keep.style.display = "none";
    inCart.style.display = "block";
}

function dropCart(who) {
    if (!who) return;
    if (confirm('Вы уверены, что хотите очистить корзину?' )) {
        who.form.action = "/drop_cart.php";
        who.form.submit();
    } else {
        return false;
    }
}
