var $scroll = $('#slider .scroll');
$('#slider .navigation').find('a').click(selectNav);
function selectNav() {
  $(this)
    .parents('ul:first')
      .find('li')
        .removeClass('selected') 
      .end()
    .end()
    .parents("li:first").addClass('selected');
}

function trigger(data) {
  var el = $('#slider .navigation').find('a[href$="' + data.id + '"]').get(0);
  selectNav.call(el);
}
if (window.location.hash) {
  trigger({ id : window.location.hash.substr(1)});
} else {
  $('#slider .navigation a:first').click();
}
$(document).ready(function () {
document.getElementById('slider_conteneur').style.visibility = 'hidden'

var $panels = $('div.panel');
var $container = $('div#scrollContainer');

var horizontal = true;
if (horizontal) {
  $panels.css({
    'float' : 'left',
    'position' : 'relative' // IE fix to ensure overflow is hidden
  });
  
  $container.css('width', $panels[0].offsetWidth * $panels.length);
}

var $scroll = $('div#scroll').css('overflow', 'hidden');



var offset = parseInt((horizontal ? 
  $container.css('paddingTop') : 
  $container.css('paddingLeft')) 
  || 0) * -1;


var scrollOptions = {
  target: $scroll, // the element that has the overflow
  
  // can be a selector which will be relative to the target
  items: $panels,
  
  navigation: '.navigation a',
  
  // selectors are NOT relative to document, i.e. make sure they're unique
  prev: 'img.left', 
  next: 'img.right',
  
  // allow the scroll effect to run both directions
  axis: 'xy',
  
  onAfter: trigger, // our final callback
  
  offset: offset,
  
  duration: 500,
  easing: 'swing'
};
$('#slider').serialScroll(scrollOptions);
$.localScroll(scrollOptions);

scrollOptions.duration = 1;
$.localScroll.hash(scrollOptions);

});