$(document).ready(function() {	

  if ($.browser.msie && $.browser.version <= 6 ){  
      alert("La boutique Paris Voile n'est pas accessible avec Internet Explorer version 6 : pensez à faire la mise à jour.");
  }

  //carousel meilleurs ventes
  $('#best-sellers_block_right .block_content').jcarousel({scroll:1,auto:4,wrap:'last'});

	//$(document).pngFix();	
	$('#footer').localScroll();
	$('#rassurance').localScroll();
	$('.post').localScroll();
	
	$(".classified a img").parent().facybox();
	$(".classified a.description").click(function(){
	  $(this).prev().slideToggle("slow");
	});
	
	//Rotation des visuels editorial home
	
	// Indique l'image actuellement affichée
  var imgActive = 0;

  var imgArray = $('.homeleft a');
  var nbImg = $('.homeleft a').length;

  // Lancement du timeout toutes les 3 secondes
  var interval = setInterval(nextImage, 8000);

  function nextImage(){
  // Définition de la nouvelle image à afficher
  imgActive++;
  if(imgActive == nbImg) imgActive = 0;

  // Affichage de l'image active et masquage des autres
  imgArray.each(function(i, el){
  (imgActive == i) ? $(imgArray[i]).fadeIn(800) : $(imgArray[i]).fadeOut(800);
  });
  }
  
	
	/*$("li.sousmenu").hover(function(){
			$(this).children("UL").slideDown("fast");
  		$(this).prev().children("ul").fadeOut("fast");
  		$(this).siblings().children("ul").fadeOut("fast");
		},function(){
  });*/
		
	
		//$(this).parent().prev().children("ul").fadeOut("fast");
		//$(this).parent().siblings().children("ul").fadeOut("fast");
	
	  $("UL.niveau1 LI").hover(function(){

                    $(this).children("UL").slideDown("fast");
                    $(this).prev().children("ul").fadeOut("fast");
                    $(this).siblings().children("ul").fadeOut("fast");

            }, function(){

            });

            $("UL.niveau2").hover(function(){
            }, function(){
                    //$("UL.niveau1 LI UL").fadeOut("fast");
            });

            $("body").click(function(){
                    $("UL.niveau1 LI UL").fadeOut("fast");
            });

            $("UL.niveau2 LI").each(function(){
                    if($(this).children().is("ul")){
                            $(this).addClass("subMenu");
                    }
            });

  
	$("A#btn-allSeries").click(function(){
		$("UL.subSeries").slideToggle("slow");

		if ($(".subSeries").hasClass("open")){
			$(".subSeries").removeClass('open');
			$("A#btn-allSeries strong").text("Plus de séries ▼");

		}
		else{
			$(".subSeries").addClass('open');
			$("A#btn-allSeries strong").text("Moins de série  ▲");
		}
		return false;
	});
	
	
});