$(document).ready(function() {
	// slideshow homepage
	$('.section-image').cycle({ 
		fx:      'fade',
		timeout:  4000,
		speed:    1000,
		pager:      '.section-liens',
		activePagerClass: 'over',
		pagerEvent: 'mouseover',
	    pauseOnPagerHover: true,
		fastOnEvent: true ,
		
		pagerAnchorBuilder: function(idx, slide) {
			var sfile = $(slide).attr('alt');
			var sname = $(slide).attr('title');
			var slist = $('.list-'+sfile).html();
			return '<div class="section" id="'+sfile+'"><a href="/realisations/'+sfile+'"><img src="img/sct-'+sfile+'-small.jpg" alt="'+sname+'" /></a><h2>'+sname+'</h2><div>'+slist+'</div></div>';
		}
	});
		
	$('.section:first').addClass('first');
	
	$('.section').click(function(){
		window.location=$(this).find('a').attr('href');
	});

	$('.jCarouselLite').html('<ul id="slidenav"></ul>');

	// slideshow
	$('.slideshow').cycle({ 
		fx:      'curtainX',
		sync:    0, 
		timeout:  5000,
		speed:    500,
		pager:      '#slidenav', 
		pagerEvent: 'mouseover',
	    pauseOnPagerHover: true,
		fastOnEvent: true ,
		
		pagerAnchorBuilder: function(idx, slide) {
			var sfile = $(slide).attr('alt');
			var sname = $(slide).attr('title');
			return '<li><a href="#"><img src="/img/slideshow/tb_'+sfile+(idx+1)+'.jpg" width="50" height="50" alt="'+sname+'" /></a></li>';
		}
	}); 

	$('.jCarouselLite').jCarouselLite({
		btnNext: ".next",
		btnPrev: ".prev",
		scroll: 2,
		visible: 6,
		circular: false
	});
});
