$(document).ready(function(){

$('.zoombox1').zoombox({
theme : 'lightbox', //available themes : zoombox,lightbox, prettyphoto, darkprettyphoto, simple
opacity : 0.8, // Black overlay opacity
duration : 800, // Animation duration
animation : true, // Do we have to animate the box ?
width : 800, // Default width
height : 200, // Default height
gallery : true, // Allow gallery thumb view
autoplay : false // Autoplay for video
});

$('.zoombox2').zoombox({
theme : 'lightbox', //available themes : zoombox,lightbox, prettyphoto, darkprettyphoto, simple
opacity : 0.8, // Black overlay opacity
duration : 800, // Animation duration
animation : true, // Do we have to animate the box ?
width : 800, // Default width
height : 300, // Default height
gallery : true, // Allow gallery thumb view
autoplay : false // Autoplay for video
});

$('.zoombox3').zoombox({
theme : 'lightbox', //available themes : zoombox,lightbox, prettyphoto, darkprettyphoto, simple
opacity : 0.8, // Black overlay opacity
duration : 800, // Animation duration
animation : true, // Do we have to animate the box ?
width : 800, // Default width
height : 600, // Default height
gallery : true, // Allow gallery thumb view
autoplay : false // Autoplay for video
});

    jQuery('#brands').jcarousel({
    	wrap: 'circular'
    });

		$('#partenaires, #liens-a-voir, #header .subMenu').hide()
		.parent().hover(function(){
						$(this).children("ul").slideDown("fast");
		})
		.hover(function() {}, function() {
						$(this).children("ul").slideUp("fast");
						})
		.end();

        //CARROUSEL HOME////////////
        playSlideshow = setInterval('slideSwitchTimed()', 3000 );
        $("#cStep .showProduct").hide();
		$("#cStep ul li:first").addClass('active').children(".showProduct").show();
		$("#cStep ul li").click(function () {
		    var imgAlt = $(this).find('img').attr("alt"); 
			var imgTitle = $(this).find('a').attr("href"); 

			if ($(this).is(".active")) {
				return false;
			} else {
					
			 $("img#cMain").hide().attr({ src: imgTitle , alt: imgAlt}).fadeIn();
				
			}
 
			$("#cStep ul li").removeClass('active').children(".showProduct").hide(); 
			$(this).addClass('active').children(".showProduct").show();  
			return false;
            $active = $(this);
            slideSwitchClick();
		})
		.hover(function(){ 
 
		$(this).addClass('hover'); 
		clearInterval(playSlideshow);
		}, function() {
		$(this).removeClass('hover'); 			
		});
        
        $("#cStep ul li .showProduct").click(function () {
            var link = $(this).find('a').attr("href"); 
            window.location.href=link;
        });
 

});


/************************************************/
/************************************************/


 
function slideSwitchTimed(){
	$active = $('#cStep ul li.active').next();
	if ( $active.length == 0 ) $active = $('#cStep ul li:first'); 
	slideSwitch();
}

function slideSwitchClick() {
slideSwitch();			
}

function slideSwitch() {
var $prev = $('#cStep ul li.active');

$prev.removeClass('active');
$prev.children("p.showProduct").hide();
$active.addClass('active');
$active.children("p.showProduct").show();

//initialisation variable
var imgAlt = $active.find('img').attr("alt"); 
var imgTitle = $active.find('a').attr("href"); 

    if ($(this).is(".active")) {
    return false; 
    } else { 
    $("img#cMain").hide().attr({ src: imgTitle , alt: imgAlt}).fadeIn();		
    }
    return false;
}

