$(document).ready(function(){
	
	
	
	var opacity = 0.8, toOpacity = 0.1, duration = 250;
	$('#bloc_edito').css('opacity',opacity);
	$('#bloc_edito').mouseenter(function() {$(this).stop();});
	$('#diaporama').mouseenter(function() {
		$('#bloc_edito').fadeTo(duration,toOpacity);
	}).mouseleave(function() {
		$('#bloc_edito').fadeTo(duration,opacity);
    });
	

	
	$("#sousnav").hide();
	$("#projets").hover(function(){
		$("#sousnav").slideDown("fast");
		$(this).children("a").css({'color' : '#b9c78c'});
	},
		function(){
			$(this).children("a").css({'color' : '#333'});
			$("#sousnav").slideUp("fast");
			$("#sousnav").stop(true, true);
			
		}
	);
	$("#nav a:not('#projets a, #sounav a')").hover(function(){
		$("#projets").children("a").css({'color' : '#333'});
		$("#sousnav").slideUp("fast");
		$("#sousnav").stop(true, true);
	});
	
	
	$('#slides').cycle({ 
		fx:     'scrollHorz', 
		timeout: 5000, 
		speed:  500 
	});
	
	function onAfter(curr, next, opts) {
		var index = opts.currSlide;
		$('#prevSlide')[index == 0 ? 'hide' : 'show']();
		$('#nextSlide')[index == opts.slideCount - 1 ? 'hide' : 'show']();
	}

	
	$('#slides2').cycle({ 
		fx:     'scrollHorz', 
		timeout: 0, 
		speed: 500,
		nowrap: 1,
		next: '#nextSlide',
		prev: '#prevSlide',
		after: onAfter
	});
	
	
	$('.toggleContent2').hide();
	$('.toggleContent').click(function(){
		$('#container').animate({top : 100});
		$(this).hide();
		$('.toggleContent2').show();
		
	});
	
	$('.toggleContent2').click(function(){
		$('#container').animate({top : -3});
		$(this).hide();
		$('.toggleContent').show();
	});
	
	$('#slideControl a').hover(function(){
		$('#info').fadeOut(500);
	});
	
	

	//$('#newssuiv').click(function(){
		//$('#news_slides').animate({left:-370}, 1000);
	//});
		
	$('input[type="text"], textarea').focus(function() {  
		$(this).css({'border-color' : '#BBD856'});  
		$(this).css({'background-color' : '#F4F9E3'});  
	}).blur(function() {  
		$(this).css({'border-color' : '#ccc'});  
		$(this).css({'background' : '#fff'});  
	}); 
	
	$('input[type="button"]').hover(function() {  
		$(this).css({'border-color' : '#BBD856'});  
		$(this).css({'background-color' : '#F4F9E3'});  
	}).mouseout(function(){  
		$(this).css({'border-color' : '#ccc'});  
		$(this).css({'background' : '#fff'});  
	});  
		
	$('#closeInfos').click(function(){
		$('.vipInfos').hide("slow");
	});
	

	
});

