// ---------------------------------------------------------------------------------
// CharsCount()
// Funzione che effettua il conto dei caratteri di una textarea in tempo reale e si blocca al numero stabilito;
// ---------------------------------------------------------------------------------
	function charsCount(theField, numChars) {
	   strLen = theField.value.length;
	   if (strLen > numChars ) {
	      theField.value = theField.value.substring(0, numChars);
		  charsLeft = 0;
	   }
	   else {
	      charsLeft = numChars - strLen;
	   }
	   document.msgText.messageLength.value = charsLeft;
	}
	
function resetForm(){
		document.msgText.message.value="";
		document.msgText.messageLength.value="1000";
	}

	// ---------------------------------------------------------------------------------
	//  controllo della validità  della email
	// ---------------------------------------------------------------------------------

function ControllaMail()
   {
   EmailAddr = document.msgText.mittente.value;
   Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
   if (Filtro.test(EmailAddr)){return true;}
   else
      {
      alert("Controlla l'indirizzo e-mail inserito");
      document.msgText.mittente.focus();
      return false;
      }
   }
