// Initialisation de la box
function initPanier()
{
	box = new Ajaxbox();
}

// Affichage de la box
function showPanier(id,action,qtt)
{
	//if(action == 'add') box.show();
	
	// Requête AJAX (nécessite la librairie Prototype)
	new Ajax.Request('/ajax.php',
	{
		method: 'post',
		parameters: 'action='+action+'&id='+id+'&qtt='+qtt,
		onSuccess: function(ajax)
		{
			// Mise à jour de la box
			if(action == "add")
			{
				alert('Le produit a bien été ajouté à votre panier.');
			}
			// Mise à jour du tableau panier
			else
			{
				majPanier();
			}
		}
	});
}

// Fermeture de la box
function hidePanier()
{
	box.hide();
}

// Mise à jour des informations du panier
function majPanier ()
{
	// Requête AJAX (nécessite la librairie Prototype)
	new Ajax.Request('/ajax.php',
	{
		method: 'post',
		parameters: 'action=maj',
		onSuccess: function(ajax)
		{
			$("panier").update(ajax.responseText);
		}
	});
}