$(document).ready(function (){


	/* ################################
				FOCUS ACTU
	################################# */
	
	//Par dŽfaut, affichage du premier bloc
	$('#focus #zoneFocus #bloc1,#bloc2,#bloc3,#bloc4,#bloc5').hide();
	$('#focus #zoneFocus #bloc1').show();
	
	$('#focus #indexation li').click(function(){
		var sectionUne = $(this).attr('id');
		$('#focus #indexation li').removeClass('actifIndex');
		$(this).addClass('actifIndex');
		$('#focus #bloc1,#bloc2,#bloc3,#bloc4,#bloc5').fadeOut();
		$('#zoneFocus #bloc'+sectionUne).delay(500).fadeIn();
		
	});
	
		/* ################################
				FOCUS ACTU INTERNE
	################################# */
	
	//Par dŽfaut, affichage du premier bloc
	$('#encart_entete #Zone #bloc1,#bloc2,#bloc3').hide();
	$('#encart_entete #Zone #bloc1').show();
	
	$('#encart_entete #indexation li').click(function(){
		var sectionUne = $(this).attr('id');
		$('#encart_entete #indexation li').removeClass('actifIndex');
		$(this).addClass('actifIndex');
		$('#encart_entete #bloc1,#bloc2,#bloc3').fadeOut();
		$('#Zone #bloc'+sectionUne).delay(500).fadeIn();
		
	});
	
		/* ################################
				EFFET IMAGES HOME
	################################# */
	
			$(window).load(function(){
			
			//set and get some variables
			var thumbnail = {
				imgIncrease : 100, /* the image increase in pixels (for zoom) */
				effectDuration : 400, /* the duration of the effect (zoom and caption) */
				/* 
				get the width and height of the images. Going to use those
				for 2 things:
					make the list items same size
					get the images back to normal after the zoom 
				*/
				imgWidth : $('.thumbnailWrapper ul li').find('img').width(), 
				imgHeight : $('.thumbnailWrapper ul li').find('img').height() 
				
			};
			
			//make the list items same size as the images
			$('.thumbnailWrapper ul li').css({ 
				
				'width' : thumbnail.imgWidth, 
				'height' : thumbnail.imgHeight 
				
			});
			
			//when mouse over the list item...
			$('.thumbnailWrapper ul li').hover(function(){
				
				$(this).find('img').stop().animate({
					
					/* increase the image width for the zoom effect*/
					width: parseInt(thumbnail.imgWidth) + thumbnail.imgIncrease,
					/* we need to change the left and top position in order to 
					have the zoom effect, so we are moving them to a negative
					position of the half of the imgIncrease */
					left: thumbnail.imgIncrease/2*(-1),
					top: thumbnail.imgIncrease/2*(-1)
					
				},{ 
					
					"duration": thumbnail.effectDuration,
					"queue": false
					
				});
				
				//show the caption using slideDown event
				$(this).find('.caption:not(:animated)').slideDown(thumbnail.effectDuration);
				
			//when mouse leave...
			}, function(){
				
				//find the image and animate it...
				$(this).find('img').animate({
					
					/* get it back to original size (zoom out) */
					width: thumbnail.imgWidth,
					/* get left and top positions back to normal */
					left: 0,
					top: 0
					
				}, thumbnail.effectDuration);
				
				//hide the caption using slideUp event
				$(this).find('.caption').slideUp(thumbnail.effectDuration);
				
			});
			
		});


	/* ################################
					AGENDA HOME
	################################# */
	
	//Par défaut, la section dossier est visible
	$('#salons').hide();
	$('#manifs').hide();
	$('#bureau').hide();
	$('#assemblees').hide();
	
	$('#nav_agenda li').click(function (){
		$('#nav_agenda li').removeClass('actif');
		$(this).addClass('actif');
		var section = $(this).attr('id');
		
		$('#evenements').fadeOut();
		$('#salons').fadeOut();
		$('#manifs').fadeOut();
		$('#bureau').fadeOut();
		$('#assemblees').fadeOut();
		
		switch(section){
			case('btnEvenements'):$('#evenements').delay(500).fadeIn();break;
			case('btnSalons'):$('#salons').delay(500).fadeIn();break;
			case('btnManifs'):$('#manifs').delay(500).fadeIn();break;
			case('btnBureau'):$('#bureau').delay(500).fadeIn();break;
			case('btnAssemblees'):$('#assemblees').delay(500).fadeIn();break;
		}
	});//fin fonction click #nav_agenda li
	
		/* ################################
					AGENDA PAGE INTERNE
	################################# */
	
	//Par défaut, la section dossier est visible
	$('#EvenementsMof').hide();
	$('#EvenementsMaf').hide();
	
	$('#nav_agenda_interne li').click(function (){
		$('#nav_agenda_interne li').removeClass('actif');
		$(this).addClass('actif');
		var section = $(this).attr('id');
		
		$('#SelectionEvenements').fadeOut();
		$('#EvenementsMof').fadeOut();
		$('#EvenementsMaf').fadeOut();
		
		switch(section){
			case('btnSelectionEvenements'):$('#SelectionEvenements').delay(500).fadeIn();break;
			case('btnEvenementsMof'):$('#EvenementsMof').delay(500).fadeIn();break;
			case('btnEvenementsMaf'):$('#EvenementsMaf').delay(500).fadeIn();break;
		}
	});//fin fonction click #nav_agenda_interne li
	
			/* ################################
				FOCUS AGENDA INTERNE
	################################# */
	
	//Par dŽfaut, affichage du premier bloc
	$('#SelectionEvenements #bloc1,#bloc2,#bloc3').hide();
	$('#SelectionEvenements #bloc1').show();
	
	$('#SelectionEvenements #indexation li').click(function(){
		var sectionUne = $(this).attr('id');
		$('#SelectionEvenements #indexation li').removeClass('actifIndex');
		$(this).addClass('actifIndex');
		$('#SelectionEvenements #bloc1,#bloc2,#bloc3').fadeOut();
		$('#bloc'+sectionUne).delay(500).fadeIn();
		
	});
	
	$('#EvenementsMof #bloc_mof1,#bloc_mof2,#bloc_mof3').hide();
	$('#EvenementsMof #bloc_mof1').show();
	
	$('#EvenementsMof #indexation li').click(function(){
		var sectionUne = $(this).attr('id');
		$('#EvenementsMof #indexation li').removeClass('actifIndex');
		$(this).addClass('actifIndex');
		$('#EvenementsMof #bloc_mof1,#bloc_mof2,#bloc_mof3').fadeOut();
		$('#bloc_mof'+sectionUne).delay(500).fadeIn();
		
	});
	
		$('#EvenementsMaf #bloc_maf1,#bloc_maf2,#bloc_maf3').hide();
	$('#EvenementsMaf #bloc_maf1').show();
	
	$('#EvenementsMaf #indexation li').click(function(){
		var sectionUne = $(this).attr('id');
		$('#EvenementsMaf #indexation li').removeClass('actifIndex');
		$(this).addClass('actifIndex');
		$('#EvenementsMaf #bloc_maf1,#bloc_maf2,#bloc_maf3').fadeOut();
		$('#bloc_maf'+sectionUne).delay(500).fadeIn();
		
	});
	
			
});// fin fichier
