function check() {
if (document.theform.descrizione_inserimento_eventi.value.length > 500){
alert("Il testo \"Descrizione evento\" non puo' superare i 500 caratteri");
return false;
}

var stato = true;
		//CAMPI OBBLIGATORI COPIARE QUESTE RIGHE
	
	if ((stato == true)&&(document.theform.compilatore_inserimento_eventi.value == "")) {
		testo = "Campo nome compilatore obbligatorio";
		stato = false; 
		theform.compilatore_inserimento_eventi.focus();    
	}
		
	if ((stato == true)&&(document.theform.provincia.value == "")) {
		testo = "Campo provincia obbligatorio";
		stato = false; 
		theform.provincia.focus();    
	}

	if ((stato == true)&&(document.theform.nazione_inserimento_eventi.value == "")) {
		testo = "Campo nazione obbligatorio";
		stato = false; 
		theform.nazione_inserimento_eventi.focus();    
	}
	
	if ((stato == true)&&(document.theform.email_inserimento_eventi.value == "")) {
		testo = "Campo email obbligatorio";
		stato = false; 
		theform.email_inserimento_eventi.focus();    
	}

//privacy	
	if ((stato == true)&&(document.theform.privacy[1].checked)) {
		testo = "Per proseguire e' necessario\nacconsentire al trattamento dei dati\n(consenso privacy).";
		stato = false;     
	}
//privacy / fine


	//VALIDAZIONE E-MAIL
	if (theform.email_inserimento_eventi.value!="")	{
		if ((theform.email_inserimento_eventi.value.length<6)&&(stato==true)) {
			testo = "L'email inserita e' troppo corta.\n";
			stato = false;
			theform.email_inserimento_eventi.focus();    	
		}
		if ((theform.email_inserimento_eventi.value.indexOf('.')==-1)&&(stato==true)) {
			testo = "L'email inserita non e' valida.\n(es: nome@nomeweb.com)";
			stato = false;
			theform.email_inserimento_eventi.focus();    	
		}
		if ((theform.email_inserimento_eventi.value.indexOf('@')==-1)&&(stato==true)) {
			testo = "L'email inserita non e' valida.\n(es: nome@nomeweb.com)";
			stato = false;
			theform.email_inserimento_eventi.focus();    	
		}
		if ((theform.email_inserimento_eventi.value.indexOf('@')!=theform.email_inserimento_eventi.value.lastIndexOf('@'))&&(stato==true)) {
			testo = "L'email inserita non e' valida.\n(es: nome@nomeweb.com)";
			stato = false;
			theform.email_inserimento_eventi.focus();    	
		}
		if ((theform.email_inserimento_eventi.value.indexOf(':')!=-1)&&(stato==true)) {
			testo = "L'email inserita non e' valida.\n(es: nome@nomeweb.com)";
			stato = false;
			theform.email_inserimento_eventi.focus();    	
		}
		if ((theform.email_inserimento_eventi.value.indexOf(' ')!=-1)&&(stato==true)) {
			testo = "L'email inserita non e' valida.\nNon utilizzare spazi.\n(es: nome@nomeweb.com)";
			stato = false;
			theform.email_inserimento_eventi.focus();    	
		} 
	}
	
	if ((stato == true)&&(document.theform.tipo_evento.value == "")) {
		testo = "Campo tipo evento obbligatorio";
		stato = false; 
		theform.tipo_evento.focus();    
	}
	
	if ((stato == true)&&(document.theform.ora_inserimento_eventi.value == "")) {
		testo = "Campo ora obbligatorio";
		stato = false; 
		theform.ora_inserimento_eventi.focus();    
	}
	
	
	////////////////////////////////
	
			//CONTROLLO CARATTERI VALIDI NEL LOGIN
	var valida = "0123456789:"; 	
		//aggiunggere il . o la ,
    var ok = "yes";
    var temp;

	for (var i=0; i<document.theform.ora_inserimento_eventi.value.length; i++) {
               temp = "" + document.theform.ora_inserimento_eventi.value.substring(i, i+1);
               if (valida.indexOf(temp) == "-1") ok = "no";
       }
               
      if (ok == "no") {
           testo = "Carattere non valido nel campo ora \n Vi preghiamo di inserire l'ora nel formato indicato (es: 14:33)";
            document.theform.ora_inserimento_eventi.focus();     
			stato = false;
       }	
	
	///////////////////
	
	
	if ((stato == true)&&(document.theform.luogo_inserimento_eventi.value == "")) {
		testo = "Campo luogo obbligatorio";
		stato = false; 
		theform.luogo_inserimento_eventi.focus();    
	}
	
	if ((stato == true)&&(document.theform.titolo_inserimento_eventi.value == "")) {
		testo = "Campo titolo obbligatorio";
		stato = false; 
		theform.titolo_inserimento_eventi.focus();    
	}
	
	if ((stato == true)&&(document.theform.descrizione_inserimento_eventi.value == "")) {
		testo = "Campo descrizione evento obbligatorio";
		stato = false; 
		theform.descrizione_inserimento_eventi.focus();    
	}
	
	
	if (stato == false){
		alert(" "+testo+" ")	}
		
		
		
return (stato)
}

