function mycarousel_initCallback(carousel) {
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};


$(document).ready(function() {
	//formulaire de recherche
	$("#form-recherche-input").focus(function() {
		if($(this).val() == 'Recherche') {
			$(this).val('');
		}
	}).blur(function() {
		if($(this).val() == '') {
			$(this).val('Recherche');
		}
	});


	/* Menu */
	$('.hidden-list > ul').each(function() {
		var liste = $(this);
		liste.hide();
		liste.prev('h2').find('a').click(function() {
			liste.stop(true, true).slideToggle().prev('h2').find('a').toggleClass('opened');
			return false;
		});
		
		// on cache le 2nd niveau
		liste.find('ul').hide();
		liste.find('li a').click(function() {
			if($(this).parent('li').find('>ul').length > 0) {
				$(this).toggleClass('opened').parent('li').find('ul').slideToggle();
				return false;
			}
		});
	});
	
	// animation Home page
	$('.diaporama-index').cycle();

	// animation des actus
	$('.evenements ul').cycle();
	
	// animation des logos de marques
	$('#logos-marques').jcarousel({
		auto: 2,
        wrap: 'circular',
        scroll : 1,
        initCallback: mycarousel_initCallback
    });
	
	// colorbox sur les logos DKN Technology Services
	$(".dkn-techno").colorbox({inline:true, href:"#dkn-techno-lightbox"});
	
	// colorbox sur les images des produits
	$('.lightbox').colorbox({
		innerWidth: '800px',
		innerHeight: '600px',
		photo: true
	});
	
	if($('#myImageFlow img').length == 0) {
		$('#myImageFlow').hide();
	}

	//zoom
	var zoomOptions = {
			zoomWidth: 350,
			zoomHeight: 250,
	        xOffset: 10,
	        yOffset: 0,
		    position: "right" //and MORE OPTIONS
	};
	$('.zoom').jqzoom(zoomOptions);
});

