$(document).ready(
	function() {
			// fading in the map
			$("#content-geo").fadeIn(4000);
			$(".nation").fadeIn(3000);
			
			$(".nation li").css("display","block");
			$(".nation img").css("display","none");
			$(".nation img").css("position","absolute");	
			$(".nation span").each(function(i) {
					//misuring the height e hiding the ul of the projects
					var larghezza = $(this).width();
					var altezza = $(this).height();
					$(this).toggleClass("measuring");
					$(".measuring ul").hide();
					$(this).height(altezza);
					$(".measuring ul li img").css("right",larghezza);
					$(this).toggleClass("measuring");
					//adding a class for hover effects
					$(".nation span").toggleClass("not-active");
			 	}
			);
			
			$(".nation h1").hover(function() {
					$("span ul").hide();
					//removing the non-active class and fading out the non-active elements
					$(this).parent().toggleClass("not-active");
					$(".nation span.not-active").animate({ 
								opacity: 0}, 
								{ queue:false, duration:400 }
							);
					$(".nation span.not-active").hide();
					//adding a class to identify the active nation
					$(this).parent().toggleClass("geo-active");
					$(this).parent().parent().css("z-index", "999");
					$(".geo-active ul").fadeIn("fast");
					//$(".geo-active ul").queue([]);
					$(".geo-active").css("border-left","solid .1em #FED90F");
			 	}, function(){
			 		$(".geo-active ul").fadeOut("fast");
					$(".geo-active").css("border-left","solid .1em #111");
					$(this).parent().parent().css("z-index", "");
					$(this).parent().toggleClass("geo-active");
					$(this).parent().toggleClass("not-active");
					$(".nation span.not-active").show();
					$(".nation span.not-active").animate({ 
								opacity: 1}, 
								{ queue:false, duration:400 }
							);
					$("span ul").hide();
			 	}
			);
			
			$(".nation h1 li a").hover(function() {
					//alert(larghezza);
					$(this).parent().toggleClass("project-active");
					$(".nation h1 li.project-active img").fadeIn("fast");
			 	}, function(){
			 		$(".nation h1 li.project-active img").fadeOut("fast");
					$(this).parent().toggleClass("project-active");
			 	}
			);		
	}
);










