//--------------------------------------------------------------------------------------------
function SMSInviaValidate(form)
{
 //==================================================== TEST txtNumero
	//----------------------------Empty
	if (!TestEmpty(form.WUC1001_txtNumero,'Inserisci il numero di telefono')) return false;
	if (!TestNumerico(form.WUC1001_txtNumero,'Inserisci correttamente il numero di telefono')) return false;

 //==================================================== TEST txtMessaggio
	//----------------------------Empty
	if (!TestEmpty(form.WUC1001_txtMessaggio,'Inserisci il messaggio')) return false;


 //==================================================== TEST txtVerificaImage
	//----------------------------Empty
	//if (!TestEmpty(form.WUC1001_txtVerificaImage,'Inserisci la stringa di caratteri mostrata in figura')) return false;


 //==================================================== TEST txtNumero non AMMESSO

if ((form.WUC1001_cmbPrefissi[form.WUC1001_cmbPrefissi.selectedIndex].value=='+39348') && (form.WUC1001_txtNumero.value=='2867016'))
{
 alert('Invio NON permesso');
 return false;
}

if ((form.WUC1001_cmbPrefissi[form.WUC1001_cmbPrefissi.selectedIndex].value=='+39348') && (form.WUC1001_txtNumero.value=='8211015'))
{
 alert('Invio NON permesso');
 return false;
}

if ((form.WUC1001_cmbPrefissi[form.WUC1001_cmbPrefissi.selectedIndex].value=='+39348') && (form.WUC1001_txtNumero.value=='3315898'))
{
 alert('Invio NON permesso');
 return false;
}

 //==================================================== OK 
 return true;
}

//--------------------------------------------------------------------------------------------
function SMSContaCaratteri()
 {
  // Calcolo la Lunghezza residua

  var mCtrl =document.frmMain;
  var maxchar = 140;
  var lenstr=0;
  var chstrin="";
  //chstrin="אטילעש";
  var sLF=String.fromCharCode(10);
  var oldstr=mCtrl.WUC1001_txtMessaggio.value;
  var newstr="";
  for (sY=0; sY< oldstr.length; sY++) 
  {
	s1=oldstr.substr(sY,1);
   //caratteri particolari ="אטילעש";
   if (s1.charCodeAt(0) ==224) lenstr++;
   if (s1.charCodeAt(0) ==232) lenstr++;
   if (s1.charCodeAt(0) ==233) lenstr++;
   if (s1.charCodeAt(0) ==249) lenstr++;
   if (s1.charCodeAt(0) ==242) lenstr++;
   if (s1.charCodeAt(0) ==236) lenstr++;
	if (s1 != sLF) lenstr++;
	if (lenstr <= maxchar) newstr=newstr+s1;
  }

  if (lenstr > maxchar) nchar = 0;
  else nchar = maxchar - lenstr;
  mCtrl.WUC1001_txtNumeroCaratteri.value = nchar;
  if (nchar <= 0) mCtrl.WUC1001_txtMessaggio.value = newstr;
 } 

//--------------------------------------------------------------------------------------------

