var sitepath = document.location+"wp-content/themes/regaloweekend";

function convalidaVotazione(){
var formpath = document.giftvote;
var check0 = formpath.ilvoto_0.checked;
var check1 = formpath.ilvoto_1.checked;
var check2 = formpath.ilvoto_2.checked;
var check3 = formpath.ilvoto_3.checked;
var check4 = formpath.ilvoto_4.checked;
if(check0||check1||check2||check3||check4){
formpath.submit();
}else{
alert("Devi selezionare un valore da 1 a 5 per votare il film!");
}
}
function filtra(){
var filterstring = '';
var totaltags = new Array();
var pricemin = document.compsearch.pricemin.value;
var pricemax = document.compsearch.pricemax.value;
var etamin = document.compsearch.etamin.value;
var etamax = document.compsearch.etamax.value;
for(var i=0; i < document.compsearch.tagsvalue.length; i++){
if(document.compsearch.tagsvalue[i].checked){
totaltags.push(document.compsearch.tagsvalue[i].value);
}
}

totcats = document.compsearch.allcats.value;



var datastr = "tagsvalue="+totaltags+"&etamin="+etamin+"&etamax="+etamax+"&totcats="+totcats+"&pricemin="+pricemin+"&pricemax="+pricemax;
$("#loader").fadeIn("slow");
setTimeout("sendnew('"+datastr+"')",2000);
}

function sendnew(datastr){
$("#content").hide();
	$.ajax({	
		type: "POST",
		url: sitepath+"/ricerca.php",
		data: datastr,
		cache: false,
		success: function(html){
		$("#content").fadeIn("slow");
		$("#content").html(html);
		setTimeout('$("#content").fadeIn("slow");',1000);
		$("#loader").fadeOut("slow");
	}
	});
}


function convalidanewsletter(){
var formpath = document.alo_easymail_widget_form;
var newsnome = formpath.alo_em_opt_name.value;
var newsmail = formpath.alo_em_opt_email.value;
if(newsnome.length < 1||newsnome=="Nome"){
alert("\u00E8 necessario inserire il proprio nome per iscriversi alla newsletter.");
}else if(!newsmail.match(/^([a-z0-9._-]+@[a-z0-9._-]+\.[a-z]{2,4}$)/i)||newsmail=="E-mail"){
alert("Indirizzo e-mail mancante o non valido");
}else{
formpath.submit();
}
}
