// DOM Loaded 
$(function(){ 
     
    //init js styles 
    $('body').addClass('hasJS');

    var pager = $('#centre-slideshow .slideshow-item').wrapAll('<div class="bigimgs">').parents('#centre-slideshow').after('<ul class="menu" id="centre-slideshow-pager">');
    
    $('#centre-slideshow .bigimgs').append('<a href="#" id="play-pause"><img src="../../e_img/charte/play-pause.png" alt="play-pause" /></a>'); 
    
    // homepage cycles 
    $(pager).cycle({ 
        fx:'scrollLeft', 
        easing: 'swing', 
        inDelayz:    250, 
        //drop:       40,
        //delay:      600000,
        pauseOnPagerHover: 0,
        pause: 0, 
        timeout:    5000, 
		    before:  onBefore,
        slideExpr: '.slideshow-item', 
        pager:      '#centre-slideshow-pager', 
        pagerAnchorBuilder: function(idx, slide) { 
            li = slide.children[2].children[0];  
            slide.removeChild(slide.children[2]);  

            return "<li>" + li.innerHTML + "</li>";  
        } 

    });
    
    var play = true;
    $('#play-pause').addClass('play').bind("click", function(e){
      if(play) {
        $(pager).cycle('pause');
        play = false;
        $('#play-pause').addClass('play');
      } else {
        $(pager).cycle('resume');
        play = true;
        $('#play-pause').removeClass('play');
      }
      
      return false;
    });

	
$(function() {
    jQuery('#centre-slideshow-pager').jcarousel({
        scroll:1,
        vertical:true
    });
});

	
function onBefore() { 
    $('#output').html("Scrolling image:<br />" + this.id); 
} 	
     
}); 
 
/* Window load event (things that need to wait for images to finish loading) */ 
//equal heights 
