/* Fonction qui permet d'afficher le détails d'un plus dans une popup */
function popupPlus(id)
{
		// Appel ajax
		var page = "ajax/popup/popup_plus.php";
		var data = "&idplus="+id;
		$.ajax( {
			type : "GET",
			url : page,
			data : data,
			success : function(msg) {
				// fonction retour
				$("#popup_produit_contenu").html(msg);
				affiche("popup_details_produits");
		}
		});
}
	
/* Fonction qui permet d'afficher le détails d'un ingrédient dans une popup */
function popupPourquoiPas(id)
{
		// Appel ajax
		var page = "ajax/popup/popup_pourquoi_pas.php";
		var data = "&idpourquoi_pas="+id;
		$.ajax( {
			type : "GET",
			url : page,
			data : data,
			success : function(msg) {
				// fonction retour
				$("#popup_produit_contenu").html(msg);
				affiche("popup_details_produits");
		}
		});
}

/**
 * Animation du bandeau
 */
function diaporama(prefix_div, num, max)
{
	$("#"+prefix_div+num).fadeOut("fast",function()
	{
		var next = parseInt(num) < parseInt(max) ? parseInt(num) + 1 : 1;

		if(parseInt(next) >= parseInt(max) )
		{
			next = 1;
		}
		
		$("#"+prefix_div+next).fadeIn("fast",function()
		{
			if(parseInt(max) > 2)
			{
				setTimeout("diaporama('"+prefix_div+"','"+next+"','"+max+"')", 3000);
			}		
		});
	});
}
