/*create AJAX request to add book to the cart, the result will be displayed in minicart on the right side*/
function addToCart(id)
{
	var url = "/ajax/addtocart/"+id;//ajax.php will process the request, with parameters 'addtocart' and 'id'
	if (window.XMLHttpRequest) {
		// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
		xmlhttp.open("GET",url,false);
		xmlhttp.send(null);
	}
	else {
		// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		xmlhttp.open("GET",url,false);
		xmlhttp.send();
	}
	document.getElementById('minicartcontent').innerHTML=xmlhttp.responseText;//update minicart block with actual result
}

//remove the book from cart - ajax request
function delFromCart (id) 
{
	var url = "/ajax/delfromcart/"+id;//ajax.php will process the request, with parameters 'delfromcart' and 'id'
	if (window.XMLHttpRequest) {
		// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
		xmlhttp.open("GET",url,false);
		// xmlhttp.send(null);
		xmlhttp.send(null);
	}
	else {
		// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		xmlhttp.open("GET",url,false);
		xmlhttp.send();
	}
	document.getElementById('minicartcontent').innerHTML=xmlhttp.responseText;//update minicart block with actual result
	//alert 'item-'+id;
	removeElement('item-'+id);//remove item from view in showcart
}

function removeElement(id) {
  var element = document.getElementById(id);
  element.parentNode.removeChild(element);
}


