    jQuery.extend(jQuery.validator.messages, {
                        required: "Campo obbligatorio.",
                        remote: "Controlla questo campo.",
                        email: "email non valida.",
                        url: "Inserisci un indirizzo web valido.",
                        date: "Inserisci una data valida.",
                        dateISO: "Inserisci una data valida (ISO).",
                        number: "Numero non valido.",
                        digits: "Inserisci solo numeri.",
                        creditcard: "Inserisci un numero di carta di credito valido.",
                        equalTo: "Il valore non corrisponde.",
                        accept: "Inserisci un valore con un&apos;estensione valida.",
                        maxlength: jQuery.validator.format("Non selezionare pi&ugrave; di {0} province."),
                        minlength: jQuery.validator.format("Inserisci almeno {0} caratteri."),
                        rangelength: jQuery.validator.format("Inserisci un valore compreso tra {0} e {1} caratteri."),
                        range: jQuery.validator.format("Inserisci un valore compreso tra {0} e {1}."),
                        max: jQuery.validator.format("Inserisci un valore minore o uguale a {0}."),
                        min: jQuery.validator.format("Inserisci un valore maggiore o uguale a {0}.")
                    });
     jQuery.validator.addMethod("codicedfiscale", function( value, element ) {
               var cf = value;
               var result = 1;
               var validi, i, s, set1, set2, setpari, setdisp;

                cf = cf.toUpperCase();
                if( cf.length != 16 )
                        result = 0;
                    validi = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
                for( i = 0; i < 16; i++ ){
                if( validi.indexOf( cf.charAt(i) ) == -1 )
                   result = 0;
                 }
                set1 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
                set2 = "ABCDEFGHIJABCDEFGHIJKLMNOPQRSTUVWXYZ";
                setpari = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
                setdisp = "BAKPLCQDREVOSFTGUHMINJWZYX";
                s = 0;
                    for( i = 1; i <= 13; i += 2 )
                         s += setpari.indexOf( set2.charAt( set1.indexOf( cf.charAt(i) )));
                    for( i = 0; i <= 14; i += 2 )
                         s += setdisp.indexOf( set2.charAt( set1.indexOf( cf.charAt(i) )));
                if( s%26 != cf.charCodeAt(15)-'A'.charCodeAt(0) )
                    result = 0;


                if (cf=='')
                    result = 1;

               	if (!result) {
		//	element.value = "";
			var validator = this;
			setTimeout(function() {
				validator.blockFocusCleanup = true;
				element.focus();
				validator.blockFocusCleanup = false;
			}, 1);
		}
		return result;
                }, "Il codice fiscale non &egrave; corretto");

        jQuery.validator.addMethod("pics", function( value, element ) {
                if (eval(value)>=3 && eval(value)<=10)
                        result =1;
                    else
                        result = 0;

               	if (!result) {
			//element.value = "";
			var validator = this;
			setTimeout(function() {
				validator.blockFocusCleanup = true;

				validator.blockFocusCleanup = false;
			}, 1);
		}
		return result;
                }, "Devi caricare da 3 a 10 fotografie");

                     


          jQuery.validator.addMethod("telefono", function( value, element ) {
             
                    value+=''
         
                    result =(value.length>=8 || value.length==0) ? 1 : 0;
               	if (!result) {

			var validator = this;
			setTimeout(function() {
				validator.blockFocusCleanup = true;

				validator.blockFocusCleanup = false;
			}, 1);
		}
		return result;
                }, "Minimo 8 cifre accettate");



            jQuery.validator.addMethod("disponibile_come", function( value, element ) {

             var k = 0;

                $('.disponibile_come').each(function(){
                    if($(this).attr('checked')==true)
                           k++;
                });

                result = (k<=10 || k==1) ? 1 : 0;

               	if (!result) {
			//element.value = "";
			var validator = this;
			setTimeout(function() {
				validator.blockFocusCleanup = true;
				element.focus();
				validator.blockFocusCleanup = false;
			}, 1);
		}
		return result;
                }, "");

             jQuery.validator.addMethod("provincie", function( value, element ) {

             var k = 0;

                $('.provincie').each(function(){
                    if($(this).attr('checked')==true)
                           k++;
                });

                result = (k<=6 || k==1) ? 1 : 0;

               	if (!result) {
			//element.value = "";
			var validator = this;
			setTimeout(function() {
				validator.blockFocusCleanup = true;
				element.focus();
				validator.blockFocusCleanup = false;
			}, 1);
		}
		return result;
                }, "");

              jQuery.validator.addMethod("citta", function( value, element ) {

                 var result =($('#istat').val()=='' ) ? false : true;

               	if (!result) {
			//element.value = "";
			var validator = this;
			setTimeout(function() {
				validator.blockFocusCleanup = true;
                                element.focus();
				validator.blockFocusCleanup = false;
			}, 1);
		}
		return result;
                }, "inserire solo i valori proposti");


                jQuery.validator.addMethod("eta", function( value, element ) {
                    if (eval(value)>=22 && eval(value)<=65 ) result = true ; else result = false;
               	if (!result) {
			//element.value = "";
			var validator = this;
			setTimeout(function() {
				validator.blockFocusCleanup = true;
				validator.blockFocusCleanup = false;
			}, 1);
		}
		return result;
                }, "Et&agrave; richiesta da 22 a 65 anni");
