$(window).load(function() {
	
	var angle = 0;
			var sens = 1;
			setInterval(function(){
				
				 if(angle > 20){ sens = 0; }
				 if(angle < -20){ sens = 1; }
				 
				
				if(sens == 1){
					angle+=0.2;
				}
				else{
					angle-=0.2;
				}
				
				  
				 $("#laser_2").rotate(angle);
				 $("#laser_1").rotate(-angle);
				 
				 
			},50);
	
	$('#slides').slides({
				preload: true,
				preloadImage: 'img/loading.gif',
				play: 5000,
				pause: 2500,
				hoverPause: true,
				effect:'slide',
				fadeSpeed:200,
				animationStart: function(current){
					$('.caption').animate({
						bottom:-35
					},100);
					if (window.console && console.log) {
						// example return of current slide number
						console.log('animationStart on slide: ', current);
					};
				},
				animationComplete: function(current){
					$('.caption').animate({
						bottom:0
					},200);
					if (window.console && console.log) {
						// example return of current slide number
						console.log('animationComplete on slide: ', current);
					};
				},
				slidesLoaded: function() {
					$('.caption').animate({
						bottom:0
					},200);
				}
			});
	
	
	
	$('#bandeMenu a.bouton_menu').css({backgroundPosition: "0px -74px"})
	.mouseover(function(){
		$(this).stop().animate(
			{backgroundPosition:"0px -37px"}, 
			{duration:250})
		})
	.mouseout(function(){
		$(this).stop().animate(
			{backgroundPosition:"0px -74px"}, 
			{duration:250})
		})
	
	
	$('.visuels a').mouseover(function() {
		var urlToShow = $(this).children("img").attr("src");
		var parent = $(this).parent();
		$(parent).children(".minia").children("img").attr("src",urlToShow)
	});
	
	$('.visuels a').mouseout(function() {
		var parent = $(this).parent();
		var urlToShow = $(parent).children(".minia").children("img").attr("alt")
		$(parent).children(".minia").children("img").attr("src",urlToShow)
	});
	
	
	$('.realisateur').mouseenter(function() {

		$(this).stop().animate(
			{backgroundColor:"#222222"}, 
			{duration:0});
	}).mouseleave(function() {

		$(this).stop().animate(
			{backgroundColor:"#101010"}, 
			{duration:250});
	});
	
	
	$('.pave_lien').mouseenter(function() {

		$(this).children("img").hide();
		$(this).children(".description").fadeIn(400);
	}).mouseleave(function() {

		$(this).children("img").fadeIn(400);
		$(this).children(".description").hide();
	});
	
	
});
	

$(document).scroll(function() {
          
			if($(document).scrollTop() >= 50)
			{
				$("nav").addClass("menuFixe")
			}
			else{
				$("nav").removeClass("menuFixe");}
});



