$(document).ready(function(){
						  
	var vociMenu = $("li[id^=vocemenu]");
	
	vociMenu.each(function(){
		var idVoce = $(this).attr("id").substr(8);
		$(this).hover(function(){
			//alert("sono sopra la voce" + vociMenu.index(this));
			//$(this).css("border" , "1px solid #fff");
			
			//alert(idVoce);
			$(".pannello"+idVoce).slideDown(200);
			//alert("box");
			},
			function(){
			setTimeout(function(){$(".pannello"+idVoce).slideUp(200)}, 200);
			});
	});
	
	$(function() {
	$(".scrollable").scrollable({circular:true}).autoscroll(5000);
	});
	
	var labels = $("fieldset label");
		labels.each(function(){
				if($(this).next().val()){
					$(this).hide();
				};
				$(this).next().focus(function(){
						$(this).prev().hide();
				});
				$(this).next().blur(function(){
					if(this.value == ''){
						$(this).prev().show();
					};
				});
	});
	
	$("#highlights ul li").hover(function(){
				if($(this).find("a").attr("href")){
				$(this).css({"cursor" : "pointer" , "color" : "#66b1cb"});
				$(this).find("a").css({"cursor" : "pointer" , "color" : "#66b1cb"});
				var titolo = $(this).find("a").attr("title");
				//alert(titolo);
				$(this).attr("title" , titolo);
				}
			},
			function(){
				$(this).css("color" , "#000");
				$(this).find("a").css("color" , "#000");
			});
	
	$("#highlights ul li").click(function(){
		if($(this).find("a").attr("href")){
			//alert("link presente");
			var collegamento = $(this).find("a").attr("href");
			//alert(typeof collegamento);
				//		alert(collegamento.toString());
			//window.open(collegamento);
			document.location.href=collegamento;
	  //window.open=$(this).find("a").attr("href"); 
	  		return false;
		};
	});
	
	var Elenchi = $(".elenco-multimedia li:nth-child(3)");
	//alert(Elenchi.length);
	$(".elenco-multimedia li:nth-child(2n+1)").css("margin-right" , "21px");

	$("#newsletter .nwl-message").hide();
	$("fieldset form").submit(function(){
		$("#newsletter .nwl-message").fadeIn("fast");
	});
})
