function carouselProduits()
{

	if ($('#coeurnav_produits ul').length)
	{
		$('#coeurnav_produits').jCarouselLite({
	        btnNext: ".next",
	        btnPrev: ".prev",
			speed : 750,
			visible: 4,
			scroll: 2,
			circular: false
		});

		// Si il y a moins de 5 produits Ã  afficher,  on affiche pas les flÃ¨ches prÃ©cÃ©dent/suivant
		if ($('#coeurnav_produits li').length <= 4)
		{
		 	$('#coeurnav_produits .prev a').css("visibility", "hidden");
			$('#coeurnav_produits .next a').css("visibility", "hidden");
		}
	}
}


$(document).ready(function() {

	initFicheAcc();
	carouselProduits();

	$("#coeurnav_select a").hover(function(){ //Mouseover
		if(this.id != "not-clickable" && this.id != "pause"){
			$(this).stop();
			$(this).ifxanimate({
   				//Vers "IN"
   				backgroundColor: '#000',
   				backgroundImage: 'none'
   			},
			500);
		}
	},function(){
		if(this.id != "not-clickable" && this.id != "pause"){ //Mouseout
			$(this).stop();
			$(this).ifxanimate({
   				//Vers "OUT"
   				backgroundColor: '#AA0065',
   				backgroundImage: 'url(/fileadmin/templates/img/coeurnav_fleche.gif)'
   			},
			500);
		}
	});

	$("#coeurnav_select a").click(function(){

		cacheFicheAcc();
		$("#loading").css("display", "block");

		ancienouvert = $("#coeurnav_select a#not-clickable");

		if($(this).attr('id') != "not-clickable"){

			this.setAttribute("id","not-clickable");

			ancienouvert.stop();
			ancienouvert.attr("id","pause");
			ancienouvert.ifxanimate({
					//Vers "OUT"
	   				backgroundColor: '#AA0065',
	   				backgroundImage: 'url(/fileadmin/templates/img/coeurnav_fleche.gif)',
	 				fontSize: '11px',
					fontWeight: 'normal'
				},
				200,function(){ancienouvert.attr("id","")}).css('padding-right','10px');

			$(this).stop();
			$(this).css('padding-right','0').ifxanimate({
				//Vers "OPEN"
	   			backgroundColor: '#FFFFFF',
	 			fontSize: '11px',
				fontWeight: 'bold'
			},
			200);
		}


		// URL de la requÃªte AJAX
		url_categorie = 'index.php?1=1';
		if ($(this).attr('href'))
			url_categorie = $(this).attr('href');


		$("#coeurnav_produits").fadeOut("slow",function(){

			$.ajax({
		        url: url_categorie+"?type="+accueil_cat_typenum,
		        success: function(data, textStatus) {
					$('#coeurnav_produits').empty().append(data);
		        },
		        error: function(XMLHttpRequest, textStatus, errorThrown){
					$('#coeurnav_produits').empty().append("Erreur de chargement des donnÃ©es... Veuillez rÃ©itÃ©rer l'opÃ©ration SVP."/*+errorThrown*/);
		        },
				complete: function(XMLHttpRequest, textStatus) {
					$("#loading").css("display", "none");

					$("#coeurnav_produits").fadeIn("slow", function(){
						initFicheAcc();
						carouselProduits();
					});
				}
		    });

		});

		return false;
	});

});




