

var interTime = 4000;
var interTimeout = null;

$(document).ready(function(){
	// Opacité du background
	$("#intersticiel_biodiv .background").animate({opacity:.8},0);
	
	// Fermeture du popin
	$("#intersticiel_biodiv .content .popin .close").click(function(){
		$('#intersticiel_biodiv').fadeOut('normal', function(){
			$(this).remove();
		});
		return false;
	})
	
	// Ouverture des liens externes
	$('a._blank').click(function(){
		window.open($(this).attr('href'));
		return false;
	});
	
	// Roulement des images
	interTimeout = setTimeout('showOeil()', interTime);
	
	//Action sur les images
	$("#logo").click(function(){
		showOeil();
	});
	$("#portraits").click(function(){
		showLogo();
	});
	$("#oeil").click(function(){
		showPortraits();
	});
});

function showLogo(){
	clearTimeout(interTimeout);
	
	$("#portraits").fadeOut('normal', function(){
		$(this).hide();
		$("#logo").fadeIn('normal', function(){
			interTimeout = setTimeout('showOeil()', interTime);
		});
	});
}

function showPortraits(){
	clearTimeout(interTimeout);
	
	$("#oeil").fadeOut('normal', function(){
		$(this).hide();
		$("#portraits").fadeIn('normal', function(){
			interTimeout = setTimeout('showLogo()', interTime);
		});
	});
}

function showOeil(){
	clearTimeout(interTimeout);
	
	$("#logo").fadeOut('normal', function(){
		$(this).hide();
		$("#oeil").fadeIn('normal', function(){
			interTimeout = setTimeout('showPortraits()', interTime);
		});
	});
}