<!--
	// jQuery
	$(document).ajaxStop($.unblockUI);
	
	$(document).ready(function(){
		$(".a_menu").mouseover(function(){
			$(this).parent().stop(true, false).animate({ backgroundPosition: "(0 -202px)" }, 500, "backin");
			$(this).height(202).css("top", "-162px");
		});
		
		$(".a_menu").mouseout(function(){
			$(this).parent().stop(true, false).animate({ backgroundPosition: "(0 -50px)" }, 500, "backout");
			$(this).height(50).css("top", "-10px");
		});
		
		$(".a_tabs").mouseover(function(){
			$(this).parent().stop(true, false).animate({ backgroundPosition: "(0 0)" }, 500, "backin");
			$(this).width(150).css("left", "40px");
		}).click(function(){
			var url_rel = $(this).attr("rel");
			
			$.blockUI.defaults.applyPlatformOpacityRules = false;
			
			$.blockUI({
				message: $("#loader")
			});
			
			$.ajax({
				url: url_rel,
				cache: false,
				success: function(){
					$("#i_carta").attr("src", url_rel);
				}
			});
		});
		
		$(".a_tabs").mouseout(function(){
			$(this).parent().stop(true, false).animate({ backgroundPosition: "(-110px 0)" }, 500, "backout");
			$(this).width(40).css("left", "40px");
		});
		
		$(".a_links").mouseover(function(){
			$(this).parent().stop(true, false).animate({ opacity: 1.00, backgroundPosition: "(0 0)" }, 500, "backin");
			$(this).width(194);
		});
		
		$(".a_links").mouseout(function(){
			$(this).parent().stop(true, false).animate({ opacity: 0.40, backgroundPosition: "(145px 0)" }, 500, "backout");
			$(this).width(48);
		});
		
		$(".a_menu, .a_ajax").livequery("click", function(event){
			var url_rel = $(this).attr("rel");
			
			$.blockUI.defaults.applyPlatformOpacityRules = false;
			
			$.blockUI({
				message: $("#loader")
			});
			
			$.ajax({
				url: url_rel,
				cache: false,
				success: function(html){
					$("#main").html(html);
				}
			});
		});
		
		$(".a_thumb").fancybox();
	});
	
	// Mail antispam
	function mailNoSpam(user, dominio){
		document.location.href = "mailto:" + user + "@" + dominio;
	}
	
	// Controlla gli spazi vuoti nella compilazione dei campi di testo
	function trim(stringa){
		while(stringa.substring(0, 1) == " ")
			stringa = stringa.substring(1, stringa.length);
		
		while(stringa.substring(stringa.length-1, stringa.length) == " ")
			stringa = stringa.substring(0, stringa.length-1);
		
		return stringa;
	}
	
	// Submit di ricerca nella gallery per pagina
	function passPage(gidValue, pageValue){
		var gid = "";
		
		if(gidValue != "")
			var gid = "&gid=" + gidValue;
		
		var url_rel = "content.php?cmd=gallery&page=" + pageValue + gid;
		
		$.blockUI.defaults.applyPlatformOpacityRules = false;
		
		$.blockUI({
			message: $("#loader")
		});
		
		$.ajax({
			url: url_rel,
			cache: false,
			success: function(html){
				$("#main").html(html);
			}
		});
	}
	
	// Controlla la compilazione della form in CONTATTI
	function checkForm(){
		var goodEmail = document.forms[0].mail.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
		
		if(trim(document.forms[0].nome.value) == ""){
			alert("Attenzione!\nIl campo NOME non è stato compilato correttamente.");
			document.forms[0].nome.focus();
		}
		else if(trim(document.forms[0].cognome.value) == ""){
			alert("Attenzione!\nIl campo COGNOME non è stato compilato correttamente.");
			document.forms[0].cognome.focus();
		}
		else if(!goodEmail){
			alert("Attenzione!\nIl campo E-MAIL non è stato compilato correttamente.");
			document.forms[0].mail.focus();
		}
		else if(trim(document.forms[0].richiesta.value) == ""){
			alert("Attenzione!\nIl campo RICHIESTA non è stato compilato correttamente.");
			document.forms[0].richiesta.focus();
		}
		else{
			$(document).ajaxStop($.unblockUI);
			
			$.blockUI.defaults.applyPlatformOpacityRules = false;
			
			$.blockUI({
				message: $("#loader")
			});
			
			$.ajax({
				url: "mail.php",
				type: "POST",
				data: "nome=" + document.forms[0].nome.value + "&cognome=" + document.forms[0].cognome.value + "&mail=" + document.forms[0].mail.value + "&richiesta=" + document.forms[0].richiesta.value,
				cache: false,
				success: function(html){
					$("#main_content").html(html);
				}
			});
		}
	}
//-->
