$(function() {
  $('.intro').parallax("60%", -0.2);
  $('.bistro').parallax("0%", 0.2);
  $('.bistro > div').parallax("2%", 1.2);
  $('a[href^="#"]').on('click',
    function() { $.scrollTo($(this).attr('href'), 1000); }
  );
  if ($('.ecrans').length > 0) {
    var $window = $(window);
    var offset = parseInt(Math.random()*2000);
    var $ecrans = $('.ecrans');
    var pos = $window.scrollTop();
    $ecrans.css('background-position', (offset + pos/2) + 'px 0px');
    $window.bind('scroll', function() {
      var pos = $window.scrollTop();
      $ecrans.css('background-position', (offset + pos/2) + 'px 0px');
    });
  }
});
