<!--
	$(document).ajaxStop($.unblockUI);
	
	$(document).ready(function(){
		$("#menu p a").livequery("click", function(event){
			$.scrollTo("#top");
		});
		
		$(".a_ajax").livequery("click", function(event, fid){
			if(fid != undefined)
				var url_rel = "_news.php?id=" + fid;
			else
				var url_rel = $(this).attr("rel");
			
			if(trim(url_rel) != ""){
				$.blockUI.defaults.applyPlatformOpacityRules = false;
				
				$.blockUI({
					message: $("#loader")
				});
				
				$.ajax({
					url: url_rel, 
					cache: false, 
					success: function(html){
						$("#content").html(html);
					}, 
					complete: function(){
						_gaq.push(['_trackPageview', url_rel]);
					}
				});
			}
		});
		
		var url_fel = $(location).attr("href");
		var url_fid = "";
		
		if(trim(url_fel) != "http://www.waimea-classic.it/index.php"){
			var url_fid = $.url.setUrl(url_fel).param("fid");
			
			if(trim(url_fid) != "")
				$("#menu .a_ajax:eq(0)").trigger("click", [url_fid]);
		}
		
		$("#header p:last-child a").css({
			"border-right": "none"
		});
		
		$("#slider").easySlider({
			auto: true, 
			continuous: true, 
			pause: 5000
		});
		
		$(".a_thumb").fancybox({
			centerOnScroll: true, 
			titlePosition: "over"
		});
	});
	
	function mailNoSpam(user, dominio){
		document.location.href = "mailto:" + user + "@" + dominio;
	}
	
	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;
	}
	
	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){
					$("#esito").show().html(html);
					$("#form_contatti")[0].reset();
				}
			});
		}
	}
//-->
