function replaceAccentedLetter(s)
{
  s = s.replace(/à|á/g,"a'");
  s = s.replace(/è|é/g,"e'");
  s = s.replace(/ì|í/g,"i'");
  s = s.replace(/ò|ó/g,"o'");
  s = s.replace(/ù|ú/g,"u'");

  s = s.replace(/À|Á/g,"A'");
  s = s.replace(/È|É/g,"E'");
  s = s.replace(/Ì|Í/g,"I'");
  s = s.replace(/Ò|Ó/g,"O'");
  s = s.replace(/Ù|Ú/g,"U'");

  return(s);
}

function returnToday()
{
  var mesi = new Array(12);
  mesi[0] = "Gennaio";
  mesi[1] = "Febbraio";
  mesi[2] = "Marzo";
  mesi[3] = "Aprile";
  mesi[4] = "Maggio";
  mesi[5] = "Giugno";
  mesi[6] = "Luglio";
  mesi[7] = "Agosto";
  mesi[8] = "Settembre";
  mesi[9] = "Ottobre";
  mesi[10] = "Novembre";
  mesi[11] = "Dicembre";

  var oggi = new Date();
  giorno = oggi.getDate();
  mese = mesi[oggi.getMonth()];
  anno = oggi.getYear();
  anno2 = anno.toString().substring((anno.toString().length-2),anno.toString().length);
  return (giorno + ' ' + mese + ' 20' + anno2); 
}

function indirizzoEmailValido(indirizzo) 
{
  var nonvalido = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";
  var valido = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";
  var regnv = new RegExp(nonvalido);
  var regv = new RegExp(valido);
  if (!regnv.test(indirizzo) && regv.test(indirizzo))
    return true;
  return false;
};

function LTrim(text)
{
  if(text == null || text.length == 0)
  {
    return "";      
  }      
  idx = 0;
  while(text.charAt(idx) == ' ')
  {
    ++idx;
    if(idx >= text.length)
      break; 
  }
  if(idx < text.length)
  {
    return text.substring(idx);
  }
  else  
    return "";
}

function RTrim(text)
{
  if(text == null || text.length == 0)
  {
    return "";      
  }
  idx = text.length - 1;
  while(text.charAt(idx) == ' ')
  {
    --idx;
    if(idx < 0)
      break;
  }
  if(idx >= 0)
  {
    return text.substring(0, (idx + 1));
  }    
  else  
    return "";
}

function Trim(text)
{
  testo = LTrim(text);
  testo = RTrim(testo);
  return testo;
}
