/******************************************************************************/
/*                             Javascript By Cco                              */
/******************************************************************************/

jQuery(document).ready(function() {
	jQuery('.galerie_alaune').jcarousel({
		wrap: 'circular',
		scroll: 1,
		initCallback: initCarousel,
		buttonNextHTML: null,
		buttonPrevHTML: null
	});


	//--//
	jQuery('#focus_alaune .alauneBloc').each(function(iTem){
		var blocALaUne = jQuery('#focus_alaune .alauneBloc:eq('+iTem+')');

		if(iTem!=0){
			blocALaUne.hide();
		}

	});

	jQuery('.galerie_alaune li').each(function(iTem){
		var linkItem = jQuery('.galerie_alaune li:eq('+iTem+') ');

		linkItem.attr("href","javascript:void(0);");
		linkItem.mouseover(function(){
			jQuery('.alauneBloc').each(function(eLem){
				jQuery('.alauneBloc:eq('+eLem+')').css('display','none');
				if(eLem==iTem){
					jQuery('.alauneBloc:eq('+eLem+')').css('display','block');
				}
			});
		});
	});

});




function initCarousel(carousel) {
	hoverCarousel();

	jQuery('#btn_next').bind('click', function() {
		carousel.next();
		hoverCarousel();
    return false;
	});

	jQuery('#btn_prev').bind('click', function() {
		carousel.prev();
		hoverCarousel();
		return false;
	});
};


function initSlideShow(carousel) {
	jQuery('.suite a').bind('click', function() {
		carousel.next();
    return false;
	});

	jQuery('.retour a').bind('click', function() {
		carousel.prev();
		return false; 
	});
};

function hoverCarousel(){
	jQuery('.galerie_alaune li').each(function(iTem){
		var liItem = jQuery('.galerie_alaune li:eq('+iTem+')');
		var thumbItem = liItem.children("div");

		liItem.hover(
			function(){
				thumbItem.show();
				if(thumbItem.length>0){
					if(thumbItem.css('display')=='none'){
						thumbItem.show();
					}
				}
			},
			function(){
				if(thumbItem.length>0){
					if(thumbItem.css('display')=='block'){
						thumbItem.hide();
					}
				}
			}
		);

		iTem++;
  });
}
