$(document).ready(function () {
	
	/****** VARIABLES UTILISATEUR *********/
	animeSpeed = 500;
	cvSectionExp_isOpen = false;
	defaultPage = "#home";
	
	/****** VARIABLES DEVELOPPEUR *********/
	var urlPage = "";
	urlPage = location.href;
	urlPage = urlPage.substring(33,urlPage.length);
	
	
	if(urlPage=="") {
	 urlPage = defaultPage ;	
	}
	$(".wrapper-part").css("display","none");
	$(urlPage).css("display","block");
	currentWrap = urlPage;
	
	$(".cv-section-exp").each(function(i) {
		if(i>1) {
			$(this).css("display","none");	
		}
	});
	
	$("#moreExp").click(function() {
		if(cvSectionExp_isOpen == false) {
			$(".cv-section-exp").each(function(i) {
				if(i>1) {
					$(this).stop(true,true).slideDown(animeSpeed*i/2);	
				}
			});
			cvSectionExp_isOpen = true;
			$("#moreExp").text("masquer");
		}
		else {
			$(".cv-section-exp").each(function(i) {
				if(i>1) {
					$(this).stop(true,true).slideUp(animeSpeed*i/2);	
				}
			});
			cvSectionExp_isOpen = false;
			$("#moreExp").text("... et les stages");
		}
	});
	
	$("a[href^=#]").live("click",function() {
		cible = $(this).attr('href');
		$(currentWrap).fadeOut(animeSpeed);
		$(cible).fadeIn(animeSpeed);
		currentWrap = cible;
	});
	
	$(".thirdBlock").each(function(i) {
		var heightMax = 0;
		$(this).children(".blockLeft").each(function(j) {
			if($(this).height() > heightMax) {
				heightMax = $(this).height();	
			}
		});
		$(this).css("height",heightMax + "px");
	});

});
