$(document).ready(function() {
													 
	/* panel slide */
	$("#panel").css({'top':'98px'});
	$("#panel").hide();    
	$(".item-prenotazioni a").click(function () {
		if ($("#panel").is(":hidden")) { 

			$("#panel").show("slide", { direction: "up" }, 500);
		} else {
			$("#panel").hide("slide", { direction: "up" }, 500);
		}
	});
	$(".close").click(function () {
		if ($("#panel").is(":visible")) { 

      $("#panel").hide("slide", { direction: "up" }, 500);
		}
	});
	
													 
	$('body').css('text-rendering','optimizeLegibility');
	
	/* top menu */

	$("#menu-main-menu li").prepend("<span></span>");

	$("#menu-main-menu li").each(function() { 
		var linkText = $(this).find("a").html(); 
		$(this).find("span").show().html(linkText); 
	}); 
	$("#menu-main-menu li").hover(function() {	
		if((ind = navigator.appVersion.indexOf("MSIE")) > -1 && navigator.userAgent.indexOf("Opera") == -1) {																				 
			$(this).find("span").stop().animate({
					marginTop: "-20px",
					easing:'easeout'
			}, 150);
		}else{
			$(this).find("span").stop().animate({
					marginTop: "-50px",
					easing:'easeout'
			}, 400);			
		}
		
	} , function() { 
		$(this).find("span").stop().animate({
			marginTop: "0" 
		}, 200);
	});
	

	//Caption Sliding (Partially Hidden to Visible)
	$('.dett').hide();
	$('.boxgrid .cover').hover(function(){
		//Switch id
		switch ($(this).attr('id'))
		{
			case 'd1':
				$(this).stop().animate({top:'160px'},{queue:false,duration:160});
				break;
			default:
				 $(this).stop().animate({top:'0'},{queue:false,duration:260});
		}

		$(this).children('.dett').fadeIn('fast')
	}, function() {
		$(this).stop().animate({top:'246px'},{queue:false,duration:160});
		$(this).children('.dett').fadeOut('fast')
	});

		 $('.icon').animate({opacity: 0.50}, 350);
		 $('a.label1').animate({opacity: 0});
		 $('a.label2').animate({opacity: 0});
		 $('a.label3').animate({opacity: 0});
		 $('a.label4').animate({opacity: 0});

		 $('#loghi .img1').animate({opacity: 1}, 600);
		 $('#loghi .img2').animate({opacity: 1}, 1000);
		 $('#loghi .img3').animate({opacity: 1}, 1400);
		 $('#loghi .img4').animate({opacity: 1}, 1800);
		 $('#loghi .img5').animate({opacity: 1}, 2200);
		 $('#loghi .img6').animate({opacity: 1}, 2600);
		 $('#loghi .img7').animate({opacity: 1}, 3000);
		 $('#loghi .img8').animate({opacity: 1}, 3400);
		 $('#loghi .img9').animate({opacity: 1}, 3800);

		 $('.titleTop').css({'top':'-50px'});
		 $('a.label1').css({'top':'190px'});		 
		 $('a.label2').css({'top':'190px'});		 
		 $('a.label3').css({'top':'190px'});		 
		 $('a.label4').css({'top':'190px'});		 
		  $('.wrap').hover(function(){
				$(this).children('.icon').stop().animate({'top' : '130px',opacity: 1,easing:'easeout'},200);
				$(this).children('.titleTop').animate({'top' : '10px'},{ queue: false, duration: 350 });		
				$(this).children('a.label1').animate({'top' : '45px',opacity: 1},{ queue: false, duration: 300 });		
				$(this).children('a.label2').animate({'top' : '65px',opacity: 1},{ queue: false, duration: 350 });		
				$(this).children('a.label3').animate({'top' : '85px',opacity: 1},{ queue: false, duration: 400 });		
				$(this).children('a.label4').animate({'top' : '105px',opacity: 1},{ queue: false, duration: 450 });		
				 
				$(this).children('.title').stop().animate({'top' : '245px'}, 100);
				$(this).stop().animate({ backgroundColor: "#0b2f47" }, 350);
		 }, 
		 function(){
			 	//Switch id
				switch ($(this).attr('id'))
				{
					case 'btn1':
						$(this).stop().animate({ backgroundColor: "#8cc63f" }, 350);	
					break;
					case 'btn2':				
						$(this).stop().animate({ backgroundColor: "#29abe2" }, 350);				
					break;
					case 'btn3':				
						$(this).stop().animate({ backgroundColor: "#f7931e" }, 350);	
					break;
					case 'btn4':				
						$(this).stop().animate({ backgroundColor: "#998675" }, 350);	
					break;					
				}
				
				$(this).children('a.label1').stop().animate({'top' : '190px',opacity: 0},200);
				$(this).children('a.label2').stop().animate({'top' : '190px',opacity: 0},200);
				$(this).children('a.label3').stop().animate({'top' : '190px',opacity: 0},200);
				$(this).children('a.label4').stop().animate({'top' : '190px',opacity: 0},200);
			 	$('.icon').stop().animate({'top' : '50px', 'left' : '20px',opacity: 0.50}, 250);
			 	$('.title').stop().animate({'top' : '175px', 'left' : '10px'}, 200);
			 	$('.titleTop').stop().animate({'top' : '-50px', 'left' : '10px'}, 200);
		});


});

