function VF_modulo(){ 
<!--start_of_saved_settings-->
<!--type,checkbox,name,consenso,isChecked,errMsg,Per potersi iscrivere occorre  prestare \ril consenso al trattamento dei dati personali.-->
<!--type,password,name,passwordconferma,required,true,isEqualTo,password,errMsg,Le password inserite non sono uguali.-->
<!--type,password,name,password,required,true,fLen,6,12,isBadChars," ,errMsg,La password deve comprendere da 6 a 12 caratteri: lettere (a-z)&comma; numeri (0-9) e simboli. Non sono ammesi gli spazi.-->
<!--type,text,name,emailconferma,required,true,isEqualTo,email,errMsg,Le email inserite non corrispondono.-->
<!--type,text,name,email,required,true,isEmail,errMsg,Email è obbligatorio.-->
<!--type,text,name,telefono,required,true,errMsg,Telefono è obbligatorio-->
<!--type,text,name,cap,required,true,fLen,5,5,isOkChars,0123456789,errMsg,CAP è obbligatorio (5 numeri)-->
<!--type,text,name,provincia,required,true,errMsg,Provincia è obbligatorio-->
<!--type,text,name,citta,required,true,errMsg,Città è obbligatorio-->
<!--type,text,name,indirizzo,required,true,errMsg,Indirizzo è obbligatorio-->
<!--type,text,name,pIva,required,true,fLen,11,11,isOkChars,0123456789,errMsg,Partita IVA deve contenere 11 caratteri-->
<!--type,text,name,ragSoc,required,true,errMsg,Ragione Sociale è obbligatorio-->
<!--type,text,name,cognome,required,true,errMsg,Cognome è obbligatorio-->
<!--type,text,name,nome,required,true,errMsg,Nome è obbligatorio-->
<!--end_of_saved_settings-->

    var tipo=document.modulo.tipologia.value;
	var theForm = document.modulo;
	var emailRE = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
	var userRE15 = new RegExp("((\")|(\\s))+","g");
	var userRE9 = new RegExp("^((0)|(1)|(2)|(3)|(4)|(5)|(6)|(7)|(8)|(9))+$","g");
	var userRE5 = new RegExp("^((0)|(1)|(2)|(3)|(4)|(5)|(6)|(7)|(8)|(9))+$","g");
	var errMsg = "";
	var setfocus = "";

	if (!theForm['consenso'].checked){
		errMsg = "Per potersi iscrivere occorre  prestare \\ril consenso al trattamento dei dati personali\.";
		setfocus = "['consenso']";
	}
	if (theForm['passwordconferma'].value == "" || (theForm['passwordconferma'].value != theForm['password'].value)){
		errMsg = "Le password inserite non sono uguali\.";
		setfocus = "['passwordconferma']";
	}
	if ((theForm['password'].value == "") || (userRE15.test(theForm['password'].value)) || (theForm['password'].value.length < 6 || theForm['password'].value.length > 12)){
		errMsg = "La password deve comprendere da 6 a 12 caratteri: lettere \(a\-z\), numeri \(0\-9\) e simboli\. Non sono ammesi gli spazi\.";
		setfocus = "['password']";
	}
	if (theForm['emailconferma'].value == "" || (theForm['emailconferma'].value != theForm['email'].value)){
		errMsg = "Le email inserite non corrispondono\.";
		setfocus = "['emailconferma']";
	}
	if (!emailRE.test(theForm['email'].value)){
		errMsg = "Email è obbligatoria\.";
		setfocus = "['email']";
	}
	if (theForm['telefono'].value == ""){
		errMsg = "Telefono è obbligatorio";
		setfocus = "['telefono']";
	}
	if ((theForm['cap'].value == "") || (!userRE9.test(theForm['cap'].value)) || (theForm['cap'].value.length < 5 || theForm['cap'].value.length > 5)){
		errMsg = "CAP è obbligatorio \(5 numeri\)";
		setfocus = "['cap']";
	}
	if (theForm['provincia'].value == ""){
		errMsg = "Provincia è obbligatorio";
		setfocus = "['provincia']";
	}
	if (theForm['citta'].value == ""){
		errMsg = "Città è obbligatorio";
		setfocus = "['citta']";
	}
	if (theForm['indirizzo'].value == ""){
		errMsg = "Indirizzo è obbligatorio";
		setfocus = "['indirizzo']";
	}
	
	if(tipo==1){
	
	if ((theForm['pIva'].value == "") || (!userRE5.test(theForm['pIva'].value)) || (theForm['pIva'].value.length < 11 || theForm['pIva'].value.length > 11)){
		errMsg = "Partita IVA deve contenere 11 caratteri";
		setfocus = "['pIva']";
	}

	if ((theForm['codiceFiscale'].value == "") || (theForm['codiceFiscale'].value.length < 11) || (theForm['codiceFiscale'].value.length > 16)){
		errMsg = "Il codice fiscale deve contenere fra o 11 o 16 caratteri";
		setfocus = "['codiceFiscale']";
	}
	
    if (theForm['ragSoc'].value == ""){
		errMsg = "Ragione Sociale è obbligatorio";
		setfocus = "['ragSoc']";
	}
    
    if (theForm['cognome'].value == ""){
		errMsg = "Il cognome del rappresentante legale è obbligatorio";
		setfocus = "['cognome']";
	}
	if (theForm['nome'].value == ""){
		errMsg = "Il nome del rappresentante legale è obbligatorio";
		setfocus = "['nome']";
	}


	}
    
    if(tipo==2){
	
	    
	if ((theForm['codiceFiscale'].value == "") || (theForm['codiceFiscale'].value.length < 16) || (theForm['codiceFiscale'].value.length > 16)){
		errMsg = "Il codice fiscale deve contenere 16 caratteri";
		setfocus = "['codiceFiscale']";
	}

    if (theForm['cognome'].value == ""){
		errMsg = "Cognome è obbligatorio";
		setfocus = "['cognome']";
	}
	if (theForm['nome'].value == ""){
		errMsg = "Nome è obbligatorio";
		setfocus = "['nome']";
	}

	}
	  



	
	
	
	if (errMsg != ""){
		alert(errMsg);
		eval("theForm" + setfocus + ".focus()");
	}
	else theForm.submit();
}

function scelta(valore){
var test=valore;
document.modulo.tipologia.value=test;
if(test==1){
var uno = document.getElementById('uno');
uno.style.display="inline";
var due = document.getElementById('due');
due.style.display="none";

}
if(test==2){
var uno = document.getElementById('uno');
uno.style.display="none";
var due = document.getElementById('due');
due.style.display="inline";

}
}



