// JavaScript Document
$(document).ready(function(){
	fctBlank();

	$("#menu a").click(function(){fCliqueInt(this);return false;});
	
	function fCliqueInt(element){
		$("#page").animate({opacity: 0}, 1500,  "expoEaseInOut", function(){window.location=element.href;});
	}
	
	
	replaceEmail();
	
	$("#chargement").css("opacity",0);
	$("#fondTexteNoir").css("opacity",0);
	$("#fondTexteNoir").css("left","-100px");
	$("#texte").css("display","block")
	.css("opacity",0)
				
				.css("left","-100px");
	$("iframe").css("opacity",0);
	$("#page").css("display","block");
	fArriveTexte();
	
	$("iframe:eq(0)").mouseover(function(){
		$("#page").css("z-index", 20);
		$("#logo").css("z-index", 10);
	});
	$("iframe:eq(0)").mouseout(function(){
		$("#page").css("z-index", 10);
		$("#logo").css("z-index", 20);
	});
	
});

function fArriveTexte(){
	$("#fondTexteNoir").animate({opacity: .7, left: 0}, 3000, "expoEaseInOut");
	$("#texte").animate({opacity: 1, left: 0}, 3000, "expoEaseInOut", function(){ChargementIframe()});
}



function ChargementIframe(){
	$("#chargement").animate({opacity: 1}, 3000, "expoEaseInOut", function(){affichageIframe();});
}
function affichageIframe(){
	$("iframe:eq(0)").animate({opacity: 1}, 3000, "expoEaseInOut");
}

function replaceEmail(){
	$(".email").each(function(i){
	  var monTexte = $(".email:eq("+i+")").text();
	  var monEmail = monTexte.replace("[at]", "@");
	  $(".email:eq("+i+")").text(monEmail);
	  
	  $(".email:eq("+i+")").click(function(){
			window.location.href="mailto: "+monEmail;
		});
	});
}
