
var i=0;
var j=0;
var z=0;

function NovitaSito(){
    var n1="V.Mazzola sempre più in crisi";
    var n2="Ancora una sconfitta a Sala Consilina";
    var n3="La Valdianese cala il tris";
    var n4="Inutile il gol di La Marca";
    var n5="Partita condizionata dagli episodi";
	var n6="Due espulsioni e due rigori contro";
    var n7="La Juniores continua a volare";
    var n8="Allievi KO, Giovanissimi vincenti ";
    i = (i == 8) ? 1:++i;
	switch(i){
		case 1 : news.innerHTML=n1;break;
		case 2 : news.innerHTML=n2;break;
		case 3 : news.innerHTML=n3;break;
		case 4 : news.innerHTML=n4;break;
		case 5 : news.innerHTML=n5;break;
		case 6 : news.innerHTML=n6;break;
		case 7 : news.innerHTML=n7;break;
		case 8 : news.innerHTML=n8;break;
		case 9 : news.innerHTML=n9;break;
		case 10 : news.innerHTML=n10;break;
	}
	setTimeout("NovitaSito()",2000);
}

function Tempo(){
  	var now = new Date();
   	var hours = now.getHours();
   	var minutes = now.getMinutes();
   	var seconds = now.getSeconds();
  	var timeValue = hours;
   	timeValue += ((minutes < 10) ? ":0" : ":") + minutes;
   	timeValue += ((seconds < 10) ? ":0" : ":") + seconds;
   	time.innerHTML=timeValue;
   	setTimeout("Tempo()",1000);
}

function Data(){
	var Oggi = new Date();
	var mese=Oggi.getMonth()+ 1;
	if(mese<10) mese="0"+mese;
	var Data = Oggi.getDate()+"/"+ mese + "/" +  Oggi.getFullYear();
	date.innerHTML=Data;
}
/*
function rollRisultati(){
	var r1="Campionato 1ª cat girone G";
	var r2="Risultati della 9ª giornata";
	var r3="L'Intrepida vince di rigore";
	i = (i == 3) ? 1:++i;
	switch(i){
		case 1 : risultati.innerHTML=r1;break;
		case 2 : risultati.innerHTML=r2;break;
		case 3 : risultati.innerHTML=r3;break;
	}
	setTimeout("rollRisultati()",2000);
}

function rollRisultatiJun(){
	var r1="Campionato Juniores 2005-06";
	var r2="Risultati della 9ª giornata";
	var r3="La juniores crolla a Siano";
	i = (i == 3) ? 1:++i;
	switch(i){
		case 1 : risultatiJun.innerHTML=r1;break;
		case 2 : risultatiJun.innerHTML=r2;break;
		case 3 : risultatiJun.innerHTML=r3;break;
	}
	setTimeout("rollRisultatiJun()",2000);
}

function rollClassifica(){
	var r1="Campionato 1ª cat girone G";
	var r2="Classifica anno 2005-06";
	var r3="Intrepida e Sei Casali allungano"; 
	i = (i == 3) ? 1:++i;
	switch(i){
		case 1 : classifica.innerHTML=r1;break;
		case 2 : classifica.innerHTML=r2;break;
		case 3 : classifica.innerHTML=r3;break;
	}
	setTimeout("rollClassifica()",2000);
}

function rollNextMatch(){
	var r1="Campionato 1ª cat girone G";
	var r2="Prossimo Turno (10ª Giornata)";
	var r3="A Coperchia arrivano i Cilentani";
	i = (i == 3) ? 1:++i;
	switch(i){
		case 1 : prossimoTurno.innerHTML=r1;break;
		case 2 : prossimoTurno.innerHTML=r2;break;
		case 3 : prossimoTurno.innerHTML=r3;break;
	}
	setTimeout("rollNextMatch()",2000);
}

function rollNextMatchJun(){
	var r1="Campionato Juniores girone M";
	var r2="Prossimo Turno (10ª Giornata)";
	var r3="La juniores sfida la Rinascita Fuorni";
	i = (i == 3) ? 1:++i;
	switch(i){
		case 1 : prossimoTurnoJun.innerHTML=r1;break;
		case 2 : prossimoTurnoJun.innerHTML=r2;break;
		case 3 : prossimoTurnoJun.innerHTML=r3;break;
	}
	setTimeout("rollNextMatchJun()",2000);
}

function rollPuntoCampionato(){
	var r1="Il punto sul campionato";
	var r2="Commento della 1ª Giornata";
	var r3="Vittoria per le due favorite";
	i = (i == 3) ? 1:++i;
	switch(i){
		case 1 : punto.innerHTML=r1;break;
		case 2 : punto.innerHTML=r2;break;
		case 3 : punto.innerHTML=r3;break;
	}
	setTimeout("rollPuntoCampionato()",2000);
}
*/
function rollMarcatori(){
	var r1="I Marcatori della squadra 2007-08";
	var r2="Maisto di rigore per la sesta statuina";
	var r3="De Martino leader in gol ed assist";
	i = (i == 3) ? 1:++i;
	switch(i){
		case 1 : marcatori.innerHTML=r1;break;
		case 2 : marcatori.innerHTML=r2;break;
		case 3 : marcatori.innerHTML=r3;break;
	}
	setTimeout("rollMarcatori()",2000);
}

function rollBestPlayer(){
	var p1="I TOP 10 della squadra";
	var p2="Stagione stratosferisca per Maisto";
	var p3="Sorrentino e Maisto i più presenti";
	j= (j==3) ? 1 : ++j;
	switch(j){
		case 1 : top10.innerHTML=p1;break;
		case 2 : top10.innerHTML=p2;break;
		case 3 : top10.innerHTML=p3;break;
	}
	setTimeout("rollBestPlayer()",2000);
}

function rollProbForm(){
	var p1="La Probabile Formazione";
	var p2="B.Atletico 158 - V.Mazzola";
	var p3="Clicca sullo stemma";
	z= (z==3) ? 1 : ++z;
	switch(z){
		case 1 : prob.innerHTML=p1;break;
		case 2 : prob.innerHTML=p2;break;
		case 3 : prob.innerHTML=p3;break;
	}	
	setTimeout("rollProbForm()",2000);
}

function verificaMessaggio(){
	if(document.guest.autore_mess.value==""){
			alert("Non hai inserito il nome");
			document.guest.autore_mess.focus();
			return false;
	  	}
	  	if(document.guest.desc_mess.value==""){
			alert("Non hai inserito nessun commento");
			document.guest.desc_mess.focus();
			return false;
	  	}
		//alert("Il messaggio verrà esaminato. Sarà visibile sul guestbook al più presto!!!");
	    return true;
}

function checkNews(){
	if(document.news.titolo_news.value==""){
		alert("Non hai inserito il titolo");
		document.news.titolo_news.focus();
		return false;
	}
	if(document.news.desc_news.value==""){
		alert("Non hai inserito il commento");
		document.news.desc_news.focus();
		return false;
	}
	return true;
}

function checkNewsletters(){
	if(document.newsletters.subject.value==""){
		alert("Non hai inserito l'Oggetto");
		document.newsletters.subject.focus();
		return false;
	}
	if(document.newsletters.desc_news.value==""){
		alert("Non hai inserito la News");
		document.newsletters.desc_news.focus();
		return false;
	}
	return true;
}
/*
function verificaModulo(){
		if(document.modulo.NOME.value==""){
			alert("Non hai inserito il nome");
			document.modulo.NOME.focus();
			return false;
	  	}
	  	if(document.modulo.COGNOME.value==""){
					alert("Non hai inserito il cognome");
					document.modulo.COGNOME.focus();
					return false;
	  	}
	  	
	  	if(document.modulo.email.value==""){
	  		alert("Non hai inserito l'indirizzo e-mail");
	  		document.modulo.email.focus();
	  		return false;
	  	}
	  	var indirizzo=document.modulo.email.value;
				if(!check(indirizzo)){
					alert("L'indirizzo di posta elettronica contiene un formato non corretto");
					modulo.email.focus();
					modulo.email.select();
			  		return false;
	  	}
		return true;		  	
}	  	
*/

function checkEmail(){
	
		var email = document.newsletter.email;
		var email_value = email.value;
		
		if(email_value==""){
	  		alert("Inserisci L'indirizzo email.");
	  		email.focus();
	  		return false;
	  	}
		
		var caratteriNonValidi=" /;:,";
		for(var i=0;i<caratteriNonValidi.length;i++){
			var noCar=caratteriNonValidi.charAt(i);
			if(email_value.indexOf(noCar,0)>-1){
				alert("Format email non valido.");
	  			email.focus();
	  			return false;
			}
		}
		atPos=email_value.indexOf("@",1);
		if(atPos==-1 || email_value.indexOf("@",atPos+1)!=-1 ){
			alert("Format email non valido.");
	  			email.focus();
	  			return false;
		}
		
		dotPos=email_value.indexOf(".",atPos)
		if(dotPos==-1 || email_value.indexOf(".",dotPos+1)!=-1){
			alert("Format email non valido.");
	  		email.focus();
	  		return false;
		}
		
		if(email_value.length-dotPos>4 || email_value.length-dotPos<3){
			alert("Format email non valido.");
	  		email.focus();
	  		return false;
		}
		document.newsletter.action="iscrizioneDB.php";
		document.newsletter.submit();	
		return true;
}

var imgCaricate = new Array();

function caricaImmagini(){
	var dir = 'imgFormazione/';
	logo = dir + 'logo.jpg'
	uno = dir + 'DellisolaDavide.jpg';
	due = dir + 'SperaAlessandro.jpg';
	tre = dir + 'CastelloStefano.jpg';
	quattro = dir + 'VigilanteAlfonso.jpg';
	cinque = dir + 'MaistoPaolino.jpg';
	sei = dir + 'FalconeSaverio.jpg';
	sette = dir + 'SorrentinoArmando.jpg';
	otto = dir + 'ApicellaDaniele.jpg';
	nove = dir + 'CoppolaGiovanni.jpg';
	dieci = dir + 'EspositoAlessio.jpg';
	undici = dir + 'CapuanoRocco.jpg';
	mister = dir + 'AmabileFrancesco.jpg';
	dodici = dir + 'PasqualucciAntonio.jpg';
	tredici = dir + 'PellegrinoFrancesco.jpg';
	quattordici = dir + 'PellegrinoRoberto.jpg';
	quindici = dir + 'PastoreFrancesco.jpg';
	sedici = dir + 'AmabileDavide.jpg';
	diciassette = dir + 'VitaleRoberto.jpg';
	diciotto = dir + 'MeleGianluca.jpg';
	imgCaricate[1] = uno;
	imgCaricate[2] = due;
	imgCaricate[3] = tre;
	imgCaricate[4] = quattro;
	imgCaricate[5] = cinque;
	imgCaricate[6] = sei;
	imgCaricate[7] = sette;
	imgCaricate[8] = otto;
	imgCaricate[9] = nove;
	imgCaricate[10] = dieci;
	imgCaricate[11] = undici;
	imgCaricate[12] = mister;
	imgCaricate[13] = logo;
	imgCaricate[14] = dodici;
	imgCaricate[15] = tredici;
	imgCaricate[16] = quattordici;
	imgCaricate[17] = quindici;
	imgCaricate[18] = sedici;
	imgCaricate[19] = diciassette;
	imgCaricate[20] = diciotto;
	imgCaricate[21] = logo;
	for (k=1;k<22;k++)
		document.titolari.src = imgCaricate[k];
}


var timeID=0;
function rollImmagine(){
	i = (i == 21) ? 1 : ++i;
	document.titolari.src = imgCaricate[i];
	if (i == 21) clearTimeout(timeID);
	else timeID = setTimeout("rollImmagine()",2500);
		
}

function nomeGiocatori(){
	var n1 = "1  Dell'isola D." 
	var n2 = "2  Spera A.";
   	var n3 = "3  Castello S."
   	var n4 = "4  Vigilante A.";
   	var n5 = "5  Maisto P.";
   	var n6 = "6  Falcone S.";
   	var n7 = "7  Sorrentino A.";
   	var n8 = "8  Apicella D.";
   	var n9 = "9  Coppola G.";
   	var n10 = "10  Esposito A.";
   	var n11 = "11  Capuano R.";
   	var n12 = "Mr. Amabile Francesco";
   	var n13 = "A disposizione : ";
   	var n14 = "12  Pasqualucci A.";
	var n15 = "13  Pellegrino F.";
	var n16 = "14  Pellegrino R.";
	var n17 = "15  Pastore F.";
	var n18 = "16  Amabile D.";
   	var n19 = "17  Vitale R.";
   	var n20 = "18  Mele G.";
   	var n21 = " ";
    	j = (j == 21) ? 1 : ++j;
    	switch(j){
		case 1 :formazione.innerHTML=n1;
			num1.innerHTML=n1;
			break;
		case 2 :formazione.innerHTML=n2;
			num2.innerHTML=n2;
			break;
		case 3 :formazione.innerHTML=n3;
			num3.innerHTML=n3;
			break;
		case 4 :formazione.innerHTML=n4;
			num4.innerHTML=n4;
			break;
		case 5 :formazione.innerHTML=n5;
			num5.innerHTML=n5;
			break;
		case 6 :formazione.innerHTML=n6;
			num6.innerHTML=n6;
			break;
		case 7 :formazione.innerHTML=n7;
			num7.innerHTML=n7;
			break;
		case 8 :formazione.innerHTML=n8;
			num8.innerHTML=n8;
			break;
		case 9 :formazione.innerHTML=n9;
			num9.innerHTML=n9;
			break;
		case 10 :formazione.innerHTML=n10;
			num10.innerHTML=n10;
			break;
		case 11 :formazione.innerHTML=n11;
			num11.innerHTML=n11;
			break;
		case 12 :formazione.innerHTML=n12;
			mr.innerHTML=n12;
			break;
		case 13 :formazione.innerHTML=n21;
			disp.innerHTML=n13;
			break;
		case 14 :formazione.innerHTML=n14;
			num12.innerHTML=n14;
			break;
		case 15 :formazione.innerHTML=n15;
			num13.innerHTML=n15;
			break;
		case 16 :formazione.innerHTML=n16;
			num14.innerHTML=n16;
			break;
		case 17 :formazione.innerHTML=n17;
			num15.innerHTML=n17;
			break;
		case 18 :formazione.innerHTML=n18;
			num16.innerHTML=n18;
			break;
		case 19 :formazione.innerHTML=n19;
			num17.innerHTML=n19;
			break;
		case 20 :formazione.innerHTML=n20;
			num18.innerHTML=n20;
			break;
		case 21 :formazione.innerHTML=n21;
			break;
	}		
	if (j == 21) clearTimeout(timeID);
	else timeID = setTimeout("nomeGiocatori()",2500);
}

function changeImage(i,stato){
	var d=document;
	var path = "http://www.valentinomazzola.it/imgSommario/";
	switch(i){
		case 1:
			if (stato=='over') d.button1.src= path + "palloneR.gif";
			else d.button1.src= path + "pallone.gif";
			break;
		case 2:
				if (stato=='over') d.button2.src= path + "palloneR.gif";
				else d.button2.src=path + "pallone.gif";
			break;
		case 3:
				if (stato=='over') d.button3.src=path + "palloneR.gif";
				else d.button3.src=path +"pallone.gif";
			break;
		case 4:
				if (stato=='over') d.button4.src=path + "palloneR.gif";
				else d.button4.src=path +"pallone.gif";
			break;
		case 5:
				if (stato=='over') d.button5.src=path + "palloneR.gif";
				else d.button5.src=path +"pallone.gif";
			break;
		case 6:
				if (stato=='over') d.button6.src=path + "palloneR.gif";
				else d.button6.src=path +"pallone.gif";
			break;
		case 7: 
				if (stato=='over') d.button7.src=path +"palloneR.gif";
				else d.button7.src=path +"pallone.gif";
			break;
		case 8: 
				if (stato=='over') d.button8.src=path +"palloneR.gif";
				else d.button8.src=path +"pallone.gif";
			break;
		case 9: 
				if (stato=='over') d.button9.src=path +"palloneR.gif";
				else d.button9.src=path +"pallone.gif";
			break;
		case 10: 
				if (stato=='over') d.button10.src=path +"palloneR.gif";
				else d.button10.src=path +"pallone.gif";
			break;
		case 11: 
				if (stato=='over') d.button11.src=path +"palloneR.gif";
				else d.button11.src=path +"pallone.gif";
			break;
		case 12: 
				if (stato=='over') d.button12.src=path +"palloneR.gif";
				else d.button12.src=path +"pallone.gif";
			break;
		case 13: 
				if (stato=='over') d.button13.src=path +"palloneR.gif";
				else d.button13.src=path +"pallone.gif";
			break;
		case 14: 
				if (stato=='over') d.button14.src=path +"palloneR.gif";
				else d.button14.src=path +"pallone.gif";
			break;
		case 15: 
				if (stato=='over') d.button15.src=path +"palloneR.gif";
				else d.button15.src=path +"pallone.gif";
			break;
		case 16: 
				if (stato=='over') d.button16.src=path +"downloadR.gif";
				else d.button16.src=path +"download.gif";
			break;
		case 17: 
				if (stato=='over') d.button17.src=path +"downloadR.gif";
				else d.button17.src=path +"download.gif";
			break;
		case 18: 
				if (stato=='over') d.button18.src=path +"downloadR.gif";
				else d.button18.src=path +"download.gif";
			break;
		case 19: 
				if (stato=='over') d.button19.src=path +"downloadR.gif";
				else d.button19.src=path +"download.gif";
			break;
		case 20: 
				if (stato=='over') d.button20.src=path +"downloadR.gif";
				else d.button20.src=path +"download.gif";
			break;
		case 21: 
				if (stato=='over') d.button21.src=path +"palloneR.gif";
				else d.button21.src=path +"pallone.gif";
			break;
		case 22: 
				if (stato=='over') d.button22.src=path +"palloneR.gif";
				else d.button22.src=path +"pallone.gif";
			break;
		case 23: 
				if (stato=='over') d.button23.src=path +"palloneR.gif";
				else d.button23.src=path +"pallone.gif";
			break;
		case 24: 
				if (stato=='over') d.button24.src=path +"palloneR.gif";
				else d.button24.src=path +"pallone.gif";
			break;
		case 25: 
				if (stato=='over') d.button25.src=path +"palloneR.gif";
				else d.button25.src=path +"pallone.gif";
			break;	
		case 26: 
				if (stato=='over') d.button26.src=path +"palloneR.gif";
				else d.button26.src=path +"pallone.gif";
			break;	
		case 27: 
				if (stato=='over') d.button27.src=path +"palloneR.gif";
				else d.button27.src=path +"pallone.gif";
			break;
		case 28: 
				if (stato=='over') d.button28.src=path +"palloneR.gif";
				else d.button28.src=path +"pallone.gif";
			break;
		case 31: 
				if (stato=='over') d.button31.src=path +"palloneR.gif";
				else d.button31.src=path +"pallone.gif";
			break;
		case 32: 
				if (stato=='over') d.button32.src=path +"palloneR.gif";
				else d.button32.src=path +"pallone.gif";
			break;
		case 33: 
				if (stato=='over') d.button33.src=path +"palloneR.gif";
				else d.button33.src=path +"pallone.gif";
			break;
		case 34: 
				if (stato=='over') d.button34.src=path +"palloneR.gif";
				else d.button34.src=path +"pallone.gif";
			break;
		case 35: 
				if (stato=='over') d.button35.src=path +"palloneR.gif";
				else d.button35.src=path +"pallone.gif";
		case 36: 
				if (stato=='over') d.button36.src=path +"palloneR.gif";
				else d.button36.src=path +"pallone.gif";
			break;
		case 37: 
				if (stato=='over') d.button37.src=path +"palloneR.gif";
				else d.button37.src=path +"pallone.gif";
			break;
		case 38: 
				if (stato=='over') d.button38.src=path +"palloneR.gif";
				else d.button38.src=path +"pallone.gif";
			break;
		case 39: 
				if (stato=='over') d.button39.src=path +"palloneR.gif";
				else d.button39.src=path +"pallone.gif";
			break;
		case 40: 
				if (stato=='over') d.button40.src=path +"palloneR.gif";
				else d.button40.src=path +"pallone.gif";
			break;
		case 41: 
				if (stato=='over') d.button41.src=path +"palloneR.gif";
				else d.button41.src=path +"pallone.gif";
			break;
		case 42: 
				if (stato=='over') d.button42.src=path +"palloneR.gif";
				else d.button42.src=path +"pallone.gif";
			break;
		
	}
}

function submitFirstFormIns(){
	document.modulo.submit();
}

function checkModuloPagelle(){
		var giocatori = new Array();
		var esito_check = false;
		var check_statuina = false;
		giocatori[0] = document.pagelle.giocatore_1.value;
		giocatori[1] = document.pagelle.giocatore_2.value;
		giocatori[2] = document.pagelle.giocatore_3.value;
		giocatori[3] = document.pagelle.giocatore_4.value;
		giocatori[4] = document.pagelle.giocatore_5.value;
		giocatori[5] = document.pagelle.giocatore_6.value;
		giocatori[6] = document.pagelle.giocatore_7.value;
		giocatori[7] = document.pagelle.giocatore_8.value;
		giocatori[8] = document.pagelle.giocatore_9.value;
		giocatori[9] = document.pagelle.giocatore_10.value;
		giocatori[10] = document.pagelle.giocatore_11.value;
		giocatori[11] = document.pagelle.giocatore_12.value;
		giocatori[12] = document.pagelle.giocatore_13.value;
		giocatori[13] = document.pagelle.giocatore_14.value;
		for(k=0;k<11;k++){
			if (giocatori[k] == 0){
				alert("Non hai inserito tutti gli undici titolari");
				return false;
			}
		}
		for(i=0;i<13;i++){
			for(j=i+1;j<14;j++){
				if((giocatori[i] == giocatori[j]) && (giocatori[i] > 0)){
					alert("Hai inserito due o più volte lo stesso giocatore");
					return false;
				}
			}
		}
		for (counter = 0; counter < pagelle.esito_partita.length; counter++){ 
       		if (pagelle.esito_partita[counter].checked) 
       			esito_check=true;
		}
		if (!esito_check){
			alert("Non hai inserito l'esito della partita!");
			return false;
		}
		
		for (counter = 0; counter < pagelle.statuina.length; counter++){ 
       		if (pagelle.statuina[counter].checked) 
       			check_statuina=true;
		}
		if (!check_statuina){
			if(!confirm("Statuina non selezionata!!!"))
				return false;
		}
		return true;
}

function checkModuloPagelleJun(){
		var giocatori = new Array();
		var esito_check = false;
		var check_statuina = false;
		giocatori[0] = document.pagelle.giocatore_1.value;
		giocatori[1] = document.pagelle.giocatore_2.value;
		giocatori[2] = document.pagelle.giocatore_3.value;
		giocatori[3] = document.pagelle.giocatore_4.value;
		giocatori[4] = document.pagelle.giocatore_5.value;
		giocatori[5] = document.pagelle.giocatore_6.value;
		giocatori[6] = document.pagelle.giocatore_7.value;
		giocatori[7] = document.pagelle.giocatore_8.value;
		giocatori[8] = document.pagelle.giocatore_9.value;
		giocatori[9] = document.pagelle.giocatore_10.value;
		giocatori[10] = document.pagelle.giocatore_11.value;
		giocatori[11] = document.pagelle.giocatore_12.value;
		giocatori[12] = document.pagelle.giocatore_13.value;
		giocatori[13] = document.pagelle.giocatore_14.value;
		giocatori[14] = document.pagelle.giocatore_15.value;
		giocatori[15] = document.pagelle.giocatore_16.value;
		for(k=0;k<11;k++){
			if (giocatori[k] == 0){
				alert("Non hai inserito tutti gli undici titolari");
				return false;
			}
		}
		for(i=0;i<15;i++){
			for(j=i+1;j<16;j++){
				if((giocatori[i] == giocatori[j]) && (giocatori[i] > 0)){
					alert("Hai inserito due o più volte lo stesso giocatore");
					return false;
				}
			}
		}
		for (counter = 0; counter < pagelle.esito_partita.length; counter++){ 
       		if (pagelle.esito_partita[counter].checked) 
       			esito_check=true;
		}
		if (!esito_check){
			alert("Non hai inserito l'esito della partita!");
			return false;
		}
		
		for (counter = 0; counter < pagelle.statuina.length; counter++){ 
       		if (pagelle.statuina[counter].checked) 
       			check_statuina=true;
		}
		if (!check_statuina){
			if(!confirm("Statuina non selezionata!!!"))
				return false;
		}
		return true;
}

function checkModuloPartite(){
		if(document.partita.commento.value==""){
	  		alert("Non hai il commento sulla partita");
	  		document.partita.commento.focus();
	  		return false;
	  	}
}

function checkSondaggio(){
	var esito_check = false;
	for (counter = 0; counter < sondaggi.option.length; counter++){ 
       		if (sondaggi.option[counter].checked) 
       			esito_check=true;
	}
	location.href = "http://www.valentinomazzola.it/sondaggi.php";
	if (!esito_check){
		alert("Non hai selezionato nessuna opzione");
		return false;
	}
	return true;
}

function popup(){
	var popup = getCookie("popup");
	if (popup == null){ 
		setCookie("popup","yes");
		//window.open('popup.html','MazzolaBaratta','resizable=no,width=500,height=700');
		window.open('http://www.valentinomazzola.it/popup.html','Volantino','scrollbars=yes,resizable=yes,width=650,height=600,top=3,left=3');
	}		
} 

function alertMessage(){
	alert("Hai già votato!!!");
	return false;
}

function getCookie(NameOfCookie){
    if (document.cookie.length > 0) {             
    begin = document.cookie.indexOf(NameOfCookie+"=");      
    if (begin != -1) {          
      begin += NameOfCookie.length+1;      
      end = document.cookie.indexOf(";", begin);
      if (end == -1) end = document.cookie.length;
        return unescape(document.cookie.substring(begin, end));
    }
  }
  return null;
}

function setCookie(NameOfCookie, value, expiredays) {
	var ExpireDate = new Date ();
	ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
  	document.cookie = NameOfCookie + "=" + escape(value) +
  			((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
}

function setCookie(NameOfCookie, value) {
	document.cookie = NameOfCookie + "=" + escape(value);
}

function validaMessage(indice){
	var m = document.modulo;
	var id_mess= "";
	var desc_mess = "";
	var autore_mess  ="";
	switch(indice){
		case 1: 
			id_mess = m.id_mess_1.value;
			autore_mess = m.autore_mess_1.value;
			desc_mess = m.desc_mess_1.value;
			break;
		case 2:
			id_mess = m.id_mess_2.value;
			autore_mess = m.autore_mess_2.value;
			desc_mess = m.desc_mess_2.value;
			break;
		case 3: 
			id_mess = m.id_mess_3.value;
			autore_mess = m.autore_mess_3.value;
			desc_mess = m.desc_mess_3.value;
			break;
		case 4: 
			id_mess = m.id_mess_4.value;
			autore_mess = m.autore_mess_4.value;
			desc_mess = m.desc_mess_4.value;
			break;
		case 5: 
			id_mess = m.id_mess_5.value;
			autore_mess = m.autore_mess_5.value;
			desc_mess = m.desc_mess_5.value;
			break;
		case 6: 
			id_mess = m.id_mess_6.value;
			autore_mess = m.autore_mess_6.value;
			desc_mess = m.desc_mess_6.value;
			break;
		case 7: 
			id_mess = m.id_mess_7.value;
			autore_mess = m.autore_mess_7.value;
			desc_mess = m.desc_mess_7.value;
			break;
		case 8: 
			id_mess = m.id_mess_8.value;
			autore_mess = m.autore_mess_8.value;
			desc_mess = m.desc_mess_8.value;
			break;
		case 9: 
			id_mess = m.id_mess_9.value;
			autore_mess = m.autore_mess_9.value;
			desc_mess = m.desc_mess_9.value;
			break;
		case 10: 
			id_mess = m.id_mess_10.value;
			autore_mess = m.autore_mess_10.value;
			desc_mess = m.desc_mess_10.value;
			break;
	}		
	document.modulo.id_mess.value = id_mess;
	document.modulo.autore_mess.value = autore_mess;
	document.modulo.desc_mess.value = desc_mess;
	document.modulo.flag_validate.value = "Y";
}

function invalidaMessage(indice){
	var m = document.modulo;
	var id_mess= "";
	var autore_mess = "";
	switch(indice){
		case 1: 
			id_mess = m.id_mess_1.value;
			autore_mess = m.autore_mess_1.value;
			break;
		case 2: 
			id_mess = m.id_mess_2.value;
			autore_mess = m.autore_mess_2.value;
			break;
		case 3: 
			id_mess = m.id_mess_3.value;
			autore_mess = m.autore_mess_3.value;
			break;
		case 4: 
			id_mess = m.id_mess_4.value;
			autore_mess = m.autore_mess_4.value;
			break;
		case 5: 
			id_mess = m.id_mess_5.value;
			autore_mess = m.autore_mess_5.value;
			break;
		case 6: 
			id_mess = m.id_mess_6.value;
			autore_mess = m.autore_mess_6.value;
			break;
		case 7: 
			id_mess = m.id_mess_7.value;
			autore_mess = m.autore_mess_7.value;
			break;
		case 8: 
			id_mess = m.id_mess_8.value;
			autore_mess = m.autore_mess_8.value;
			break;
		case 9: 
			id_mess = m.id_mess_9.value;
			autore_mess = m.autore_mess_9.value;
			break;
		case 10: 
			id_mess = m.id_mess_10.value;
			autore_mess = m.autore_mess_10.value;
			break;
	}		
	document.modulo.id_mess.value = id_mess;
	document.modulo.autore_mess.value = autore_mess;
	document.modulo.flag_validate.value = "K";
	document.modulo.desc_mess.value="Messaggio filtrato dall'Amministratore. Ripostare in termini più adeguati.";
}

