// JavaScript Document

$(window).load(function() {
    $('.logo_slideshow').cycle({
		fx:     'fade',
		timeout: 4000,
		delay: -2000,  // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		before: onBefore
	});
	
	//Affichage des actu par annee
	/*$('.liste-annee a').click(function() {
		$('.liste-annee a').removeClass("on");
		$(this).addClass("on");
	 }); 
	*/
	displayYear();
	
});
// hide all but the first image when page loads
$(document).ready(function() {
		
	/*Init logos reference*/
	$('.logo_slideshow').show(); 
    $('.logo_slideshow img:gt(0)').hide();
	
	// scroll to top
	$('a.retour-top').click(function(){
	$.scrollTo( 0, 500);
	return false;
	});
	
	/*Affichage des actu*/
    //$('.annee').hide();
	$('.annee').show();
    $('.annee.active').show();
	
	$('a.actu').click(function(){
	var myActu = $(this).attr("href");
	$('.annee').hide();
	$(myActu).show();
	$.scrollTo( 0, 500);
	return false;
	});
	
	
});
// callback fired when each slide transition begins
function onBefore(curr,next,opts) {
    var $slide = $(next);
    var w = $slide.outerWidth();
    var h = $slide.outerHeight();
    $slide.css({
        marginTop: (110 - h) / 2,
        marginLeft: (170 - w) / 2
    });
};

function displayYear() {
	var theDate=new Date()
	$('#year').html(theDate.getFullYear());
}
