var imganimDuration = 1000; // millisecond

img_carousel = new Array();
function imgcarousel_initCallback(carousel, state) {
  img_carousel.push(carousel);
  if (state == 'init') {
    jQuery('.image-carousel-controls a').bind('click', function() {
      this_img_carousel = img_carousel[$('div.image-carousel').index($(this).parents('.image-carousel'))]; 
      if (!this_img_carousel.animating && !$(this).hasClass('selected')) {
        this_img_carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
        $(this).parent().children('.selected').removeClass('selected');
        $(this).addClass('selected');
      }
      return false;
    });
  }
};
jQuery("div.image-carousel").each(function(i) {
  $(this).jcarousel({
    scroll: 1,
    initCallback: imgcarousel_initCallback,
    buttonNextHTML: null,
    buttonPrevHTML: null,
    easing: 'easeInOutExpo',
    animation: imganimDuration
  });
});
