jQuery.noConflict();
jQuery(function() {
	jQuery('.list_tabular').equalHeights();
	
	/*jQuery('.produit').hover(
		function() {
			jQuery(this).addClass("hovered").hover(
				function(){ 
					jQuery(this).addClass("hovered"); 
				},
				function(){ 
					jQuery(this).removeClass("hovered"); 
				}
			);
		}
	);*/
	
	jQuery('#produits-vedettes .produit, .list_tabular').fitted();
	
	//Slide Accueil
	var clicked = true;
	//Show Banner
	//Show Banner jQuery("#block-slides .slide").show(); 
	 jQuery(".slide .block").animate({ opacity: 1 }, 1 ); //Set Opacity

	//Click and Hover events for thumbnail list
	jQuery('.slide-thumb ul li:first').addClass('active'); 
	jQuery('.slide-thumb ul li').click(function(){ 
		//Set Variables
		//Get Alt Tag of Imagevar imgAlt = jQuery(this).find('img').attr("alt"); 
		//Get Main Image URLvar imgTitle = jQuery(this).find('a').attr("href"); 
		var imgDesc = jQuery(this).find('.block').html(); 	//Get HTML of block
		var imgDescHeight = jQuery(".slide").find('.block').height();	//Calculate height of block	
		
		if (jQuery(this).is('.active')) {  //If it's already active, then...
			return false; // Don't click through
		} else {
			//Animate the Teaser				
			jQuery('.slide .block').animate({ opacity: 0 }, 250 , function() {
				jQuery('.slide .block').html(imgDesc).animate({ opacity: 1 }, 250 );
				//jQuery(".block-slides img").attr({ src: imgTitle , alt: imgAlt});
			});
		}
		
		jQuery('.slide-thumb ul li').removeClass('active'); //Remove class of 'active' on all lists
		jQuery(this).addClass('active');  //add class of 'active' on this list only
		clicked = false;
		return false;
		
	}) .hover(function(){
		jQuery(this).addClass('hover');
		}, function() {
		jQuery(this).removeClass('hover');
	});
	
	//Paging + Slider Function
	if(clicked) {
	rotate = function(){	
		var triggerID = $active.children().attr("rel") - 1; //Get number of times to slide
		//Determines the distance the image reel needs to slide var image_reelPosition = triggerID * imageWidth; 
		$activeContent = $active.find('.block').html();

		jQuery(".slide-thumb li").removeClass('active'); //Remove all active class
		$active.addClass('active'); //Add active class (the $active is declared in the rotateSwitch function)
		
		//Slider Animation
		jQuery(".slide .block").animate({ opacity: 0 }, 250 , function() {
				jQuery('.slide .block').html($activeContent).animate({ opacity: 1 }, 250 );
				//jQuery(".block-slides img").attr({ src: imgTitle , alt: imgAlt});
			});
		
	}; }
	
	//Rotation + Timing Event
	rotateSwitch = function(){		
		play = setInterval(function(){ //Set timer - this will repeat itself every 3 seconds
			$active = jQuery('.slide-thumb li.active').next();
			if ( $active.length === 0) { //If paging reaches the end...
				$active = jQuery('.slide-thumb li:first'); //go back to first
			}
			rotate(); //Trigger the paging and slider function
		}, 7000); //Timer speed in milliseconds (3 seconds)
	};
	
	rotateSwitch(); //Run function on launch

	

});

