
$(document).ready(function() 
{
	
	Accordeon.init();
	$('#faq dt a').click(Accordeon.ouvrir)
	
	if($('body').attr('id') != 'cours')
	{
		$("a[rel^='prettyPhoto']").prettyPhoto();
	}	 
	
	$('#flowtabs li a').click(function()
	{
		var rel	= $('#autre a').attr('rel')
		$('#autre a').attr('href', rel + $(this).attr('href'))
		
		rel	= $('#autre_page a').attr('rel')
		$('#autre_page a').attr('href', rel + $(this).attr('href'))
		
		
	})
	
	
		
	
	$('#nouvelles #plus a').click(Nouvelles.afficher)
	Nouvelles.init()
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	

	$('#banniere').before('<div id="nav">').cycle({
		fx: 'fade',
		speed: 2000,
		timeout: 2000,
		pager:  '#nav' 
	});

	//accueil
	$('#accueil_contenu table a strong').hover(function()
	{
		$(this).parent().parent().find('img').addClass('hover')
	},
	
	function() 
	{
	    $(this).parent().parent().find('img').removeClass("hover");
	 }
	  
	)
	
	//accueil
	$('#accueil_contenu table a img').hover(function()
	{
		$(this).parent().parent().find('a').eq(1).addClass('hover')
	},
	
	function() 
	{
	    $(this).parent().parent().find('a').eq(1).removeClass("hover");
	 }
	  
	)
	
	
	

	//cours
	$('.studio h3 a').hover(function()
	{
		$(this).parent().parent().find('.img img').addClass('hover')
	},
	
	function () 
	{
	    $(this).parent().parent().find('.img img').removeClass("hover");
	 }
	  
	)
	
	$('.studio .img img').hover(function()
	{
		$(this).parent().parent().parent().find('h3 a').addClass('hover')
	},
	
	function () 
	{
	    $(this).parent().parent().parent().find('h3 a').removeClass("hover");
	 }
	  
	)
	
	
	//equipe
	$('#liste_equipe strong').hover(function()
		{
			$(this).parent().find('span').addClass('hover')
		},
		
		function () 
		{
		    $(this).parent().find('span').removeClass("hover");
		}
	)
	
	$('#liste_equipe img').hover(function()
		{
			$(this).parent().parent().parent().find('strong').addClass('hover')
		},
		
		function () 
		{
		   $(this).parent().parent().parent().find('strong').removeClass("hover");
		}
	)
	
	//media
	$('#medias #liste_des_medias .medias h3 a').hover(function()
		{
			$(this).parent().parent().find('.img img').addClass('hover')
		},
		
		function () 
		{
		    $(this).parent().parent().find('.img img').removeClass("hover");
		}
	)
	
	$('#medias #liste_des_medias .medias .img img').hover(function()
		{
			
			$(this).parent().parent().parent().find('h3 a').addClass('hover')
		},
		
		function () 
		{
		    $(this).parent().parent().parent().find('h3 a').removeClass("hover");
		}
	)
	
	//media photo
	$('#liste_des_photos li .img img').hover(function()
		{
			$(this).parent().parent().parent().find('h3 a').addClass('hover')
		},
		
		function () 
		{
		    $(this).parent().parent().parent().find('h3 a').removeClass("hover");
		}
	)
	
	$('#liste_des_photos li h3 a').hover(function()
		{
			$(this).parent().parent().find('.img img').addClass('hover')
		},
		
		function () 
		{
		    $(this).parent().parent().find('.img img').removeClass("hover");
		}
	)
	
	
	//liste des albums dans la page photo intérieur
	$('.interieur form#liste_des_albums select').change(function()
	{
		$('.interieur form#liste_des_albums').submit();
	});
	
});


var Nouvelles =
{
	afficher : function()
	{
		var a = $('#nouvelles #plus').html();
		var langue = $('#nouvelles #plus').attr('rel');
		$('#nouvelles #plus').html('<img src="/design/spinner.gif" alt="chargement" />')
		console.log('langue'+langue)
		var debut	= parseInt($('#limit').html()) + 4;
		
		$.ajax({
		  url: "/"+langue+"/ajax/afficher_les_nouvelles",
		  context: document.body,
		  data : 'debut='+debut,
		  success: function(data)
		  {
		  		if(data != '')
		  		{
			   		$('#nouvelles #liste_des_nouvelles').append(data);
			   		$('#nouvelles #liste_des_nouvelles').animate({ height: '+=800' }, 1000, function(){ });
			   		$('#nouvelles #plus').html(a);
			   		$('#nouvelles #plus a').click(Nouvelles.afficher)
			   		$('#limit').html(debut)
			   		Nouvelles.init()
		   		}
		   		else {
		   			$('#nouvelles #plus').html(' ');
		   		}
		  }
		});
		
		
		
		return false;
	}//afficher
	
	,init : function()
	{
		$('#nouvelles #liste_des_nouvelles li').unbind('click')
		
		$('#nouvelles #liste_des_nouvelles li').click(function()
		{
			$(this).find('.suite').trigger("click")	
		})
		$("a[rel^='prettyPhoto']").unbind('click');
		
		$("a[rel^='prettyPhoto']").prettyPhoto({
			allow_resize: true, /* Resize the photos bigger than viewport. true/false */
			default_width: 100,
			default_height: 144,
			social_tools: '<div class="pp_social s2"><div class="twitter"><a href="http://twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div></div>' /* html or false to disable */
				
			
			});

	}//init
	
	,interieur : function()
	{
		$('#interieur a').click(function(){
			console.log('a : ' + $(this).attr('href') )
		});
		
		var url = location.href;
		tab		= url.split('/')
		total	= tab.length -2;
		
		//  $('.pp_social .facebook').html('<iframe src="http://www.facebook.com/plugins/like.php?locale=en_US&amp;layout=button_count&amp;amp;show_faces=true&amp;amp;width=500&amp;amp;action=like&amp;amp;font&amp;amp;colorscheme=light&amp;amp;height=23&href='+$('#entete h1 a').attr('href')+'/?pretty='+tab[total]+'" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:500px; height:23px;" allowtransparency="true"></iframe>')
		  
		  
			//FB.init("177454355661833");

	}//init
	
	
}//Nouvelles

