$(function(){
	
	initsocial();
	changerLienInscription();
	afficherEvent();
	
	$('#slider').cycle({
				fx:'fade',
				timeout:8000,
				speed:1000,
				delay: 1000,
				pager:  '#nav_slider',
				cleartypeNoBg : true
	});
	
	$("#menu-main").jquerymultinav();
	
	
	$(".groupe_img").each(function(e){
									
		var leId = this.id;
		var positionId = leId.indexOf("-");
		var monId = leId.substr(positionId+1);
		
		$("#gal-"+monId+" a").attr({ "rel": "group_img_"+monId});
		
	});
	
	
	$(".groupe_img a").hover(function(){
	
		$(this).stop().fadeTo('fast', 0.5);
				
	},function(){				
		$(this).stop().fadeTo('fast', 1);
				
	});
	
	
	$(".img_galery a").fancybox();	
	
	$("#lien-galerie").click(function(){
	$.scrollTo('#galerie-images', 500);
	});
	
	
	$("#lien-video").click(function(){
	$.scrollTo('#section-video', 500);
	});
	
	
	
	$(".lien_condition").click(function(){
	$.scrollTo('#condition', 500);
	});
	
	$("#hautdepage").click(function(){				
	$.scrollTo(0, 500);	
	});


});


function initsocial()
{
	
	$('#social_ul li').hover(function() {
									  
		$(this).children("img.img_tooltip").css({opacity: "1"});
		$(this).children("img.img_tooltip").stop().animate({opacity: "show", top: "-30"}, 250);
		var fadeOut = $(this).children("a").children(".noirblanc");
		fadeOut.stop().animate({opacity: "0"}, 250);
	  }, function () {
	  	$(this).children("img.img_tooltip").stop().animate({opacity: "hide", top: "-40"}, 250);
		var fadeIn 	= $(this).children("a").children(".noirblanc");
	  	fadeIn.stop().animate({opacity: "1"}, 250);
	  });
} 


function changerLienInscription()
{
	var monNouveauHref = $("#menu-zone3 li:first a").attr("href");
	//$("#papier-inscription a").attr("href",monNouveauHref);
}



function afficherEvent(){


	var zIndexNumber = 1000;
	$('div.event').each(function() {
		$(this).css('zIndex', zIndexNumber);
		zIndexNumber -= 10;
	});


	
	$("div.calnk").hover(function(){		
		$(this).next(".span_event").show();
				
	},function(){				
		$(this).next(".span_event").hide();
				
	});
	
}
