function offre_init(carousel) {
    jQuery('#offre-navi a').bind('click', function() {
    	carousel.startAuto(0);
        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
        return false;
    });
    jQuery('#offre, #navi').hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    })
};

function offre_hide() {
	jQuery('#offre-navi a').removeClass('current');
}
function offre_show(carousel, item, i) {
	jQuery('#offre-navi a').eq(i-1).addClass('current');
}

jQuery(document).ready(function() {
    jQuery("#offre").jcarousel({
        scroll: 1,
        initCallback: offre_init,
        itemVisibleInCallback: {
 			onBeforeAnimation: offre_hide,
 			onAfterAnimation: offre_show
		},
		auto: 3,
		wrap: 'last',
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
    $("#demo a").fancybox({
		'width'				: '80%',
		'height'			: '80%',
        'autoScale'     	: false,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});
});
