﻿//Add book
function addToCart(bookid, title, show, type, divbox){
    include('/library/App_Modules/CartUpdater.aspx?action=add&show='+show+'&bookid='+bookid, divbox, type);
    alert('Boken "'+title+'" är nu tillaggd!');
}

function updateBookCount(bookid, count, show, type, divbox){
    var co = document.getElementById(count);
    include('/library/App_Modules/CartUpdater.aspx?action=update&show='+show+'&bookid='+bookid+'&count='+co.value, divbox, type);
    alert('Antalet är nu uppdaterat!');
    updateMenuCart();
}

//remove book
function removeFromCart(bookid, title, show, type, divbox){
    include('/library/App_Modules/CartUpdater.aspx?action=remove&show='+show+'&bookid='+bookid, divbox,type);
    alert('Boken "'+title+'" är nu borttagen!');
    if (show == 'cart')
        updateMenuCart();
}

function clearCart(show, type, divbox){
    include('/library/App_Modules/CartUpdater.aspx?action=clean&show='+show, divbox,type);
    alert('Din kundvagn är nu tömd!');
    updateMenuCart();
}

function updateMenuCart(){
    include('/library/App_Modules/CartUpdater.aspx?action=show&show=menucart', 'MenuCartDiv','get');
}