/*--------------------------------
  Affichage de la fenêtre d'aide
--------------------------------*/
function Aide()
{
         window.open("aide.htm", "Aide", "toolbar=no,location=false,directories=false,status=false,menubar=false,scrollbars=yes,resizable=yes,width=640,height=500,top=40,left=145");
        return;
}

/*------------------------------------------------------------------------------
        Affichage d'une nouvelle page pour choisir un mot clé dans la liste d'autorité
------------------------------------------------------------------------------*/

function index()
{
        EcranHaut = screen.availHeight;
        EcranLarg = screen.availWidth;
        haut = Math.floor(EcranHaut-50);
        gauche = Math.floor(EcranLarg-410);
  window.open("liste.asp?alpha=a", "Index", "toolbar=no,location=false,directories=false,status=false,menubar=false,scrollbars=yes,resizable=no,width=400,height="+haut+",top=0,left="+gauche);
}

/*------------------------------------------------------
        chn est une chaine de caractères.
        Retourne chn sans espaces à gauche et à droite
------------------------------------------------------*/
function Trim(chn)
{
        if (chn && chn.indexOf(" ")>=0)
        {
                var lg=chn.length;
                var nbspavt=0, nbsparr=0, lgRtrim=0;

                for(var i=0;i<lg;i++)
                        {if (chn.charAt(i)==" ") {nbspavt++}        else break}
                for(var i=lg-1;i>=0;i--)
                        {if (chn.charAt(i)==" ") {nbsparr++}        else break}
                lgRtrim=lg-nbsparr;
                return lgRtrim>nbspavt?chn.substring(nbspavt,lgRtrim):"";
        }
        return chn?chn:"";
}

/*-----------------------------------------------------------------------------
  Retourne .F. si le mot-clé saisi n'a qu'1 var. où si contient car. spéciaux
-----------------------------------------------------------------------------*/
function Verif(f)
{
        var        NbMC=0;

        champ=Trim(f.MC1.value);
        if ( champ )
        {
                if ( champ.length==1 )
                {
                         alert("Le premier mot-clé est incorrect :\nRecherche impossible");
                        f.MC1.value="";
                   f.MC1.focus();
                        return false;
                }
                else
                        NbMC++;
        }
        f.MC1.value=champ.toLowerCase();

        champ=Trim(f.MC2.value);
        if ( champ )
        {
                if ( champ.length==1 )
                {
                         alert("Le deuxième mot-clé est incorrect :\nRecherche impossible");
                        f.MC2.value="";
                   f.MC2.focus();
                        return false;
                }
                else
                        NbMC++;
        }
        f.MC2.value=champ.toLowerCase();

        champ=Trim(f.MC3.value);
        if ( champ )
        {
                if ( champ.length==1 )
                {
                         alert("Le troisième mot-clé est incorrect :\nRecherche impossible");
                        f.MC3.value="";
                   f.MC3.focus();
                        return false;
                }
                else
                        NbMC++;
        }
        f.MC3.value=champ.toLowerCase();

        f.NbMC.value=NbMC;
}