/*var index_photo=1;
var divY=0;

$(document).ready(function() {
$(".bouton_offre_suivante").click(
      function () {
		  montrerPhotoSuivante();
		  $(document).stopTime("offres");
		  return false;
      }
    );
$(".bouton_offre_precedente").click(
      function () {
		  montrerPhotoPrecedente();
		  $(document).stopTime("offres");
		  return false;
      }
    );
divY=$(".offres .offre_visible img").height();
$(document).everyTime(5000,"offres",function(i) {montrerPhotoSuivante();});
});

function montrerPhotoSuivante(){
index_photo=index_photo+1;
var dernier=$(".offres li").index($('.offres li:last'));
if (index_photo>dernier) {
index_photo=1;
}
$(".pagination_centre a.on").removeClass('on');
$(".pagination_centre a").eq(index_photo-1).addClass('on');
$(".offres .offre_visible").height($(".offres .offre_visible img").height());
$(".offres .offre_visible img").fadeOut("fast",function (){
});
var image=$(".offres li").eq(index_photo).find("a").attr("href");
var titre=$(".offres li").eq(index_photo).find("a").attr("title");
$('.offres .offre_visible').html('<img src="'+image+'" alt="'+titre+'" style="display:none;"/>');
$(".offres .offre_visible img").bind('load',function(){photoIsLoaded(this);});
}

function montrerPhotoPrecedente(){
index_photo=index_photo-1;
var premier=$(".offres li").index($('.offres li:first'));
if (index_photo<=premier) {
index_photo=$(".offres li").index($('.offres li:last'));
}
$(".pagination_centre a.on").removeClass('on');
$(".pagination_centre a").eq(index_photo-1).addClass('on');
$(".offres .offre_visible").height($(".offres .offre_visible img").height());
$(".photo_rubrique .photo_visible img").fadeOut("fast",function (){
});
var image=$(".offres li").eq(index_photo).find("a").attr("href");
var titre=$(".offres li").eq(index_photo).find("a").attr("title");
$('.offres .offre_visible').html('<img src="'+image+'" alt="'+titre+'" style="display:none;"/>');
$(".offres .offre_visible img").bind('load',function(){photoIsLoaded(this);});
}

function montrerPhotoIndex(index_photo){
$(document).stopTime("offres");
$(".pagination_centre a.on").removeClass('on');
$(".pagination_centre a").eq(index_photo-1).addClass('on');
$(".offres .offre_visible").height($(".offres .offre_visible img").height());
$(".photo_rubrique .photo_visible img").fadeOut("fast",function (){
});
var image=$(".offres li").eq(index_photo).find("a").attr("href");
var titre=$(".offres li").eq(index_photo).find("a").attr("title");
$('.offres .offre_visible').html('<img src="'+image+'" alt="'+titre+'" style="display:none;"/>');
$(".offres .offre_visible img").bind('load',function(){photoIsLoaded(this);});
}

function photoIsLoaded(photo){
var photoY=$(photo).height();
if ((photoY!=divY)&&(photoY!=0))
{
	divY=photoY; $('.offres .offre_visible').animate({height: divY+"px"},"normal","",function(){$(photo).fadeIn("normal");});
}
else
{
	$(photo).fadeIn("normal");
}
}
*/
function mycarousel_initCallback(carousel) {
	jQuery('.pagination_centre a').bind('click', function() {
		$(".pagination_centre a.on").removeClass('on');
		jQuery(this).addClass('on');
		carousel.stopAuto();
        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
        return false;
    });

    jQuery('.pagination_droite a').bind('click', function() {
		carousel.stopAuto();
        carousel.next();
		return false;
    });

    jQuery('.pagination_gauche a').bind('click', function() {
        carousel.stopAuto();
		carousel.prev();
        return false;
    });
	
	carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });

};

function mycarousel_itemVisibleInCallbackBeforeAnimation(carousel, item, idx, state){}

function mycarousel_itemVisibleInCallbackAfterAnimation(carousel, item, idx, state){
	$(".pagination_centre a.on").removeClass('on');
	$(".pagination_centre a").eq(idx-1).addClass('on');
}

$(document).ready(function() {
jQuery('ul.offres').jcarousel({
							  auto: 5,
							  wrap: 'last',
							  visible:1,
							  scroll:1,
							  buttonNextHTML: null,
							  buttonPrevHTML: null,
							  initCallback: mycarousel_initCallback,
							  itemVisibleInCallback: {
								onBeforeAnimation: mycarousel_itemVisibleInCallbackBeforeAnimation,
								onAfterAnimation:  mycarousel_itemVisibleInCallbackAfterAnimation
								}
							});
});