/***********************************************HAUT DE PAGE***********************************************/
jQuery.fn.topLink = function(settings) {
	settings = jQuery.extend({
			min: 1,
			fadeSpeed: 200,
			ieOffset: 50
	}, settings);
	return this.each(function() {
	//listen for scroll
	var el = $(this);
	el.css('display','none'); //in case the user forgot
	$(window).scroll(function() {
		if(!jQuery.support.hrefNormalized) {
			el.css({
				'position': 'absolute',
				'top': $(window).scrollTop() + $(window).height() - settings.ieOffset
				});
		}
		if($(window).scrollTop() >= settings.min)
		{
				el.fadeIn(settings.fadeSpeed);
		}
		else
		{
				el.fadeOut(settings.fadeSpeed);
		}
		});
	});
};
	
$(document).ready(function() {
	$('#top-link').topLink({
		min: 100,
		fadeSpeed: 500
	});
	//smoothscroll
	$('#top-link').click(function(e) {
		e.preventDefault();
		$.scrollTo(0,300);
	});
});	 

// redefine Cycle's updateActivePagerLink function 
$.fn.cycle.updateActivePagerLink = function(pager, currSlideIndex) {
	$(pager).find('img').removeClass('active') 
	.filter('img:eq('+currSlideIndex+')').addClass('active'); 
};
	
$('#slideshow') 	
	.cycle({ 
	fx:     'fade', 
	speed:   400, 
	timeout: 4000, 
	pager:  '#nav' ,
	pagerAnchorBuilder: function(idx, slide)
	{ 
		return '<a href="javascript:void(0);"><img src="' + slide.src + '" alt="" height="60" /></a>'; 
	} 
});

