		function inviaForm(field){
			
			var f = field.form;
			if (validateForm(f)) {
				
				if (self.beforeSending) {
					beforeSending();
				}
				f.submit();
			}
		}

		function validateForm(theForm) {
				var els = theForm.elements;
				
				if (!self.validate) return (true);
				for  (i=0;i<els.length;i++) {
					el = els[i];
					
					if (validate[el.name]) {
						bOK = validateField(el,captions[el.name],validate[el.name]);
						if (!bOK) return (false);
					}

				}

				return (true);
		}

		function validateField(theField, theCaption, theValidation) {
			theVal = theField.value; //occhio con campi di altri tipi
			
			if (theValidation.indexOf('nonempty') != -1) {
					if (theVal == '') {
						alert ("Il campo \"" + theCaption + "\" e' obbligatorio");
						theField.focus();
						return (false);
					}
			}
			
			if (theValidation.indexOf('date') != -1) {
					if (theVal != '') {
						if ((theVal.length != 10) || (theVal.substr(2,1)!='/') || (theVal.substr(5,1)!='/')) {
							alert ("Specificare la data del campo \"" + theCaption + "\" nel formato gg/mm/aaaa.");
							theField.focus();
							return(false);
						}

						if ((theVal.substr(0,2) > 31) || (theVal.substr(0,2) == 0) || (theVal.substr(3,2) > 12) || (theVal.substr(3,2) == 0)  || (theVal.substr(6,4) == 0)) {
							alert ("E' stato immesso un valore non valido per il giorno o per il mese o per l'anno.");
							theField.focus();
							return(false);
						}
					}
			}
			
			if (theValidation.indexOf('number') != -1) {
					if (theVal != '') {
						sCheck = theVal.replace(/\./gi,"");
						sCheck = sCheck.replace(/,/gi,".");

						if (isNaN(sCheck)) {
							alert ("Specificare un numero nel campo \"" + theCaption + "\".");
							theField.focus();
							return;
						}
						if (sCheck.indexOf(".") != -1) {
							dec = sCheck.substr(sCheck.indexOf(".")+1);
							if (dec.length > 2) {
								alert ("Nel campo \"" + theCaption + "\" e' possibile specificare al massimo 2 cifre decimali.");
								theField.focus();
								return;
							}
						}
					}
			}

			if (theValidation.indexOf('percent') != -1) {
					if (theVal != '') {

						if (theVal.indexOf(".") != -1 || theVal.indexOf(",") != -1) {
							alert ("Nel campo \"" + theCaption + "\" non sono ammesse cifre decimali.");
							theField.value = "";
							theField.focus();
							return;
						}

						if (isNaN(theVal)) {
							alert ("Specificare un numero nel campo \"" + theCaption + "\".");
							theField.value = "";
							theField.focus();
							return;
						}

						if (Number(theVal) == 0 || Number(theVal) < 0) {
							alert ("La percentuale inserita non puņ essere negativa o pari a zero.");
							theField.value = "";
							theField.focus();
							return;
						}

						if (Number(theVal) > 100) {
							alert ("La percentuale inserita non puņ essere maggiore di 100.");
							theField.value = "";
							theField.focus();
							return;
						}
					}
			}
			return (true);
		}