$(document).ready(function(){
	
	var base_dir = "/fr/axs_cart/";

	//render_cart();

	$(".session-info").click(function(){
		$.ajax({
		   type: "POST",
		   url: base_dir + "axscart_api.php",
		   data: "action=session_info",
		   success: function(msg){
		     $('#session_info').html(msg);
		   }
		 });
	});
	
	$(".add-item").click(function(){
		
		$.ajax({
		   type: "POST",
		   url: base_dir +"axscart_api.php",
		   data: "action=add_item&id="+this.id,
			async:true,
		   success: function(msg){
		     	$('#cart_container').html(msg);
				$('.delete-item').click(function(){	delete_item(this);});
		   }
		 });
	});
	
	
	
	// $(".delete-item").click(function(){	delete_item(this.id)	});
	
	// $(".reset-cart").click(function(){
	// 
	// 	$.ajax({
	// 	   type: "POST",
	// 	   url: base_dir + "axscart_api.php",
	// 	   data: "action=reset_cart",
	// 		async:false,
	// 	   success: function(msg){
	// 			if (msg == 1) { render_cart(); }
	// 	     		
	// 	   	}
	// 	 });
	// 
	// });
	
	
	
	//-------------------------------- ##### CHANGE URL
	
	// $('.checkout').click(function(){
	// 		//-------------- ajouter le https::::::::
	// 		window.location.href = "checkout.php";
	// 	});
	
	
	
	// $(".translate-to").click(function(){
	// 	
	// 	$.ajax({
	// 	   type: "POST",
	// 	   url: base_dir + "axscart_api.php",
	// 	   data: "action=translate_to&language="+this.id,
	// 		async:true,
	// 	   success: function(msg){
	// 	     	$('#cart_container').html(msg);
	// 			$('.delete-item').click(function(){	delete_item(this);});
	// 	   }
	// 	 });
	// 	
	// });
	
	
	
	// function render_cart(){
	// 	alert('render');
	// 	$.ajax({
	// 	   type: "POST",
	// 	   url: base_dir + "axscart_api.php",
	// 	   data: "action=render",
	// 		async:false,
	// 	   success: function(msg){
	// 	     $('#cart_container').html(msg);
	// 	
	// 			$('.delete-item').click(function(){
	// 				delete_item(this);
	// 			});
	// 	
	// 	   }
	// 	 });
	// 	
	// 	// render cart
	// }
	
	
	// function delete_item(item){
	// 	alert('del'+item.id);
	// 	
	// 	$.ajax({
	// 	   type: "POST",
	// 	   url: base_dir + "axscart_api.php",
	// 	   data: "action=delete_item&id="+item.id,
	// 		async:false,
	// 	   success: function(msg){
	// 			$('#cart_container').html(msg);
	// 			$('.delete-item').click(function(){	delete_item(this);});
	// 	   }
	// 	 });
	// 	
	// 	// end delete_item
	// }
	// 


	
	
	
// END DOCUMENT READY	
});

