	function invia() {
		conf=Convalida();
		if (conf==true) {
			document.registra.submit();
		}
	}

	function Convalida() {
	
		if (document.registra.nome.value.length < 2) {
			alert ("ATTENZIONE: inserire un Nome!");
			document.registra.nome.focus();
			return false;
		}

		if (document.registra.indirizzo.value.length < 2) {
			alert ("ATTENZIONE: inserire un indirizzo!");
			document.registra.indirizzo.focus();
			return false;
		}
		
		if (document.registra.citta.value.length < 2) {
			alert ("ATTENZIONE: inserire una Cittą!");
			document.registra.citta.focus();
			return false;
		}		

		if (document.registra.telefono.value.length < 5) {
			alert ("ATTENZIONE: inserire un numero di telefono valido!");
			document.registra.telefono.focus();
			return false;
		}

		
		if (document.registra.email.value.length < 3) {
			alert ("ATTENZIONE: inserire un E-Mail valida!");
			document.registra.email.focus();
			return false;
		}
		
		var okay = true;
		var atsign = document.registra.email.value;
		if (((atsign.indexOf('@') == -1) && (okay == true)) || ((okay == true) && (atsign == '')) || ((atsign.indexOf('.') == -1) && (okay == true)) ){
			alert ("ATTENZIONE: Specificare una E-mail valida!");
			okay = false;
			document.registra.email.focus();
			return false;
		}
		
		if (document.registra.prodotto.value=="0") {
			alert ("ATTENZIONE: Selezionare un prodotto!");
			document.registra.prodotto.focus();
			return false;
		}		
		
		
		if (document.registra.messaggio.value.length < 10) {
			alert ("ATTENZIONE: Scrivere un messaggio da inviare a Metalmax!");
			document.registra.messaggio.focus();
			return false;
		}		

		if (document.registra.privacy.checked!=true) {
			alert ("Per proseguire devi accettare l'informativa sulla Privacy");
			return false;
		}



		
		return true;
	}
	
function AccettaNumeri() 
{
		if (event.keyCode < 48 || event.keyCode > 57) 
		{
			event.keyCode = 0;
		}
		return true ;
}


function sceltaprodotti(){
	
	if (document.registra.prodotto.value=="prod_non_pres"){
		apritabella("prodottinuovi")
	}
	else {
		chiuditabella("prodottinuovi")
	}
}



function apri(section) 
{
	/*location.href="#top"*/
	if (controllo(section)) 
	{
		chiuditabella(section);
	}	
	else
	{
		apritabella(section);	
	}
}

function apritabella(section)
{
	var tbody = document.getElementById(section);
	if (tbody == null) return;
	tbody.style.display = "";

}

function chiuditabella(section)
{
	var tbody = document.getElementById(section);
	if (tbody == null) return;
	tbody.style.display = "none";
}

function controllo(section)
{
	var tbody = document.getElementById(section);
	if (tbody == null) return 0;
	return (tbody.style.display == "");
}

