
$(document).ready(function(){
   
   // Ajout de l'effet de fondu sur les liens
   $('a').each(function(){
		var original_color = $(this).css('color');
		
		$(this).mouseover(function(){
			$(this).animate({color: '#D39D1C'}, 500);
		});
		
		$(this).mouseout(function(){
			$(this).animate({color: original_color}, 500);
		});
   });
  
	// Ajout de selection des champs
	$(".text, .single, .area").each(function(){
		var original_color1 = $(this).css('border-top-color');
		var original_color2 = $(this).css('border-bottom-color');
		$(this).focus(function (){
			$(this).animate({borderTopColor: '#C23324', borderRightColor: '#C23324', borderBottomColor: '#C23324', borderLeftColor: '#C23324'}, 500);
		});
		
		$(this).blur(function (){
			$(this).animate({borderTopColor: original_color1, borderRightColor: original_color2, borderBottomColor: original_color2, borderLeftColor: original_color1}, 500);
		});
	});
	
	// Afficher/Cacher la section des commentaires
	$('#title_comments').click(function(){
		$('#comments').slideToggle("slow");
	});
	
	// Afficher/Cacher la section de saisie de commentaire
	$('#respond').click(function(){
		$('#leave_comment').slideToggle("slow");
	});
	
	//Cache la section de saisie de commentaire par défaut
	$('#leave_comment').css("display", "none");
	

	// Cache toutes les sections du CV sauf la section "general"
	$('.cv-section').css("display", "none");
	$('#general-section').css("display", "block");
	
	// Mets en surbrillance l'item "general"
	$('#general').addClass("hover");
	
	$('#cv-menu h2').css("display", "none");
	
	
	// Afficher la section séléctionnée du CV et cacher les autres 
	$('#general, #formation, #experience, #telecharger').each(function(){
		
		$(this).click(function (){

			$('#general, #formation, #experience, #telecharger').removeClass("hover");
			$(this).addClass("hover");

			var ID_EltClicked = this.id;
			$('.cv-section').each(function(){
				if ($(this).css("display") != "none")
				{
					$(this).fadeOut(800, function(){
						$('#' + ID_EltClicked + '-section').fadeIn(800);
					});
				}
			});
			
		});
	});
	
	$('.intituleLien a').faviconize({
		position: "before"
	});
	
	
 });

