function anagrafica_age() {	var rag =  document.anag_age.rag.value;	var indirizzo =  document.anag_age.indirizzo.value;	var cap =  document.anag_age.cap.value;	var citta =  document.anag_age.citta.value;	var provincia =  document.anag_age.provincia.options[document.anag_age.provincia.selectedIndex].value;	var email =  document.anag_age.email.value;	var tel =  document.anag_age.tel.value;	var fax =  document.anag_age.fax.value;	var operatore =  document.anag_age.operatore.value;	var piva =  document.anag_age.piva.value;	var pass =  document.anag_age.pass.value;	var controllo =  document.anag_age.controllo.value;	var privacy =  document.anag_age.aut.value;	var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;		if ((rag == "") || (rag == "undefined")) {		alert("La Ragione Sociale č obbligatoria.");  document.anag_age.rag.focus();		return false;	}		else if ((indirizzo == "") || (indirizzo == "undefined")) {		alert("Devi specificare l'indirizzo.");  document.anag_age.indirizzo.focus();		return false;	}		else if ((isNaN(cap))|| (cap == "") || (cap == "undefined")) {		alert("Inserisci il CAP!");  document.anag_age.cap.focus();		return false;	}		else if ((citta == "") || (citta == "undefined")) {		alert("Hai scordato la cittā!");  document.anag_age.citta.focus();		return false;	}		else if ((provincia == "") || (provincia == "undefined")) {		alert("Hai scordato di selezionare la provincia.");  document.anag_age.provincia.focus();		return false;	}		else if ((isNaN(tel)) || (tel == "") || (tel == "undefined")) {		alert("Inserire un mumero telefonico corretto (solo numeri)."); document.anag_age.tel.select();		return false;	}	else if ((isNaN(fax)) || (fax == "") || (fax == "undefined")) {		alert("Inserire un mumero di fax corretto (solo numeri)."); document.anag_age.fax.select();		return false;	}		else if (!email_reg_exp.test(email) || (email == "") || (email == "undefined")) {		alert("Inserire un solo indirizzo email corretto.");  document.anag_age.email.select();		return false;	}		err = ControllaPIVA(piva);		if( err > '' ) {		alert("Attenzione!\n\n" + err + "\nCorreggi e riprova!");		return false;	}		else if ((operatore == "") || (operatore == "undefined") ) {		alert("Inserire il nome dell'operatore.");  document.anag_age.operatore.focus();		return false;		}		else if ((pass == "") || (pass == "undefined") || (pass.length<=5)) {		alert("La password deve contenere almento 6 caratteri.");  document.anag_age.pass.focus();		return false;	}		else if ((controllo != pass) || (controllo == "undefined") || (controllo.length<=5)) {		alert("Attenzione!\n\n La password non corrisponde!");  document.anag_age.controllo.focus();		return false;	}		else if (!document.anag_age.aut[0].checked)  {		alert("Ai sensi legge 675/1996 sul trattamento dei dati personali sensibili, la Vs mancata autorizzazione non ci permette soddisfare la richiesta");  		return false;	}				//INVIA IL MODULO	else {		document.anag_age.submit();	}}function anagrafica_age_edit() {	var rag =  document.anag_age.rag.value;	var indirizzo =  document.anag_age.indirizzo.value;	var cap =  document.anag_age.cap.value;	var citta =  document.anag_age.citta.value;	var provincia =  document.anag_age.provincia.options[document.anag_age.provincia.selectedIndex].value;	var email =  document.anag_age.email.value;	var tel =  document.anag_age.tel.value;	var fax =  document.anag_age.fax.value;	var operatore =  document.anag_age.operatore.value;	var piva =  document.anag_age.piva.value;	var privacy =  document.anag_age.aut.value;	var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;		if ((rag == "") || (rag == "undefined")) {		alert("La Ragione Sociale č obbligatoria.");  document.anag_age.rag.focus();		return false;	}		else if ((indirizzo == "") || (indirizzo == "undefined")) {		alert("Devi specificare l'indirizzo.");  document.anag_age.indirizzo.focus();		return false;	}		else if ((isNaN(cap))|| (cap == "") || (cap == "undefined")) {		alert("Inserisci il CAP!");  document.anag_age.cap.focus();		return false;	}		else if ((citta == "") || (citta == "undefined")) {		alert("Hai scordato la cittā!");  document.anag_age.citta.focus();		return false;	}		else if ((provincia == "") || (provincia == "undefined")) {		alert("Hai scordato di selezionare la provincia.");  document.anag_age.provincia.focus();		return false;	}		else if ((isNaN(tel)) || (tel == "") || (tel == "undefined")) {		alert("Inserire un mumero telefonico corretto (solo numeri)."); document.anag_age.tel.select();		return false;	}	else if ((isNaN(fax)) || (fax == "") || (fax == "undefined")) {		alert("Inserire un mumero di fax corretto (solo numeri)."); document.anag_age.fax.select();		return false;	}		else if (!email_reg_exp.test(email) || (email == "") || (email == "undefined")) {		alert("Inserire un solo indirizzo email corretto.");  document.anag_age.email.select();		return false;	}		err = ControllaPIVA(piva);		if( err > '' ) {		alert("Attenzione!\n\n" + err + "\nCorreggi e riprova!");		return false;	}		else if ((operatore == "") || (operatore == "undefined") ) {		alert("Inserire il nome dell'operatore.");  document.anag_age.operatore.focus();		return false;		}		else if (!document.anag_age.aut[0].checked)  {		alert("Ai sensi legge 675/1996 sul trattamento dei dati personali sensibili, la Vs mancata autorizzazione non ci permette soddisfare la richiesta");  		return false;	}				//INVIA IL MODULO	else {		document.anag_age.submit();	}}function ControllaPIVA(pi) {	if ((pi.length < 11) || (pi.length == ''))		return "La lunghezza della partita IVA non č\n" +			"corretta: la partita IVA dovrebbe essere lunga\n" +			"esattamente 11 caratteri.\n";	validi = "0123456789";	for( i = 0; i < 11; i++ ){		if( validi.indexOf( pi.charAt(i) ) == -1 )			return "La partita IVA contiene un carattere non valido `" +				pi.charAt(i) + "'.\nI caratteri validi sono le cifre.\n";	}	s = 0;	for( i = 0; i <= 9; i += 2 )		s += pi.charCodeAt(i) - '0'.charCodeAt(0);	for( i = 1; i <= 9; i += 2 ){		c = 2*( pi.charCodeAt(i) - '0'.charCodeAt(0) );		if( c > 9 )  c = c - 9;		s += c;	}	if( ( 10 - s%10 )%10 != pi.charCodeAt(10) - '0'.charCodeAt(0) )		return "La partita IVA non č valida:\n" +			"il codice di controllo non corrisponde.\n";	return '';}
