function mycarousel_initCallback(carousel){
	carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });
    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};


$(function() {
	$( "#simpleSearch").autocomplete({
		minLength:1,
		delay:200,
		source: "/fonctions/autocomplete.html?showtemplate=false"
		
	});
});


jQuery(document).ready(function() {
    // CAROUSEL
	/*
	jQuery('#offres-speciales').jcarousel({
        auto: 5,
        wrap: 'circular',
		visible:3,
		animation:600,
		scroll:1,
        initCallback: mycarousel_initCallback
    });*/
	jQuery('#offres-speciales').jCarouselLite({
        circular: true,
		auto: 5000,
		visible:3,
		speed:600,
		scroll:1,
 		btnNext:'.right-arrow',
		btnPrev:'.left-arrow'
	});

	jQuery('#scroller-images-hotel').jCarouselLite({
        circular: true,
		visible:3,
		speed:600,
		scroll:1,
 		btnNext:'.right-arrow',
		btnPrev:'.left-arrow'
	});


	jQuery('#offres-speciales-vert').jcarousel({
        auto: 2,
        wrap: 'circular',
		visible:2,
		animation:600,
		scroll:1,
		vertical:true,
		buttonNextHTML:null,
		buttonPrevHTML:null,
        initCallback: mycarousel_initCallback
    });
	jQuery("a.fancybox").click(function() {
		var imgToDisplay = $(this).attr('href');
		//alert(imgToDisplay);
		$('.bigImage img').attr('src', imgToDisplay);
		return false;
	
	});
	/*jQuery("a.fancybox").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	true
	});*/
	
	jQuery("a.iframe").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'width'			:	870, 
		'height'		:	660, 
		'overlayShow'	:	true
	});
	
	// SLIDER HOMEPAGE
	$('#slider').nivoSlider({
        effect: 'fade', // Specify sets like: 'fold,fade,sliceDown'
        animSpeed: 800, // Slide transition speed
        pauseTime: 8000, // How long each slide will show
        startSlide: 0, // Set starting Slide (0 index)
        directionNav: false, // Next & Prev navigation
        directionNavHide: true, // Only show on hover
        controlNav: false, // 1,2,3... navigation
        controlNavThumbs: false, // Use thumbnails for Control Nav
        controlNavThumbsFromRel: false, // Use image rel for thumbs
        controlNavThumbsSearch: '.jpg', // Replace this with...
        controlNavThumbsReplace: '_thumb.jpg', // ...this in thumb Image src
        keyboardNav: false, // Use left & right arrows
        pauseOnHover: false, // Stop animation while hovering
        manualAdvance: false, // Force manual transitions
        captionOpacity: 0.8, // Universal caption opacity
        prevText: 'Prev', // Prev directionNav text
        nextText: 'Next', // Next directionNav text
        beforeChange: function(){}, // Triggers before a slide transition
        afterChange: function(){}, // Triggers after a slide transition
        slideshowEnd: function(){}, // Triggers after all slides have been shown
        lastSlide: function(){}, // Triggers when last slide is shown
        afterLoad: function(){} // Triggers when slider has loaded
    });	
		// SLIDER HOMEPAGE
	$('#blocImageHP').nivoSlider({
        effect: 'fade', // Specify sets like: 'fold,fade,sliceDown'
        animSpeed: 800, // Slide transition speed
        pauseTime: 4000, // How long each slide will show
        startSlide: 0, // Set starting Slide (0 index)
        directionNav: false, // Next & Prev navigation
        directionNavHide: true, // Only show on hover
        controlNav: true, // 1,2,3... navigation
        controlNavThumbs: false, // Use thumbnails for Control Nav
        controlNavThumbsFromRel: false, // Use image rel for thumbs
        controlNavThumbsSearch: '.jpg', // Replace this with...
        controlNavThumbsReplace: '_thumb.jpg', // ...this in thumb Image src
        keyboardNav: false, // Use left & right arrows
        pauseOnHover: false, // Stop animation while hovering
        manualAdvance: false, // Force manual transitions
        captionOpacity: 0.8, // Universal caption opacity
        prevText: 'Prev', // Prev directionNav text
        nextText: 'Next', // Next directionNav text
        beforeChange: function(){}, // Triggers before a slide transition
        afterChange: function(){}, // Triggers after a slide transition
        slideshowEnd: function(){}, // Triggers after all slides have been shown
        lastSlide: function(){}, // Triggers when last slide is shown
        afterLoad: function(){} // Triggers when slider has loaded
    });	
	
	$('#content .right .infos h3').click(function() {
		if ($("#content .right .infos ul").is(":hidden")) {
			$("#content .right .infos ul").slideDown();
		} else {
			$("#content .right .infos ul").slideUp();
		}
	});
	$('#content .left .voyageurs h3').click(function() {
		if ($("#content .left .voyageurs div").is(":hidden")) {
			$("#content .left .voyageurs div").slideDown();
		} else {
			$("#content .left .voyageurs div").slideUp();
		}
	});


	$('.page #content .right .newsletter h3').click(function() {
		if ($(".page #content .right .newsletter div").is(":hidden")) {
			$(".page #content .right .newsletter div").slideDown();
		} else {
			$(".page #content .right .newsletter div").slideUp();
		}
	});

	$('.page #content .right .offre h3').click(function() {
		if ($(".page #content .right .offre div").is(":hidden")) {
			$(".page #content .right .offre div").slideDown();
		} else {
			$(".page #content .right .offre div").slideUp();
		}
	});


	// ONGLETS OFFRE SPECIALE



	$('.onglets-offre-speciale .descriptif').click(function() {
		$("#descriptif-produit").show();
		$("#photos-produit").hide();
		$("#carte-produit").hide();
		$("#informations-produit").hide();
		$('.onglets-offre-speciale li').removeClass('active');
		$('.onglets-offre-speciale li').addClass('inactive');
		$(this).removeClass('inactive');
		$(this).addClass('active');
	});
	$('.onglets-offre-speciale .photos').click(function() {
		$("#descriptif-produit").hide();
		$("#photos-produit").show();
		$("#carte-produit").hide();
		$("#informations-produit").hide();
		$('.onglets-offre-speciale li').removeClass('active');
		$('.onglets-offre-speciale li').addClass('inactive');
		$(this).removeClass('inactive');
		$(this).addClass('active');
	});
	$('.onglets-offre-speciale .carte').click(function() {
		$("#descriptif-produit").hide();
		$("#photos-produit").hide();
		$("#carte-produit").show();
		$("#informations-produit").hide();
		$('.onglets-offre-speciale li').removeClass('active');
		$('.onglets-offre-speciale li').addClass('inactive');
		$(this).removeClass('inactive');
		$(this).addClass('active');
	});
	$('.onglets-offre-speciale .informations').click(function() {
		$("#descriptif-produit").hide();
		$("#photos-produit").hide();
		$("#carte-produit").hide();
		$("#informations-produit").show();
		$('.onglets-offre-speciale li').removeClass('active');
		$('.onglets-offre-speciale li').addClass('inactive');
		$(this).removeClass('inactive');
		$(this).addClass('active');
	});

		$("#descriptif-produit").hide();
		$("#photos-produit").hide();
		$("#carte-produit").show();
		$("#informations-produit").hide();
		
		setTimeout('$("#carte-produit").hide();',500);
		setTimeout('$("#descriptif-produit").show();',500);


});

