function ajax_addtocart(item_id, sticker_id, color, size, price, tax) {

    var postvalue = 'item='+encodeURI(item_id)+
                    '&sticker='+encodeURI(sticker_id)+
                    '&color='+encodeURI(color)+
                    '&size='+encodeURI(size)+
                    '&price='+encodeURI(price)+
                    '&tax='+encodeURI(tax);

    post(postvalue, 'ajax/addtocart.php', addtocart_done);
}

function addtocart_done() {

 if(http_request.readyState == 4) { 
     document.getElementById('cartcounter').innerHTML = http_request.responseText;
     countcart();
  }
}

function countcart() {
    post('', 'ajax/cartcounter.php', countcart_done);
}

function countcart_done() {
 if(http_request.readyState == 4) { 
     document.getElementById('header_cartcounter').innerHTML = http_request.responseText;
  }
}

function countcart_itempage(item_id, sticker_id) {

    var postvalue = 'item='+encodeURI(item_id)+
                    '&sticker='+encodeURI(sticker_id);
    post(postvalue, 'ajax/cartcounter_itempage.php', countcart_itempage_done);
}

function countcart_itempage_done() {
 if(http_request.readyState == 4) { 
     document.getElementById('cartcounter').innerHTML = http_request.responseText;
  }
}

