// MENU TOP
$(document).ready(function() {
	
	// menù left
	if($(".menu-voce li").hover(
		function () {
			$(this).animate({backgroundColor: "#3a3a3a"});
	      },
		function () {
			$(this).animate({backgroundColor: "#003d5c"});
	      }
		)
	);
	
	// sottomenu
	if($("#sottomenu a").hover(
		function () {
			$(this).stop().animate({backgroundColor: "#003d5c", color: "#ffffff"}, 'fast');
		    },
		function () {
		    $(this).stop().animate({backgroundColor: "#ffffff", color: "#003d5c"}, 'fast');
		    }
		)
	);
	
	if($("#st_servizi a").hover(
			function () {
				$(this).stop().animate({backgroundColor: "#003d5c", color: "#ffffff"}, 'fast');
			    },
			function () {
				$(this).stop().animate({backgroundColor: "#ffffff", color: "#003d5c"}, 'fast');
				//$(this).removeAttr("style");
			    }
			)
		);
	
	if($("#st_manerba a").hover(
			function () {
				$(this).stop().animate({backgroundColor: "#003d5c", color: "#ffffff"}, 'fast');
			    },
			function () {
				$(this).stop().animate({backgroundColor: "#ffffff", color: "#003d5c"}, 'fast');
				//$(this).removeAttr("style");
			    }
			)
		);
	
	if($("#st_pietre a").hover(
			function () {
				$(this).stop().animate({backgroundColor: "#003d5c", color: "#ffffff"}, 'fast');
			    },
			function () {
				$(this).stop().animate({backgroundColor: "#ffffff", color: "#003d5c"}, 'fast');
				//$(this).removeAttr("style");
			    }
			)
		);
	
	// dropdown bottom
	
	$(".loc").hover(function() { //When trigger is on over...
		
		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).parent().find("ul.subnav").stop().slideDown('fast').show('slow', function(){
			$(this).height("auto");
		}); //Drop down the subnav on click


		$(this).parent().hover(function() {
		}, function(){	
			$(this).parent().find("ul.subnav").stop().slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
		});

		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() { 
			$(this).addClass("subhover"); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			$(this).removeClass("subhover"); //On hover out, remove class "subhover"
	});
	
	
	$("#chiudi").click(function() {
		$("#finestra").fadeOut('fast');
		$("#chiudi").animate({left: 853}).fadeOut('fast', function() {
		    // Animation complete.
			$("#open").fadeIn('slow');
		  });
	});
	
	$("#open").click(function() {
		$(this).fadeOut('slow', function() {
			$("#finestra").fadeIn('fast');
			$("#chiudi").fadeIn('fast').animate({left: 511});
		});
	});
	
});
