// JavaScript Document


function popUp_fagiolo(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=530,height=180,left = 705,top = 290');");
}

function popUp_chat(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=640,height=630,left = 640,top = 0');");
}



function popUpWebcam(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=280,left = 760,top = 400');");
}

function popUp_diretta(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=320,height=140,left = 800,top = 470');");
}

//sostituisci carattere
function changecar(text) {
    text = text.replace('&','e');
	
    return(text);
}


//controllo form community
function inviamodulo(){
	//controllo campi
	var nome = document.getElementById('nome').value;
	var email = document.getElementById('email').value;
	var cellulare = document.getElementById('cellulare').value;
	var privacy_c = document.getElementById('privacy_c');

	//mail corretta
	var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;

	//effettuo controllo
	if ((nome == "") || (nome == "undefined")) {
   alert("Il Nome e' obbligatorio");
   document.getElementById('nome').focus();
   return false;
	}else if((email == "") || (email == "undefined")){
	alert("L'indirizzo e-mail e' obbligatorio");
   document.getElementById('email').focus();
   return false;
	}else if(!email_reg_exp.test(email)){ //controllo mail
	alert("L'indirizzo e-mail non e' corretto");
   document.getElementById('email').focus();
   return false;
	}else if((cellulare == "") || (cellulare == "undefined")){
	alert("Il numero di cellulare e' obbligatorio");
   document.getElementById('cellulare').focus();
   return false;
	}else if(privacy_c.checked == false){ //condizioni
	alert("Accettare il consenso al trattamento dei dati (Privacy)");
   document.getElementById('privacy_c').focus();
   return false;
	}else{
	document.getElementById('form1_com').submit();
	
	
		
	
	}
	}
	
function inviamodulo_contatti(){
	//controllo campi
	var nome = document.getElementById('nome_contatti').value;
	var email = document.getElementById('email_contatti').value;
	var privacy_c = document.getElementById('privacy_c_contatti');
	var messaggio = document.getElementById('messaggio_contatti').value;

	//mail corretta
	var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;

	//effettuo controllo
	if ((nome == "") || (nome == "undefined")) {
   alert("Il Nome e' obbligatorio");
   document.getElementById('nome_contatti').focus();
   return false;
	}else if((email == "") || (email == "undefined")){
	alert("L'indirizzo e-mail e' obbligatorio");
   document.getElementById('email_contatti').focus();
   return false;
	}else if(!email_reg_exp.test(email)){ //controllo mail
	alert("L'indirizzo e-mail non e' corretto");
   document.getElementById('email_contatti').focus();
   return false;
	}else if((messaggio == "") || (messaggio == "undefined")){
	alert("Il messaggio e' obbligatorio");
   document.getElementById('messaggio_contatti').focus();
   return false;
	}else if(privacy_c.checked == false){ //condizioni
	alert("Accettare il consenso al trattamento dei dati (Privacy)");
   document.getElementById('privacy_c_contatti').focus();
   return false;
	}else{
	document.getElementById('form1_contatti').submit();
	
	
		
	
	}
	}
	
	//vota
	function inviamodulo_vota(){
	document.getElementById('form1_vot').submit();	
	}
	
	function inviamodulo_vota_id(ide){
	document.getElementById(ide).submit();	
	}
	
	
	function inviamodulo_n(){
	//controllo campi
	var nomen = document.getElementById('nomen').value;
	var emailn = document.getElementById('emailn').value;
	var cittan = document.getElementById('cittan').value;
	var privacy_cn = document.getElementById('privacy_cn');

	//mail corretta
	var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;

	//effettuo controllo
	if ((nomen == "") || (nomen == "undefined")) {
   alert("Il Nome e' obbligatorio");
   document.getElementById('nomen').focus();
   return false;
	}else if((emailn == "") || (emailn == "undefined")){
	alert("L'indirizzo e-mail e' obbligatorio");
   document.getElementById('emailn').focus();
   return false;
	}else if(!email_reg_exp.test(emailn)){ //controllo mail
	alert("L'indirizzo e-mail non e' corretto");
   document.getElementById('emailn').focus();
   return false;
	}else if((cittan == "") || (cittan == "undefined")){
	alert("La e-mail e' obbligatorio");
   document.getElementById('cittan').focus();
   return false;
	}else if(privacy_cn.checked == false){ //condizioni
	alert("Accettare il consenso al trattamento dei dati (Privacy)");
   document.getElementById('privacy_cn').focus();
   return false;
	}else{
	document.getElementById('form1_news').submit();
	
		
	
	}
	}
	
	
	
//banner
function bannerx1(pos,maxban1,durata){	
		
var ar_adessobn1=1; //banner di partenza
var ar_proxbn1=1; //banner di partenza
var ar_maxbanbn1=maxban1; //numero banner
var timefadebn1=durata; //5 secondi
var durationfadebn1=800;

//setto timer timer
//var set_tmbn1=1;
var timerrbn1 = setInterval(showDivbn1, timefadebn1);


//fade out
function showDivbn1() {	
	 
	if(ar_proxbn1!=ar_maxbanbn1){ ar_proxbn1++; }else{ar_proxbn1=1;}//aumenta numero articolo
		
		//document.getElementById("ft"+ar_proxbn1).style.borderColor="#4E0410";
		
		//document.getElementById("ft"+ar_adessobn1).style.borderColor="#E9DAD7";
		
		
 		document.getElementById("bn"+pos+"_"+ar_adessobn1).style.display="none";
		document.getElementById("bn"+pos+"_"+ar_proxbn1).style.display="block";
		//$("#bn"+pos+"_"+ar_adessobn1).fadeOut(durationfadebn1, function(){ //fade
		//fai qualcosa
		//});	
		
		//$("#bn"+pos+"_"+ar_proxbn1).fadeIn(durationfadebn1, function(){ //fade
		//fai qualcosa
		
		//});	

		if(ar_adessobn1!=ar_maxbanbn1){ ar_adessobn1++; }else{ar_adessobn1=1}//aumenta numero articolo
		}
	}
