/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 */
jQuery.extend(jQuery.easing,{
  easeInOutCubic: function (x, t, b, c, d) {
    if ((t/=d/2) < 1) return c/2*t*t*t + b;
    return c/2*((t-=2)*t*t + 2) + b;
  }
});

$(function (){
  $("#carousel").jcarousel({
    auto: 5,
    animation: 500,
    easing: "easeInOutCubic",
    wrap: 'last',
    scroll: 1,
    visible: 1,
    buttonNextHTML: null,
    buttonPrevHTML: null,
    pager: false,
    
    initCallback: function (carousel, state){
      // stop autoscrolling on hovering over the container
      carousel.container.addClass("clearfix").hover(function (){
        carousel.stopAuto();
      }, function (){
        carousel.startAuto();
      });
    },
    
    createPagerItemCallback: function (carousel, i){
      var img = $(carousel.list).children("li:eq(" + (i - 1) + ")").find("img");
      return $("<img>").attr("src", img.attr("src"));
    }
  });
});
