// -------------------------------------------------------------------------------------------
// Funcions per a cadenes de caracters.

// -------------------------------------------------------------------------------------------
function text_pla(cTexte)
{
 xtxt = cTexte.toLowerCase();
 xtxt = xtxt.replace(/à/i, 'a');
 xtxt = xtxt.replace(/è/i, 'e');
 xtxt = xtxt.replace(/é/i, 'e');
 xtxt = xtxt.replace(/í/i, 'i');
 xtxt = xtxt.replace(/ï/i, 'i');
 xtxt = xtxt.replace(/ò/i, 'o');
 xtxt = xtxt.replace(/ó/i, 'o');
 xtxt = xtxt.replace(/ú/i, 'u');
 xtxt = xtxt.replace(/ç/i, 'c');
 xtxt = xtxt.replace(/Ç/i, 'c');

 xtxt = xtxt.replace(/&agrave;/i, 'a');
 xtxt = xtxt.replace(/&egrave;/i, 'e');
 xtxt = xtxt.replace(/&eacute;/i, 'e');
 xtxt = xtxt.replace(/&iacute;/i, 'i');
 xtxt = xtxt.replace(/&iuml;/i,   'i');
 xtxt = xtxt.replace(/&ograve;/i, 'o');
 xtxt = xtxt.replace(/&oacute;/i, 'o');
 xtxt = xtxt.replace(/&uacute;/i, 'u');
 xtxt = xtxt.replace(/&ccedil;/i, 'c');
 return xtxt;
}

// -------------------------------------------------------------------------------------------
function fBusca(cQue, cOn, lCompara)
{
 var aOn;
 aOn = cQue.split(" ");
 nQ = aOn.length;
 if (lCompara==true)
    {
     // -------------------------------- And
     trobat = true;
     for (var nZ=0; nZ<nQ; nZ++)
          if (cOn.indexOf(aOn[nZ])>=0)
              trobat = trobat && true
          else
              trobat = trobat && false;
    }
 else
    {
     // -------------------------------- Or
     trobat = false;
     for (var nZ=0; nZ<nQ; nZ++)
          if (cOn.indexOf(aOn[nZ])>=0)
              trobat = trobat || true
          else
              trobat = trobat || false;
    }
 return trobat;
}


