var mouseInside = false;
var explorerVisible = false;


$(document).ready(function() {


	//Mouse over sur les thumb, affiche / masque les descriptions
	$("#btn-explorer a").click(
		function(e) {
			e.preventDefault();
			if(explorerVisible){
				explorerVisible = false;
				$(this).children("img:first").attr("src", "images/btn_arrow_down.png");
				$("#header-explorer-bloc").slideUp("slow", function(){$("#header-explorer-container").slideUp("slow");});	
			}
			else{
				explorerVisible = true;
				$(this).children("img:first").attr("src", "images/btn_arrow_up.png");
				$("#header-explorer-container").slideDown("slow", function(){$("#header-explorer-bloc").slideDown("slow");});
			}
		}
	);

	//Mouse over sur les thumb, affiche / masque les descriptions
	$("#header-user-box").hover(
		function() {
			mouseInside = true;
			$("#login-widget").slideDown('fast');	
		},
		function() {
			mouseInside = false;	
		}
	);

	$("html").click(function(e) {
		//alert($("#header-login-widget").has(e.target));
		//if(!$(e.target).parents().first("#login-widget:visible"))
		if(!mouseInside)
		{
			$("#login-widget:visible").hide();
		}
			//$("#login-widget:visible").hide();
	});

	/*$("#login-widget:visible").click(function(event){
	     event.stopPropagation();
	 });*/

	$("#header-lang-container").hover(
		function() {
			$("#header-lang-list").slideDown('fast');	
		},
		function() {
			$("#header-lang-list").hide();	
		}
	);
		

});
