function registra() {
	theForm=document.getElementById('FormRubrica');
	var consenso = document.getElementById('status_privacy1').checked;

if (theForm.nome.value == "") {
    alert("Inserire un valore per il campo \"nome e cognome\".");
    theForm.nome.focus();
    return false;
	}
if (theForm.nome.value.length < 2) {
    alert("Inserire almeno 2 caratteri nel campo \"nome\".");
    theForm.nome.focus();
    return false;
	}
if (theForm.nome.value.length > 50) {
    alert("Inserire al massimo 50 caratteri nel campo \"nome\".");
    theForm.nome.focus();
    return false;
	}

if (theForm.indirizzo.value == '') {
    alert("Inserire il vostro indirizzo.");
    theForm.indirizzo.focus();
    return false;
	}
		  
if (theForm.indirizzo.value.length > 80) {
    alert("Inserire al massimo 70 caratteri nel campo Indirizzo.");
    theForm.indirizzo.focus();
    return false;
	}
  
    prefiss=theForm.prefcell.selectedIndex;
    if ( prefiss==0 | prefiss==1 | prefiss==14 | prefiss==21 | prefiss==26 | prefiss==31 ) {
	    alert("Seleziona prefisso cellulare.");
		theForm.prefcell.focus();
		return false;
		}
	
if (theForm.numcell.value == "") {
    alert("Inserire il numero di cellulare.");
    theForm.numcell.focus();
    return false;
	}
if (theForm.numcell.value.length < 6) {
    alert("Inserire almeno 6 caratteri nel campo \"numero cellulare\".");
    theForm.numcell.focus();
    return false;
	}
if (theForm.numcell.value.length > 10) {
    alert("Inserire al massimo 10 caratteri nel campo \"numero cellulare\".");
    theForm.numcell.focus();
    return false;
	}

  var checkOK = "0123456789";
  var checkStr = theForm.numcell.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++) {
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j))
        	break;
			if (j == checkOK.length) {
				allValid = false;
				break;
			}
		}

		if (!allValid) {
			alert("Inserire solo numeri nel campo \"numero cellulare\".");
			theForm.numcell.focus();
			return false;
		}

	if(theForm.email.value == '') {
		alert('inserisci un indirizzo email');
		theForm.email.focus();
		return false;
	}
	re = new RegExp("^[!#$&'*+/-9=?A-Z^-~-]+(\\.[!#$&'*+/-9=?A-Z^-~-]+)*@[!#$&'*+/-9=?A-Z^-~-]+(\\.[!#$&'*+/-9=?A-Z^-~-]+)+$", "i");
 
	if (!theForm.email.value.match(re)) {
		alert("inserisci un indirizzo email valido");
		theForm.email.focus();
		return false;
	}
if (consenso == true ) {
	alert('se non esprimete il consenso al trattamnento dei vostri dati non potremo procedere con la registrazione');
	return false;
}    		    
	theForm.submit();

}
