$(document).ready(function(){  
	$('#footer p a:not(.info), .accetto a').colorbox({width:"600px", height:"500px", iframe:true });
	$('a.sfoglia').colorbox({width:"990px", height:"600px", iframe:true });
	$('.info').colorbox({width:"500px", height:"350px", iframe:true });	
	$('a.lb').colorbox();
	$("a.blank").click( function() { $(this).attr("target", "_blank") });
	
	
	//Cufon.replace('.colDx h2:not(".news .colDx h2"), .colDx p:not("p.paging, .news .colDx p"), #top h2');
	//Cufon.replace('#altMenu a, p.paging, #mainPage h1', { hover: true });
			
	$("#mainMenu li:last-child").addClass("last");
	
	
	/* newsletter */
	$("#newsletter>p>a").click( function() {
		$("#newsletter").toggleClass("open");
		return false;
	});
	$("#newsletterForm .invia a").click( function() { 
		$("#newsletterForm").submit();
		return false;
	});
	$("#newsletterForm").validate({
		rules: {
			nomenl: { required: true },
			cognomenl: { required: true },
			mailnl: { email: true, required: true },	
			accettonl: { required: true }
		},
		messages: {
		    nomenl: "",
			cognomenl: "",
			mailnl: "",
			accettonl: ""
		},
		submitHandler: function (form) {
			PostNewsletterRequest();
		}
	});
	/* !newsletter */
	
});


//function PostNewsletterRequest() {
//	$('div.loader').removeClass('hide');
//	var url = "";
//	var theData = "";
//	$.ajax(
//	{
//		type: "POST",
//		url: url,
//		data: theData,
//		success: function (msg) {
//			var response = msg.toLocaleString().split("|");
//			var ok = response[0].toLocaleString().split(":");
//			var retVal = ok[1];
//			if (ok[0] == 0) {
//				$('div.loader').addClass('hide');
//				alert('E stata ricevuta un errore durante la richiesta! Si prega di riprovare. (' + retVal + ')');
//				location.reload();
//			}
//			else {
//				//$('#f_contatti').hide();
//				var htmlOk = '<p class=\"ok\">Grazie ' + retVal + '<br/>Il suo contatto č stato ricevuto.<br/> Sarai contattato al pių presto.</p>';
//				$('#newsletter .scroll').html(htmlOk);
//				$('div.loader').addClass('hide');
//				$('#newsletter .scroll').css("height", "auto");
//			}
//		},
//		error: function () {
//			$('div.loader').addClass('hide');
//			alert("E stata ricevuta un errore di comunicazione!");
//		}
//	});
//};


