
function soloNumeri(campo, event)
        {
        var tasto,carattereTasto;
             if (window.event)                   
             tasto = window.event.keyCode;
             else if (event)                     
             tasto = event.which;
             else		                 
             return true;
        carattereTasto = String.fromCharCode(tasto);                                                 
          //verifica tasti particolari
        if ((tasto==null) || (tasto==0) || (tasto==8) || (tasto==9) || (tasto==13) || (tasto==27) ) //tipo canc, invio, ...
        return true;
        else if ((("0123456789").indexOf(carattereTasto) > -1))
         {
           window.status = "";
           return true;
         }
        else
         {
           window.alert("Il campo accetta solo numeri!"); 
           return false;
         }
 }

function soloNumeri2(campo, event)
        {
        var tasto,carattereTasto;
             if (window.event)                   
             tasto = window.event.keyCode;
             else if (event)                     
             tasto = event.which;
             else		                 
             return true;
        carattereTasto = String.fromCharCode(tasto);                                                 
          //verifica tasti particolari
        if ((tasto==null) || (tasto==0) || (tasto==8) || (tasto==9) || (tasto==13) || (tasto==27) ) //tipo canc, invio, ...
        return true;
        else if (((".0123456789").indexOf(carattereTasto) > -1))
         {
           window.status = "";
           return true;
         }
        else
         {
           window.alert("Il campo accetta solo numeri!"); 
           return false;
         }
 }






function validaPassword(form) {

                         
	                     if (InsPsw.Nome.value == ""  || InsPsw.Nome.value.indexOf("'") != (-1)) {
				alert("Nome non inserito o non valido");
				InsPsw.Nome.focus();
				return false;
			}
                                if (InsPsw.Login.value == "" || InsPsw.Login.value.indexOf("'") != (-1)) {
				alert("Login non inserita o  non valida");
				InsPsw.Login.focus();
				return false;
			}
                               if (InsPsw.Psw.value == "" || InsPsw.Psw.value.indexOf("'") != (-1)) {
				alert("Password non inserita o  non valida");
				InsPsw.Psw.focus();
				return false;
			}

                               
     return true
}








function validaUsato(form) {

 if (document.Usato.Nome.value == "" ) {
				alert("Nome Obbligatorio");
				document.Usato.Nome.focus();
				return false;
			}
if(document.Usato.Anno.value != ""){
if (document.Usato.Anno.value.substring(2,3) != "-" ||document.Usato.Anno.value.substring(5,6) != "-" ||isNaN(document.Usato.Anno.value.substring(0,2)) ||isNaN(document.Usato.Anno.value.substring(3,5)) ||isNaN(document.Usato.Anno.value.substring(6,10))) {
      alert("Inserire Anno in formato gg-mm-aaaa");
      document.Usato.Anno.value = "";
      document.Usato.Anno.focus();
      return false;
} else if (document.Usato.Anno.value.substring(0,2) > 31) {
   alert("Impossibile utilizzare un valore superiore a 31 per i giorni");
   document.Usato.Anno.select();
   return false;
} else if (document.Usato.Anno.value.substring(3,5) > 12) {
   alert("Impossibile utilizzare un valore superiore a 12 per i mesi");
   document.Usato.Anno.value = "";
   document.Usato.Anno.focus();
   return false;
} else if (document.Usato.Anno.value.substring(6,10) < 1900) {
   alert("Impossibile utilizzare un valore inferiore a 1900 per l'anno");
   document.Usato.Anno.value = "";
   document.Usato.Anno.focus();
   return false;
} 
}

return true
}

function validaOfferta(form) {

 if (document.Usato.Nome.value == "" ) {
				alert("Nome Obbligatorio");
				document.Usato.Nome.focus();
				return false;
			}
if (document.Usato.Descrizione.value == "" ) {
				alert("Descrizione Obbligatoria");
				document.Usato.Descrizione.focus();
				return false;
			}

return true
}

function validaPersona2(form) {


if (Anagrafica.Email.value != "") {

 Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
                                if (!Filtro.test(Anagrafica.Email.value)) {
                                alert("Email non valida.");
                                return false;
                                }
}
 if (document.Anagrafica.Nome.value == "" ) {
				alert("Nome Obbligatorio");
				document.Anagrafica.Nome.focus();
				return false;
			}

 if (document.Anagrafica.Cognome.value == "" ) {
				alert("Cognome Obbligatorio");
				document.Anagrafica.Cognome.focus();
				return false;
			}

			

return true
}



function validaAmico(form) {


if (document.App.DataV.value.substring(2,3) != "-" ||document.App.DataV.value.substring(5,6) != "-" ||isNaN(document.App.DataV.value.substring(0,2)) ||isNaN(document.App.DataV.value.substring(3,5)) ||isNaN(document.App.DataV.value.substring(6,10))) {
      alert("Inserire DataV in formato gg-mm-aaaa");
      document.App.DataV.value = "";
      document.App.DataV.focus();
      return false;
} else if (document.App.DataV.value.substring(0,2) > 31) {
   alert("Impossibile utilizzare un valore superiore a 31 per i giorni");
   document.App.DataV.select();
   return false;
} else if (document.App.DataV.value.substring(3,5) > 12) {
   alert("Impossibile utilizzare un valore superiore a 12 per i mesi");
   document.App.DataV.value = "";
   document.App.DataV.focus();
   return false;
} else if (document.App.DataV.value.substring(6,10) < 1900) {
   alert("Impossibile utilizzare un valore inferiore a 1900 per l'anno");
   document.App.DataV.value = "";
   document.App.DataV.focus();
   return false;
} 


if (document.App.DataI.value.substring(2,3) != "-" ||document.App.DataI.value.substring(5,6) != "-" ||isNaN(document.App.DataI.value.substring(0,2)) ||isNaN(document.App.DataI.value.substring(3,5)) ||isNaN(document.App.DataI.value.substring(6,10))) {
      alert("Inserire DataI in formato gg-mm-aaaa");
      document.App.DataI.value = "";
      document.App.DataI.focus();
      return false;
} else if (document.App.DataI.value.substring(0,2) > 31) {
   alert("Impossibile utilizzare un valore superiore a 31 per i giorni");
   document.App.DataI.select();
   return false;
} else if (document.App.DataI.value.substring(3,5) > 12) {
   alert("Impossibile utilizzare un valore superiore a 12 per i mesi");
   document.App.DataI.value = "";
   document.App.DataI.focus();
   return false;
} else if (document.App.DataI.value.substring(6,10) < 1900) {
   alert("Impossibile utilizzare un valore inferiore a 1900 per l'anno");
   document.App.DataI.value = "";
   document.App.DataI.focus();
   return false;
} 

 if (document.App.Amico.value == "" ) {
				alert("Nome Amico Obbligatorio");
				document.App.Amico.focus();
				return false;
			}

 if (document.App.Codice.value == "" ) {
				alert("Codice Obbligatorio");
				document.App.Codice.focus();
				return false;
			}
if (document.App.IdC.options[document.App.IdC.selectedIndex].value == "" ) {
				alert("Selezionare Cliente Valido");
				document.App.IdC.options[document.App.IdC.selectedIndex].focus();
				return false;
			}

		
return true
}





function validaNewsC(form) {



 if (document.NewsC.Titolo.value == "" ) {
				alert("Titolo Obbligatorio");
				document.NewsC.Titolo.focus();
				return false;
			}

 if (document.NewsC.Testo.value == "" ) {
				alert("Testo Obbligatorio");
				document.NewsC.Testo.focus();
				return false;
			}
		
return true
}


























