/*
* add certain item to cart
* @param productId integer identifier of item
* @param type integer item store type (1 - current, 2 -nix)
* @return void
*/
function addToCart(productId, type) {
	$.post('ajax/cart.php', { 'productId': productId, 'type' : type, 'action' : 'add'}, renderCart, 'html');
}


/*
* remove certain product line to cart
* @param cartProductId integer identifier of item
* @return void
*/
function removeFromCart(cartProductId) {
	$.post('ajax/cart.php', { 'cartProductId': cartProductId, 'action' : 'remove'}, renderCart, 'html');
}



/*
* clear cart completely
* @return void
*/
function clearCart() {
	$.post('ajax/cart.php', {'action' : 'clear'}, function(data) { $('#cart').empty() });
}

/*
* render cart table
* @param data string incoming data
* @return void
*/
function renderCart(data) {
	$('#cart').replaceWith(data);
}

