	var i = 1;
	function slideShow(){
		
		
		var taille_bandeau_list=$("#taille_bandeau_list").val();
		if(taille_bandeau_list=="1"){
				return false
		}else{
			 if(i == 4) j = 1;
			 else j = i+1;
			 $('#photo_'+i).fadeOut(
				400,
				function(){
				  $('#photo_'+j).fadeIn(400);
				}
			 );
			 if(i == 4) i = 1;
			 else i++;
			 
			// alert(i)
		}
	};
	$(function(){
		$(".carousel").jCarouselLite({
			btnNext: ".next",
			btnPrev: ".prev"
    	});
		//$('#pane1').jScrollPane({scrollbarWidth:5, scrollbarMargin:0, showArrows:true});
    //Get our elements for faster access and set overlay width
    var div = $('div.contentSlide'),
                 ul = $('ul.sc_menu'),
                 // unordered list's left margin
                 ulPadding = 15;

    //Get menu width
    var divWidth = div.width();

    //Remove scrollbars
    div.css({overflow: 'hidden'});

    //Find last image container
    var lastLi = ul.find('li:last-child');

    //When user move mouse over menu
    div.mousemove(function(e){

      //As images are loaded ul width increases,
      //so we recalculate it each time
      var ulWidth = lastLi[0].offsetLeft + lastLi.outerWidth() + ulPadding;

      var left = (e.pageX - div.offset().left) * (ulWidth-divWidth) / divWidth;
      div.scrollLeft(left);
	    
    });
});
	
	
	
setInterval('slideShow()',5000);

jQuery(document).ready(function($) {
	// We only want these styles applied when javascript is enabled
	$('div.navigation').css({'width' : '112px', 'float' : 'right'});
	$('div.content').css('display', 'block');

	// Initially set opacity on thumbs and add
	// additional styling for hover effect on thumbs
	var onMouseOutOpacity = 1.0;
	$('#thumbs ul.thumbs li').opacityrollover({
		mouseOutOpacity:   onMouseOutOpacity,
		mouseOverOpacity:  1.0,
		fadeSpeed:         'fast',
		exemptionSelector: '.selected'
	});
	
	// Initialize Advanced Galleriffic Gallery
	
	var __nbr_cdc=parseInt($("#__nbr_cdc").val());
	//alert(__nbr_cdc);
	if(__nbr_cdc>0){
		var gallery = $('#thumbs').galleriffic({
			delay:                     2500,
			numThumbs:                 10,
			preloadAhead:              10,
			enableTopPager:            false,
			enableBottomPager:         false,
			maxPagesToShow:            1,
			imageContainerSel:         '#slideshow',
			controlsContainerSel:      '#controls',
			captionContainerSel:       '#caption',
			loadingContainerSel:       '#loading',
			renderSSControls:          true,
			renderNavControls:         true,
			playLinkText:              'Play Slideshow',
			pauseLinkText:             'Pause Slideshow',
			prevLinkText:              '&lsaquo; Previous Photo',
			nextLinkText:              'Next Photo &rsaquo;',
			nextPageLinkText:          'Next &rsaquo;',
			prevPageLinkText:          '&lsaquo; Prev',
			enableHistory:             false,
			//autoStart:                 true,
			autoStart:                 false,
			syncTransitions:           true,
			//defaultTransitionDuration: 10,
			defaultTransitionDuration: 0,
			onSlideChange:             function(prevIndex, nextIndex) {
				// 'this' refers to the gallery, which is an extension of $('#thumbs')
				this.find('ul.thumbs').children()
					.eq(prevIndex).fadeTo('fast', onMouseOutOpacity).end()
					.eq(nextIndex).fadeTo('fast', 1.0);
			},
			onPageTransitionOut:       function(callback) {
				this.fadeTo('fast', 0.0, callback);
			},
			onPageTransitionIn:        function() {
				this.fadeTo('fast', 1.0);
			}
		});
	}

	/**** Functions to support integration of galleriffic with the jquery.history plugin ****/

	// PageLoad function
	// This function is called when:
	// 1. after calling $.historyInit();
	// 2. after calling $.historyLoad();
	// 3. after pushing "Go Back" button of a browser
	function pageload(hash) {
		// alert("pageload: " + hash);
		// hash doesn't contain the first # character.
		if(hash) {
			$.galleriffic.gotoImage(hash);
		} else {
			gallery.gotoIndex(0);
		}
	}

	// Initialize history plugin.
	// The callback is called at once by present location.hash. 
	$.historyInit(pageload, "advanced.html");

	// set onlick event for buttons using the jQuery 1.3 live method
	$("a[rel='history']").live('click', function(e) {
		if (e.button != 0) return true;
		
		var hash = this.href;
		hash = hash.replace(/^.*#/, '');

		// moves to a new page. 
		// pageload is called at once. 
		// hash don't contain "#", "?"
		$.historyLoad(hash);

		return false;
	});

	/****************************************************************************************/
	jQuery('#mycarousel').jcarousel({
        vertical: true,
        scroll: 1,
		itemLoadCallback: itemLoadCallbackFunction
    });
	function itemLoadCallbackFunction(carousel, state)
	{
		for (var i = carousel.first; i <= carousel.last; i++) {
			// Check if the item already exists
		}
		if ( carousel.last < parseInt(4)){
			$(".jcarousel-prev").css('display','none');
			$(".jcarousel-next").css('display','none');
			}
	};
});


