function indirizzoEmailValido(indirizzo) {
	if (window.RegExp) { 
		var nonvalido = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";
		var valido = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";
		var regnv = new RegExp(nonvalido);
		var regv = new RegExp(valido);
			
			if (!regnv.test(indirizzo) && regv.test(indirizzo)) return true;

		return false;

	} else {

		if(indirizzo.indexOf("@") >= 0) return true;

		return false;

	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

		$(document).ready(function() {
			
			$("#logo > a > img").pngfix();
			$("#headersfondo").pngfix();
			$("#wrapper .corner").pngfix();
			$("#myas").pngfix();
			$("#myas input").pngfix();
			$("#box .sfondo").pngfix();
			$("#box .etichetta").pngfix();
			$("#box .etichetta_offerta").pngfix();
			$("#box_news .immagine img").pngfix();
			$(".cerca input").pngfix();
			$(".fr").pngfix();
			$(".panes > div > a > img").pngfix();
			
			$(".single").colorbox();
			
			$('#sidebar_spv .scelti_per_voi').cycle({ 
				fx:     'fade', 
				speed:  'fast', 
				timeout: 0, 
				next:   '#next2', 
				prev:   '#prev2' 
			});
		});
		
        $(window).load(function() {

			$(".sidebar_box h3").click(function() {
				location.href = $(this).parent().find("a").attr("href");
			});
			
			$("#boxfooter li").click(function() {
				location.href = $(this).find("a").attr("href");
			});
			
			$("#boxfooter_int li").click(function() {
				location.href = $(this).find("a").attr("href");
			});


			var i = 0;
			$("#contatti").html("<ul></ul>");
			$("#nav > ul > li").each(function() {
				if (i>=8) {
					$(this).appendTo("#contatti ul");
				}
				i++;
				$("#contatti > ul > li").pngfix();
			});

			$("#sidebar > ul > li:last").css("background","none");

			$("#provincia").change(function() {
				if ($("#provincia").val()=="") {
				$("#comune").html('<option value="">Seleziona il comune</option>');
				} else {
				getComuni();
				}
			});
			
			var height = 0;
			$("#sidebar_spv .scelti_per_voi div").each(function() {
				if ($(this).height()>height) { height = $(this).height(); }
				$(this).height($(this).height());
			});
			
			$("#sidebar_spv .scelti_per_voi").height(height);
			
		});
		
		function redesign_table() {
			$("th:even").css({"background":"url(../images/td.gif) right top repeat-y","background-color":"#f1f8fc"});			
			$("tr.pv > td:even").css({"padding":"15px 20px 10px 20px","background":"url(../images/td.gif) right top repeat-y"});
			$("tr.pv > td:odd").css("padding","0 18px 0 0");
			$("tr.col").after("<tr><td colspan=\"2\" style=\"height: 15px;\"></td></tr>");
			$("tr.pv:not(:last-child)").after("<tr><td colspan=\"2\" style=\"height: 11px; background: url(../images/ptu.gif) center 6px no-repeat; font-size: 0;\">&nbsp;</td></tr>");
			$("tr.pv:last").after("<tr><td colspan=\"2\" style=\"height: 15px;\"></td></tr>");
			$("tr.vl:not(:last-child)").after("<tr><td colspan=\"2\" style=\"height: 7px; background: url(../images/pt.gif) left 2px repeat-x; font-size: 0; line-height: 0;\">&nbsp;</td></tr>");			

			$("#main").height("");
			if ($("#main").height()<580) $("#main").height(580);				

		}
		
		function getComuni() {
			if ($("#provincia").val()!="") {
				$.ajax({
					type: "POST",
					url: "ajax_comuni.jsp",
					data: "prov="+$("#provincia").val()+"&com=",
					success: function(sel) {
						$("#comune").html(sel);
					}
				});
			}
		}

