/*------------------------------------------------------
/* société : Unilog IT Services a LogicaCMG company    */
/* Auteur  : Stéphane Anet                             */
/*                                                     */
/* date : 20/06/2005                                   */
/*---------------------------------------------------- */

// recherche en cours appel depuis menu
function rC(location)
{
  document.getElementById("travail_en_cours").innerHTML= "<font size='+1'>&nbsp;&nbsp;&nbsp;&nbsp;Travail en cours&nbsp;... &nbsp;&nbsp;&nbsp;&nbsp;</font>";
  window.location = location;
}

// fiche cheptel
function ficheCHEPTEL(nombreformulaire, cpt, nameNumero, libelleCheptel)
{
  valueCopach = eval("document.forms[" + nombreformulaire + "].elements[" + cpt + "].value");
  valueNuchep = eval("document.forms[" + nombreformulaire + "]." + nameNumero +".value");

  if(valueCopach.length == 0 ||
     valueNuchep == 0)
  {
      alert("Le code pays et numéro " + libelleCheptel + " doivent être renseignés simultanément");
  }
  else
  {
     var location1 = "goService.do?serviceID=10000190&menuID=Me2&action=rechercher_up_c_id.do";
     location1 += "&copach=" + valueCopach + "&nuchep=" + valueNuchep;
     openWindowCenter3(location1);
  }
}

// fiche animal
function ficheANIMAL(nombreformulaire, cpt, nameNumero, libelleAnimal)
{
  valueCopaip = eval("document.forms[" + nombreformulaire + "].elements[" + cpt + "].value");
  valueNunati = eval("document.forms[" + nombreformulaire + "]." + nameNumero +".value");

  if(valueCopaip.length == 0 ||
     valueNunati == 0)
  {
      alert("Le code pays et numéro " + libelleAnimal + " doivent être renseignés simultanément")
  }
  else
  {
     var location1 = "goService.do?serviceID=10000010&menuID=Me1&action=rechercher_up_a_id.do";
     location1 += "&COPAIP=" + valueCopaip + "&NUNATI=" + valueNunati;
     openWindowCenter3(location1);
  }
}

// open window centré 3
function openWindowCenter3(url)
{
    popup_window3 = window.open('','myWindow2','width=1000, height=800, left='+(screen.width-1000)/2+', top='+(screen.height-800)/2+', resizable=no, scrollbars=yes, toolbars=no, location=no, directories=no, status=no, menubar=no, copyhistory=no');
    popup_window3.document.write("<html><body style='background: url(images/fonds/FOND_VISU.GIF)'><table width='100%' height='100%'><tr><td align='center' style='vertical-align: middle;'><span style='color: rgb(255, 0, 0);'> <b><br><br><br><br><H2>Travail en cours ...</H2></b></span></td></tr></table></body></html>");
    popup_window3.location = url;
    popup_window3.focus();
}



// disabled objet
function disableObjet(obj)
{
   obj.disabled = !(obj.disabled);
  (obj.disabled) ? 'disabled' : 'enabled';
}

// ajout blanc zone coprut
function AjoutBlancCoprut(formulaire)
{
   if(formulaire.login.value.length > 0 && formulaire.login.value.length < 12)
   {
      nbrBlanc = 12 - formulaire.login.value.length;
      valeur = formulaire.login.value;
      for(cpt=0;cpt < nbrBlanc; cpt++)
      {
            valeur += " ";
      }
      formulaire.login.value = valeur;
   }
}

// modification de l'action et submit formulaire
function modifActionsubmitFormulaire(action, formulaire, target)
{
   travailEnCours();
   // ouverture Popup
   openWindowModificationCenter();
   objFormulaire = eval(formulaire);
   objFormulaire.action = action;
   if(target != "")
   {
      objFormulaire.target = target;
   }

   objFormulaire.submit();
}

// submit formulaire
function submitFormulaire(formulaire)
{
   objFormulaire = eval(formulaire);
   objFormulaire.submit();
   return true;
}

// check Service visualisation
function chServiceVisu(oid)
{
   champServ = eval("document.getElementById('" + oid + "')");
   begin=oid.length -1;
   end  = oid.length;
   oidDernDigit = oid.substring(begin , end);

   if(oidDernDigit == 1)
   {
       // service visualisation
       begin=0;
       end = oid.length -1;
       oidServRac = oid.substring(begin , end);
       if(champServ.checked == false)
       {
          // si décoché on décoche tout
          for(cpt=0;cpt <10; cpt++)
          {
             if(eval("document.getElementById('" + oidServRac + cpt + "')") != null)
             {
                champServ = eval("document.getElementById('" + oidServRac + cpt + "')");
                champServ.checked = false;
             }
             else
             {
                cpt=10;
             }
          }
       }
       else
       {
          // on coche le service parent
          champServ = eval("document.getElementById('" + oidServRac + "0" + "')");
          champServ.checked = true;
       }
   }
   else if(champServ.checked == true)
   {
      // service coché le service visu doit être coché
      // oid du serviceVisu
      begin=0;
      end = oid.length -1;
      oidServRac = oid.substring(begin , end);
      // oid du service visu se termine par 1
      oidServVisu = oidServRac + "1";
      // oid du service parent se termine par 0
      oidServ = oidServRac + "0";
      champServVisu = eval("document.getElementById('" + oidServVisu + "')")
      champServVisu.checked = true;
      champServ = eval("document.getElementById('" + oidServ + "')")
      champServ.checked = true;
   }



}

// uncheck Sous service (1,2,3,4 ...)
function unSS(oid)
{
   champServ = eval("document.getElementById('" + oid + "')");
   begin=0;
   end = oid.length -1;
   oidServRac = oid.substring(begin , end);

   if(champServ.checked == false)
   {
      // décoché les sous services
      for(cpt=0;cpt <10; cpt++)
      {
         if(eval("document.getElementById('" + oidServRac + cpt + "')") != null)
         {
            champServ = eval("document.getElementById('" + oidServRac + cpt + "')");
            champServ.checked = false;
         }
         else
         {
            cpt=10;
         }
      }
   }
   else
   {
       // on coche le service visualisation
      champServVisu = eval("document.getElementById('" + oidServRac + "1" +"')")
      champServVisu.checked = true;
   }
}
// initialisation des champs inputs
function initChampValue(nomChamp, valeur, nomForm)
{
   champForm = eval("document." + nomForm + "." + nomChamp);
   if(champForm.value == "")
   {
      champForm.value = valeur;
   }
}

// variables globales
appelDepuisRejet = "non";

// reload page
function reloadPage()
{
  var navigateur = "";

  if ( navigator.userAgent.indexOf('Opera 5') != -1 )
  { navigateur = "opera";}

  else if ( navigator.userAgent.indexOf('MSIE') != -1 )
  {
     // navigateur ie
     if(getCookie("pageReload") == null)
     {
        // création cookie
        setCookie("pageReload","oui");
        // reload page
        window.location.reload();
     }
     else
     {
        // suppression cookie
        delCookie("pageReload");
     }
  }

  else if ( navigator.userAgent.indexOf('Mozilla') != -1 )
  { navigateur = "mozilla";}

  else {navigateur = "inconnu";}
}
// fermeture fenêtre
function ClosePopup_window(nomFenetre)
{
  try
  {
    if (eval(nomFenetre) != null)
    {
      throw "ok";
    }
  }
  catch (exep)
  {
    if (exep=="ok")
    {
      eval(nomFenetre + ".close()");
      return true;
    }
    else
    {
      return true;
    }
  }
}
// open window modiifcation centrée
function openWindowModificationCenter()
{
    popup_windowModification = window.open('','WindowModification','width=1, height=1, left=10, top=10, resizable=yes, scrollbars=yes, toolbars=no, location=no, directories=no, status=no, menubar=no, copyhistory=no');
    popup_windowModification.document.write("<html><script>window.opener.focus();</script></html>");
    //popup_windowModification.focus();
}
// open window centré 1
function openWindowCenter1()
{
    popup_window1 = window.open('','myWindow1','width=1000, height=800, left='+(screen.width-1000)/2+', top='+(screen.height-800)/2+', resizable=no, scrollbars=yes, toolbars=no, location=no, directories=no, status=no, menubar=no, copyhistory=no');
    popup_window1.document.write("<html><body style='background: url(images/fonds/FOND_VISU.GIF)'><table width='100%' height='100%'><tr><td align='center' style='vertical-align: middle;'><span style='color: rgb(255, 0, 0);'> <b><br><br><br><br><H2>Travail en cours ...</H2></b></span></td></tr></table></body></html>");
    popup_window1.focus();
}
// open window centré 2
function openWindowCenter2()
{
    popup_window2 = window.open('','myWindow2','width=1000, height=800, left='+(screen.width-1000)/2+', top='+(screen.height-800)/2+', resizable=no, scrollbars=yes, toolbars=no, location=no, directories=no, status=no, menubar=no, copyhistory=no');
    popup_window2.document.write("<html><body style='background: url(images/fonds/FOND_VISU.GIF)'><table width='100%' height='100%'><tr><td align='center' style='vertical-align: middle;'><span style='color: rgb(255, 0, 0);'> <b><br><br><br><br><H2>Travail en cours ...</H2></b></span></td></tr></table></body></html>");
    popup_window2.focus();
}

// suppression caractères spéciaux
function titre_saisie_criteres()
{
  document.write("<h1 class='titre_saisie_criteres'>" + document.title + "</h1>");
}

function supCarDivers(chaine)
{
  // on cherche les caractères spéciaux et on les transforme
  chaine = RemplaceChaine(chaine,"&lt;","<") ;
  chaine = RemplaceChaine(chaine,"&gt;",">") ;
  chaine = RemplaceChaine(chaine,"&#39;","'") ;

  return(chaine);
}

// suppression caractères spéciaux
function supCarSpec(chaine)
{
  // on cherche les caractères spéciaux et on les transforme
  chaine = RemplaceChaine(chaine,"&eacute;","é") ;
  chaine = RemplaceChaine(chaine,"&#233;","é") ;
  chaine = RemplaceChaine(chaine,"&egrave;","è") ;
  chaine = RemplaceChaine(chaine,"&#232;","è") ;
  chaine = RemplaceChaine(chaine,"&ecirc;","ê") ;
  chaine = RemplaceChaine(chaine,"&#234;","ê") ;
  chaine = RemplaceChaine(chaine,"&agrave;","à") ;
  chaine = RemplaceChaine(chaine,"&#224;","à") ;
  chaine = RemplaceChaine(chaine,"&ordm;","°") ;
  chaine = RemplaceChaine(chaine,"&#186;","°") ;
  chaine = RemplaceChaine(chaine,"&ccedil;","ç") ;
  chaine = RemplaceChaine(chaine,"&#231;","ç") ;
  return(chaine);
}

// filtre message d'alerte
function filtreAlert(msg)
{
  // on cherche les caractères spéciaux et on les transforme
  msg = RemplaceChaine(msg,"&eacute;","é") ;
  msg = RemplaceChaine(msg,"&#233;","é") ;
  msg = RemplaceChaine(msg,"&egrave;","è") ;
  msg = RemplaceChaine(msg,"&#232;","è") ;
  msg = RemplaceChaine(msg,"&ecirc;","ê") ;
  msg = RemplaceChaine(msg,"&#234;","ê") ;
  msg = RemplaceChaine(msg,"&agrave;","à") ;
  msg = RemplaceChaine(msg,"&#224;","à") ;
  msg = RemplaceChaine(msg,"&ordm;","°") ;
  msg = RemplaceChaine(msg,"&#186;","°") ;
  msg = RemplaceChaine(msg,"&ccedil;","ç") ;
  msg = RemplaceChaine(msg,"&#231;","ç") ;
  alert(msg);
}
// modifie couleur balise tr (ligne) sur évènement onmouseover
function changeCouleur_tr(ligne)
{
  ligne.bgColor = '#c3f1ac';
}
// modifie couleur balise tr (ligne)onmouseout
function remetCouleur_tr(ligne)
{
  ligne.bgColor = '#FFFFFF';
}
// gestion du menu sur clique droit
function Menu_clique_droit(Menu,X, Y)
{
  // Menu : id du menu
  // X    : coordonnées X de la souris
  // Y    : coordonnées Y de la souris
  var obj_Menu = eval("document.getElementById('" + Menu + "')");

  obj_Menu.style.left= X;
  obj_Menu.style.top= Y;
  obj_Menu.style.visibility="visible";
}

// affichage du fichier d'aide
function affichageAide(nomFichierAide)
{
  fenetreCent('aides/' + nomFichierAide +'.html','AIDE', '500','300', 'toolbar=0,location=,directories=0,status=1,scrollbars=1,resizable=1,copyhistory=0,menuBar=0');
}

// affichage popup nomenclature
function affichageNomenclature(nomNomenclature, nomInput, nomFormulaire, titre, hauteurDiv, colSizeCode, colSizeLibelle, positionLeft)
{
  if(nomInput != "" &&
    nomFormulaire != "")
  {
    if(eval(nomFormulaire + "." + nomInput + ".disabled") == true)
    {
       alert("zone inactive, saisie champ interdit !");
       return false;
    }
  }
  var largeur = parseInt(colSizeCode) + parseInt(colSizeLibelle) + 30;
  var hauteur = parseInt(hauteurDiv) + 15;
  // fenetreCent('afficherNomenclature.do?nomenclature' + nomNomenclature + '&nomInput=' + nomInput +  '&nomFormulaire=' + nomFormulaire + '&titre=' + titre + '&hauteurDiv=' + hauteurDiv  + '&largeurCode=' + colSizeCode+'&largeurLibelle=' + colSizeLibelle +  '&positionLeft=' + positionLeft ,'AIDE', largeur,hauteur, 'toolbar=0,location=,directories=0,status=1,scrollbars=1,resizable=1,copyhistory=0,menuBar=0');

  var nouvelle_fenetre = window.open('afficherNomenclature.do?nomenclature=' + nomNomenclature + '&nomInput=' + nomInput +  '&nomFormulaire=' + nomFormulaire + '&titre=' + titre + '&hauteurDiv=' + hauteurDiv  + '&largeurCode=' + colSizeCode+'&largeurLibelle=' + colSizeLibelle +  '&positionLeft=' + positionLeft, "nomenclature" + nomNomenclature, "menubar=0,resizable=0,scrollbars=1,width=" + largeur + ",height=" + hauteur + ",top=300,left=350" + "defaultstatus='Fenetre ouverte'");
  if (parseInt(navigator.appVersion) > 2)
  {
    nouvelle_fenetre.focus();
  }
}
// verification existence cheptel
function existenceCheptel(codePays, numeroCheptel)
{
  var nouvelle_fenetre = window.open('verifierCheptelValide.do?pays=' + codePays + '&cheptel=' + numeroCheptel, "verification", "menubar=0,resizable=0,scrollbars=0,width=" + 1 + ",height=" + 1  + ",top=400,left=280"  + "defaultstatus='Fenetre ouverte'");
  if (parseInt(navigator.appVersion) > 2)
  {
    nouvelle_fenetre.focus();
  }
}
// verification des droits sur suppression cheptel de groupe cheptel
function VerifDroitCheptelSuppression(codePays, numeroCheptel)
{
  var nouvelle_fenetre = window.open('verifierDroitCheptelSuppression.do?pays=' + codePays + '&cheptel=' + numeroCheptel, "verification", "menubar=0,resizable=0,scrollbars=0,width=" + 1 + ",height=" + 1  + ",top=400,left=280"  + "defaultstatus='Fenetre ouverte'");
  if (parseInt(navigator.appVersion) > 2)
  {
    nouvelle_fenetre.focus();
  }
}
// rajout cheptel supprime
function ajoutCheptelEnSuppression()
{
  var cleCheptelSupprimer = window.opener.document.saisieGroupeCheptelFB.memoPays.value + window.opener.document.saisieGroupeCheptelFB.memoNumero.value;
  cleCheptelSupprimer = RemplaceChaine(cleCheptelSupprimer," ","");
  addOptionToOpener(window.opener.document.saisieGroupeCheptelFB.clesCheptels, cleCheptelSupprimer, cleCheptelSupprimer);
}

function addOptionToOpener(Listbox, Text, Value)
{
  var oOption = window.opener.document.createElement("option");
  oOption.text = Text;
  oOption.value = Value;
  Listbox.options[Listbox.options.length] = oOption;
}

// appel générer fonction
function gFct(damaba, numaba)
{
  var propriete = "top=0,left=0,resizable=no,";
  propriete += "toolbar=no, scrollbars=yes, menubar=no, location=no, statusbar=no"
  propriete += ",width=" + screen.width + ",height=" + screen.height;

  var nouvelle_fenetre = window.open('appelerGenererFonction.do?damaba=' + damaba + '&numaba=' + numaba, "générer fonction", propriete);
  if (parseInt(navigator.appVersion) > 2)
  {
    nouvelle_fenetre.focus();
  }
}
// rejet cheptel depuis écran rejet pour un cheptel
function RtCh(copach,nuchep)
{
  var location1 = "rechercher_up_g_rjt_chep.do?copach=" + copach + "&nuchep=" + nuchep;
  document.location.href=location1;

}


// rejet cheptel depuis écran liste des rejets cheptel
function RtCh(copach,nuchep)
{
  var location1 = "rechercher_up_g_rjt_chep_liste.do?copach=" + copach + "&nuchep=" + nuchep;
  document.location.href=location1;

}
// supprimer rejet
function SupprimerRejet()
{
  if (!(getSelectedRadioValue(document.forms['up_g_rjt_rejetFB'].choix)))
  {
    alert("Vous devez sélectionner un rejet.");
    return false;
  }

  // récupération de la sélection
  for (i=0;i<document.forms['up_g_rjt_rejetFB'].length;i++)
  {
    if (document.forms['up_g_rjt_rejetFB'][i].checked==true)
    {
      var valeur =document.forms['up_g_rjt_rejetFB'][i].value;
    }
  }

  var TabNomPages = valeur.split(';');
  var redirect = TabNomPages[0];
  var damaba   = TabNomPages[1];
  var numaba   = TabNomPages[2];

  var locationNv = "supprimer_up_g_rjt.do?redirect=" + redirect + "&damaba=" + damaba + "&numaba=" + numaba;
  document.location.href=locationNv;
}
// visualiser rejet
function VisualiserRejet()
{
  var indiceSelection;

  if (!(getSelectedRadioValue(document.forms['up_g_rjt_rejetFB'].choix)))
  {
    alert("Vous devez sélectionner un rejet.");
    return false;
  }
  // récupération de la sélection
  for (i=0;i<document.forms['up_g_rjt_rejetFB'].length;i++)
  {
    if (document.forms['up_g_rjt_rejetFB'][i].checked==true)
    {
      var valeur =document.forms['up_g_rjt_rejetFB'][i].value;
      indiceSelection = i;
      // sorti de la boucle
      i=document.forms['up_g_rjt_rejetFB'].length;
    }
  }
  // récupération des paramètres
  var TabNomPages = valeur.split(';');
  var redirect = TabNomPages[0];
  var damaba   = TabNomPages[1];
  var numaba   = TabNomPages[2];
  // récupération de adrsex (appel externe)
  // appel externe ?
  if(matAdrsex[indiceSelection].length > 0)
  {
      // appel externe ouverture popup
      openWindowCenter1();
      document.forms['up_g_rjt_rejetFB'].target='myWindow1';
      // récupération user et appli (cookies)
      var user = getCookie("login");

      document.forms['up_g_rjt_rejetFB'].action=matAdrsex[indiceSelection]+ "?user=" + user + "&damaba=" + damaba + "&numaba=" + numaba;
      document.forms['up_g_rjt_rejetFB'].submit();
  }
  else
  {
      travailEnCours();

      var locationNv = "appelerGenererFonction.do?redirect=" + redirect + "&damaba=" + damaba + "&numaba=" + numaba;
      document.location.href=locationNv;
   }
   // initialisation target
   document.forms['up_g_rjt_rejetFB'].target='_self';

}
//Ouverture d'une fenetre de popup, avec url, hauteur et largeur en parametres
function openPopup(src, largeur, hauteur)
{
  var nouvelle_fenetre = window.open(src, "nouvelle_fenetre", "menubar=0,resizable=0,scrollbars=1,width=" + largeur + ",height=" + hauteur + ",top=200,left=300" + "defaultstatus='Fenetre ouverte'");
  if (parseInt(navigator.appVersion) > 2)
  {
    nouvelle_fenetre.focus();
  }
}
// ouverture d'une nouvelle fenêtre
function fenetreCent(url,nom,largeur,hauteur,options)
{
  var haut=(screen.height-hauteur)/2;
  var Gauche=(screen.width-largeur)/2;
  fencent=window.open(url,nom,"top="+haut+",left="+Gauche+",width="+largeur+",height="+hauteur+","+options);
}
// date du jour format jj/mm/aaaa
function dateDuJour()
{
  var now = new Date();
  var jour = now.getDate();
  var mois = now.getMonth() + 1;
  var annee = now.getFullYear();

  if(jour < 10)
  {
    jour = '0' + jour;
  }
  if(mois < 10)
  {
    mois = '0' + mois;
  }

  var date = "";
  date = jour+'/' + mois +'/'+annee;
  return(date);
}
// formatage de la date jj/mm/aaaa
function formatageDate(nom_form, nom_date)
{
  var champ_date = eval( "document." + nom_form + "." + nom_date);
  var valueDate = champ_date.value;
  var lgDate = champ_date.value.length;

  // cas de * (annulation de la date)
  if(lgDate == 1 &&
     valueDate == "*")
  {
     return true;
  }
  // cas de * (la saisie de charactères est rendu impossible après le char *)
  if(lgDate == 2 &&
     valueDate[0] == "*")
  {
     champ_date.value = "*";
     return true;
  }


  var dateFormate = "";
  var jour = "";
  var mois = "";
  var annee = "";
  // vérification chiffre autorisés
  if(lgDate > 0)
  {
    var lastChar  = eval("valueDate.substring(" + (lgDate - 1) + "," + lgDate + ")");

    if(lastChar != "0" &&
       lastChar != "1" &&
       lastChar != "2" &&
       lastChar != "3" &&
       lastChar != "4" &&
       lastChar != "5" &&
       lastChar != "6" &&
       lastChar != "7" &&
       lastChar != "8" &&
       lastChar != "9" &&
       lastChar != "/")
    {
      // suppression du charactere rentre
      champ_date.value = eval("valueDate.substring(0," + (lgDate - 1)+")");
      return true;
    }
  }
  if(lgDate == 2)
  {
    jour  = valueDate.substring(0,2);
    if(jour > 31)
    {
      alert("valeur jour incorecte compris entre 0 et 31");
      champ_date.value = "";
      return true;
    }
    dateFormate = jour+'/';
    champ_date.value = dateFormate;
  }
  else if(lgDate == 5)
  {
    jour  = valueDate.substring(0,2);
    mois  = valueDate.substring(3,5);
    if(mois > 12)
    {
      alert("valeur mois incorecte compris entre 1 et 12");
      dateFormate = jour+'/';
      champ_date.value = dateFormate;
      return true;
    }
    dateFormate = jour+'/'+mois+'/';
    champ_date.value = dateFormate;
  }
  else if(lgDate == 8)
  {
    jour  = valueDate.substring(0,2);
    mois  = valueDate.substring(3,5);
    annee = valueDate.substring(6,8);
    var anneeF = 0;
    if(annee > 50)
    {
      anneeF = '19' + annee;
    }
    else
    {
      anneeF = '20' + annee;
    }
    dateFormate = jour+'/'+mois+'/'+ anneeF;
    champ_date.value = dateFormate;
  }
  return true;
}


// formatage de la date jj/mm/aaaa  speudo date (blanc admis)
function formatageSpeudoDate(nom_form, nom_date)
{
  var champ_date = eval( "document." + nom_form + "." + nom_date);
  var valueDate = champ_date.value;
  var lgDate = champ_date.value.length;

  var dateFormate = "";
  var jour = "";
  var mois = "";
  var annee = "";
  // vérification chiffre autorisés
  if(lgDate > 0)
  {
    var lastChar  = eval("valueDate.substring(" + (lgDate - 1) + "," + lgDate + ")");

    if(lgDate  < 6)
    {
      if(lastChar != " " &&
         lastChar != "0" &&
         lastChar != "1" &&
         lastChar != "2" &&
         lastChar != "3" &&
         lastChar != "4" &&
         lastChar != "5" &&
         lastChar != "6" &&
         lastChar != "7" &&
         lastChar != "8" &&
         lastChar != "9" &&
         lastChar != "/")
      {
        // suppression du charactere rentre
        champ_date.value = eval("valueDate.substring(0," + (lgDate - 1)+")");
        return true;
      }
    }
    else
    {
      if(lastChar != "0" &&
         lastChar != "1" &&
         lastChar != "2" &&
         lastChar != "3" &&
         lastChar != "4" &&
         lastChar != "5" &&
         lastChar != "6" &&
         lastChar != "7" &&
         lastChar != "8" &&
         lastChar != "9" &&
         lastChar != "/")
      {
        // suppression du charactere rentre
        champ_date.value = eval("valueDate.substring(0," + (lgDate - 1)+")");
        return true;
      }
    }
  }
  if(lgDate == 2)
  {
    jour  = valueDate.substring(0,2);
    if(jour > 31 || jour != "  ")
    {
      alert("valeur jour incorecte compris entre 0 et 31 OU BLANC");
      champ_date.value = "";
      return true;
    }
    dateFormate = jour+'/';
    champ_date.value = dateFormate;
  }
  else if(lgDate == 5)
  {
    jour  = valueDate.substring(0,2);
    mois  = valueDate.substring(3,5);
    if(mois > 12 || jour != "  ")
    {
      alert("valeur mois incorecte compris entre 1 et 12 OU BLANC");
      dateFormate = jour+'/';
      champ_date.value = dateFormate;
      return true;
    }
    dateFormate = jour+'/'+mois+'/';
    champ_date.value = dateFormate;
  }
  else if(lgDate == 8)
  {
    jour  = valueDate.substring(0,2);
    mois  = valueDate.substring(3,5);
    annee = valueDate.substring(6,8);
    var anneeF = 0;
    if(annee > 50)
    {
      anneeF = 1900 + parseInt(annee);
    }
    else
    {
      anneeF = 2000 + parseInt(annee);
    }
    dateFormate = jour+'/'+mois+'/'+ anneeF;
    champ_date.value = dateFormate;
  }
  return true;
}
function dateInfEgaldatedujour(dateParam, message)
{
  <!-- dateParam format jj/mm/aaaa -->
  var jourParam = Number(dateParam.substring(0,2));
  var moisParam = Number(dateParam.substring(3,5));
  var anneeParam = Number(dateParam.substring(6,10));
  var Somme1 = jourParam+moisParam*100+anneeParam*10000;
  <!-- date du jour -->
  date_jour = new Date();
  var dtJour_jour = Number(date_jour.getDate());
  var dtJour_mois = Number(date_jour.getMonth()+1);
  var dtJour_annee = Number(date_jour.getFullYear());
  var Somme2 = dtJour_jour+dtJour_mois*100+dtJour_annee*10000;
  if(Somme2 < Somme1)
  {
    alert("Date " + message + " invalide : supérieure à date du jour");
    return false ;
  }
  else
  {
    return true;
  }
}
function date2Supdate1(dateParam2, dateParam1)
{
  <!-- date 1 format jj/mm/aaaa -->
  var jour1 = Number(dateParam1.substring(0,2));
  var mois1 = Number(dateParam1.substring(3,5));
  var annee1 = Number(dateParam1.substring(6,10));
  var Somme1 = jour1+mois1*100+annee1*10000;
  <!-- date 2 jj/mm/aaaa -->
  var jour2 = Number(dateParam2.substring(0,2));
  var mois2 = Number(dateParam2.substring(3,5));
  var annee2 = Number(dateParam2.substring(6,10));
  var Somme2 = jour2+mois2*100+annee2*10000;
  if(Somme2 <= Somme1)
  {
    return false;
  }
  else
  {
    return true;
  }
}
function date2SupEgaldate1(dateParam2, dateParam1)
{
  if((dateParam1 != "" &&
      dateParam2 == "") ||
      (dateParam1 == "" &&
      dateParam2 != ""))
  {
     return true;
  }
  <!-- date 1 format jj/mm/aaaa -->
  var jour1 = Number(dateParam1.substring(0,2));
  var mois1 = Number(dateParam1.substring(3,5));
  var annee1 = Number(dateParam1.substring(6,10));
  var Somme1 = jour1+mois1*100+annee1*10000;
  <!-- date 2 jj/mm/aaaa -->
  var jour2 = Number(dateParam2.substring(0,2));
  var mois2 = Number(dateParam2.substring(3,5));
  var annee2 = Number(dateParam2.substring(6,10));
  var Somme2 = jour2+mois2*100+annee2*10000;
  if(Somme2 < Somme1)
  {
    return false;
  }
  else
  {
    return true;
  }
}

// string buffer
StringBuilder = function()
{
  this.aStr = new Array();
  this.add = function( inVAL )
  {
    this.aStr[this.aStr.length] = inVAL;
  }
  this.build = function()
  {
    return this.aStr.join("");
  }
  this.init = function()
  {
    this.aStr = null;
    this.aStr = new Array();
  }
}
// affichage de lien pour retour sur des service
function AffRetourPage()
{
  /*  récupération des cookies */
  var NomPages      = getCookie("pgNomPages");
  var NomParametres = getCookie("pgNomParametres");
  var ValParametres = getCookie("pgValParametres");
  var NomActions    = getCookie("pgNomActions");
  if( NomPages != null)
  {
    /* ----------------------- lien vers page à afficher ------------------------ */
    /* variable tableau */
    var TabNomPages      = NomPages.split('#');
    var TabEnsNomParametres = NomParametres.split('#');
    var TabEnsValParametres = ValParametres.split('#');
    var TabNomActions    = NomActions.split('#');
    var TabParametres = new Array();
    var nbrLien = TabNomPages.length;
    for(var cpt=0; cpt<nbrLien; cpt++)
    {
      /* valorisation du tableau des parametres */
      var TabNomParametres = TabEnsNomParametres[cpt].split(',');
      /* valorisation du tableau des variables */
      var TabValParametres = TabEnsValParametres[cpt].split(',');
      /* valorisation des paramètres */
      TabParametres[cpt]= TabNomParametres[0] + "=" +   TabValParametres[0];
      for(var cpt2=1; cpt2<TabNomParametres.length; cpt2++)
      {
        TabParametres[cpt]+= "&" + TabNomParametres[cpt2] + "=" +   TabValParametres[cpt2];
      }
    }
    for(var cpt = nbrLien -1; cpt == nbrLien -1; cpt--)
    {
      lien = RemplaceChaine(TabNomPages[cpt]," ", "&nbsp;");
      if(TabNomActions[cpt] == "closeme")
      {
        // close la fenetre
        document.write("<div id='retourpage' style='position:absolute;left:780px;top:30px;'><table><tr><td class='retourService' title='RETOUR " + lien + "'><a href='#' class='retour' onClick=\"window.close();\">" + lien +  "</a></td></tr></table></div>");
      }
      else if(TabNomActions[cpt].indexOf("serviceID",0) >= 0)
      {
        // goService
        document.write("<div id='retourpage' style='position:absolute;left:780px;top:30px;'><table><tr><td class='retourService' title='RETOUR " + lien + "'><a href='#' class='retour' onClick=\"retourPg(href='" + TabNomActions[cpt] + "&" + TabParametres[cpt] + "'," + cpt +")\";>" + lien +  "</a></td></tr></table></div>");
      }
      else
      {
        // action classique
        document.write("<div id='retourpage' style='position:absolute;left:780px;top:30px;'><table><tr><td class='retourService' title='RETOUR " + lien + "'><a href='#' class='retour' onClick=\"retourPg(href='" + TabNomActions[cpt] + "?" + TabParametres[cpt] + "'," + cpt +")\";>" + lien +  "</a></td></tr></table></div>");
      }
    }
  }
}
// suppression d un lien retour
function suppressionLienRetour(nomAction)
{
  // récupération des cookies
  var NomPages      = getCookie("pgNomPages");
  var NomParametres = getCookie("pgNomParametres");
  var ValParametres = getCookie("pgValParametres");
  var NomActions    = getCookie("pgNomActions");

  if(NomPages != null)
  {

    var TabNomPages         = NomPages.split('#');
    var TabEnsNomParametres = NomParametres.split('#');
    var TabEnsValParametres = ValParametres.split('#');
    var TabNomActions       = NomActions.split('#');
    if(TabNomPages.length == 1)
    {
      if(TabNomActions[0] == 'closeme')
      {
        // suppression du cookie
        delCookie("pgNomPages");
        delCookie("pgNomParametres");
        delCookie("pgValParametres");
        delCookie("pgNomActions");
      }
    }
    else
    {
      ValnomPages      =  "";
      ValnomParametres =  "";
      ValvalParametres =  "";
      ValnomActions    =  "";
      for(var cpt=0; cpt<TabNomPages.length; cpt++)
      {
        if(TabNomActions[cpt] != 'closeme')
        {
          ValnomPages      += '#' + TabNomPages[cpt];
          ValnomParametres += '#' + TabEnsNomParametres[cpt];
          ValvalParametres += '#' + TabEnsValParametres[cpt];
          ValnomActions    += '#' + TabNomActions[cpt];
        }
      }
      setCookie("pgNomPages",     ValnomPages);
      setCookie("pgNomParametres",ValnomParametres);
      setCookie("pgValParametres",ValvalParametres);
      setCookie("pgNomActions",   ValnomActions);
    }
  }
}
function retourPg(lienRetour, indiceCookie)
{
  // affichage travail en cours
  document.getElementById("travail_en_cours").innerHTML= "<font size='+1'>&nbsp;&nbsp;&nbsp;&nbsp;Travail en cours&nbsp;... &nbsp;&nbsp;&nbsp;&nbsp;</font>";

  // suppression de ce lien au niveau de l'historique
  var NomPages      = getCookie("pgNomPages");
  var NomParametres = getCookie("pgNomParametres");
  var ValParametres = getCookie("pgValParametres");
  var NomActions    = getCookie("pgNomActions");
  var TabNomPages         = NomPages.split('#');
  var TabEnsNomParametres = NomParametres.split('#');
  var TabEnsValParametres = ValParametres.split('#');
  var TabNomActions       = NomActions.split('#');
  if(TabNomPages.length == 1)
  {
    // suppression des cookies
    delCookie("pgNomPages");
    delCookie("pgNomParametres");
    delCookie("pgValParametres");
    delCookie("pgNomActions");
  }
  else
  {
    ValnomPages      =  TabNomPages[0];
    ValnomParametres =  TabEnsNomParametres[0];
    ValvalParametres =  TabEnsValParametres[0];
    ValnomActions    =  TabNomActions[0];
    for(var cpt=1; cpt<TabNomPages.length; cpt++)
    {
      if(cpt != indiceCookie)
      {
        ValnomPages      += '#' + TabNomPages[cpt];
        ValnomParametres += '#' + TabEnsNomParametres[cpt];
        ValvalParametres += '#' + TabEnsValParametres[cpt];
        ValnomActions    += '#' + TabNomActions[cpt];
      }
    }
    setCookie("pgNomPages",     ValnomPages);
    setCookie("pgNomParametres",ValnomParametres);
    setCookie("pgValParametres",ValvalParametres);
    setCookie("pgNomActions",   ValnomActions);
    // redirection vers la page souhaitée

    document.location=(lienRetour);
  }
}
// remplacement chaine de charactère
// expr : chaine de charactère
// a : chaine à trouver
// b : chaine de remplacement
function RemplaceChaine(expr,a,b)
{
  var i=0;
  while (i!=-1)
  {
    i=expr.indexOf(a,i);
    if (i>=0)
    {
      expr=expr.substring(0,i)+b+expr.substring(i+a.length);
      i+=b.length;
    }
  }
  return expr;
}
function getEltByID(id)
{
  return document.getElementById(id)
}

// travail en cours
function travailEnCours()
{
  document.getElementById("travail_en_cours").innerHTML= "<font size='+1'>&nbsp;&nbsp;&nbsp;&nbsp;Travail en cours&nbsp;... &nbsp;&nbsp;&nbsp;&nbsp;</font>";
  return true;
}
// travail en cours reset
function travailEnCoursReset()
{
  document.getElementById("travail_en_cours").innerHTML= "";
  return true;
}
// recherche en cours ==  travail en cours
function rechercheEnCours()
{
  document.getElementById("travail_en_cours").innerHTML= "<font size='+1'>&nbsp;&nbsp;&nbsp;&nbsp;Travail en cours&nbsp;... &nbsp;&nbsp;&nbsp;&nbsp;</font>";
}


// récupére la valeur du bouton radio sélectionné.
function getSelectedRadioValue (radiobutton)
{
  var returnValue = "";

  if (radiobutton.value)
  {

    returnValue = radiobutton.value;
    if (radiobutton.checked==true)
    {
      returnValue = true;
    }
    else
    {
      returnValue = false;
    }
  }
  else
  {
    for (i=0;i<radiobutton.length;i++)
    {
      if (radiobutton[i].checked==true)
      {
        returnValue=radiobutton[i].value;
      }
    }
  }
  return returnValue;
}
// transformation string to int
function StringToInt(chaine)
{
  var a = new Array();
  for (var i = 0; i < chaine.length; i++)
  {
    a[i] = chaine.charCodeAt(i);
  }
  return a;
}
// boîte de confirmation (exemple confirmation suppression)
function msgConfirmation(msg, action, documentForm)
{
  // msg obligatoire
  // action et documentForm non obligatoire (vide possible)
  var chaineMessage = "";
  documentForm = RemplaceChaine(documentForm,"'","S1");
  chaineMessage = chaineMessage + "<img src='images/divers/interogation.gif'>" + "&nbsp;" + msg + " ?";
  chaineMessage = chaineMessage + "<br><br>";
  if(documentForm.length > 0 &&
     action != "noAction")
  {
    // on envoi le formulaire (action corespond à une action) si on confirme sinon on cache la div
    chaineMessage = chaineMessage + "&nbsp;&nbsp;<input type='image' id='nokConfirm' src='images/divers/nokConfirm.gif' onclick='document.getElementById(\"msgConfirmation\").style.visibility = \"hidden\";' style='border: none;'/>";
    chaineMessage = chaineMessage + "&nbsp;&nbsp;<input type='image' id='okConfirm' src='images/divers/okConfirm.gif' onclick='soumissionForm(\"" + action + "\",\"" + documentForm + "\");' style='border: none;'/>";
  }
  else if(action.length > 0 &&
          action != "noAction")
  {
    // on cache la div si annuler sinon appel de la fonction (le paramètre action contient la fonction a appeler)
    chaineMessage = chaineMessage + "&nbsp;&nbsp;<input type='image' id='nokConfirm' src='images/divers/nokConfirm.gif' onclick='document.getElementById(\"msgConfirmation\").style.visibility = \"hidden\";' style='border: none;'/>";
    chaineMessage = chaineMessage + "&nbsp;&nbsp;<input type='image' id='okConfirm' src='images/divers/okConfirm.gif' onclick='document.getElementById(\"msgConfirmation\").style.visibility = \"hidden\";window.location.href=\"" + action +"\";' style='border: none;'/>";
  }
  else if(action == "noAction")
  {
    // on cache la div si annuler sinon on appel la fonction script submitFormulaire
    chaineMessage = chaineMessage + "&nbsp;&nbsp;<input type='image' id='nokConfirm' src='images/divers/nokConfirm.gif' onclick='document.getElementById(\"msgConfirmation\").style.visibility = \"hidden\";' style='border: none;'/>";
    chaineMessage = chaineMessage + "&nbsp;&nbsp;<input type='image' id='okConfirm' src='images/divers/okConfirm.gif' onclick='document.getElementById(\"msgConfirmation\").style.visibility = \"hidden\";submitFormulaire(\"" + documentForm + "\");' style='border: none;'/>";
  }
  document.getElementById('msgConfirmation').innerHTML= chaineMessage;
  document.getElementById('msgConfirmation').style.visibility = "visible";
  document.getElementById('nokConfirm').focus();
  window.scrollTo(0,0);
}
// boîte confirmation d'une suppression
function msgConfirmationSuppresion(formulaire)
{
  var chaineMessage = "";
  chaineMessage = chaineMessage + "<img src='images/divers/interogation.gif'>" + "&nbsp;" + "Confirmation de la suppression" + " ?";
  chaineMessage = chaineMessage + "<br><br>";

  chaineMessage = chaineMessage + "&nbsp;&nbsp;<input type='image' id='nokConfirm' src='images/divers/nokConfirm.gif' onclick='document.getElementById(\"msgConfirmation\").style.visibility = \"hidden\";'/>";
  chaineMessage = chaineMessage + "&nbsp;&nbsp;<input type='image' id='okConfirm' src='images/divers/okConfirm.gif'   onclick='document.getElementById(\"msgConfirmation\").style.visibility = \"hidden\"; submitFormulaire(\"" + formulaire + "\");'/>";

  document.getElementById('msgConfirmation').innerHTML= chaineMessage;
  document.getElementById('msgConfirmation').style.visibility = "visible";
  document.getElementById('nokConfirm').focus();
}
// boîte de confirmation suppression rejet
function msgConfirmationRejet(msg, action, documentForm)
{

  if (!(getSelectedRadioValue(document.forms['up_g_rjt_rejetFB'].choix)))
  {
    alert("Vous devez sélectionner un rejet.");
    return false;
  }

  // récupération de la sélection
  for (i=0;i<document.forms['up_g_rjt_rejetFB'].length;i++)
  {
    if (document.forms['up_g_rjt_rejetFB'][i].checked==true)
    {
      var valeur =document.forms['up_g_rjt_rejetFB'][i].value;
    }
  }

  var TabNomPages = valeur.split(';');
  var redirect = TabNomPages[0];
  var damaba   = TabNomPages[1];
  var numaba   = TabNomPages[2];

  var locationNv = "supprimer_up_g_rjt.do?redirect=" + redirect + "&damaba=" + damaba + "&numaba=" + numaba;

  // pour affichage de la boite de dialogue
  var chaineMessage = "";
  chaineMessage = chaineMessage + "<img src='images/divers/interogation.gif'>" + "&nbsp;" + msg + " ?";
  chaineMessage = chaineMessage + "<br><br>";

  // on cache la div si annuler sinon on retourne false et on cache la boîte de dialogue
  chaineMessage = chaineMessage + "&nbsp;&nbsp;<input type='image' id='nokConfirm' src='images/divers/nokConfirm.gif' onclick='document.getElementById(\"msgConfirmation\").style.visibility = \"hidden\";return false;' style='border: none;'/>";
  chaineMessage = chaineMessage + "&nbsp;&nbsp;<input type='image' id='okConfirm' src='images/divers/okConfirm.gif' onclick='document.getElementById(\"msgConfirmation\").style.visibility = \"hidden\";travailEnCours();documentLocation(\"" + locationNv + "\");' style='border: none;'/>";

  document.getElementById('msgConfirmation').innerHTML= chaineMessage;
  document.getElementById('msgConfirmation').style.visibility = "visible";
  document.getElementById('nokConfirm').focus();

}
// boîte de confirmation suppression rejet à partir de générer fonction
function msgConfirmationRejetGenFct(parDamaba,parNumaba,redirection)
{

  appelDepuisRejet = "oui";
  var redirect = redirection;
  redirect = RemplaceChaine(redirect,".do?",".doSEP") ;
  redirect = RemplaceChaine(redirect,"&","SEP") ;
  redirect = RemplaceChaine(redirect,"amp;","") ;
  var damaba   = parDamaba;
  var numaba   = parNumaba;


  var locationNv = "supprimer_up_g_rjt.do?redirect=" + redirect + "&damaba=" + damaba + "&numaba=" + numaba;

  // pour affichage de la boite de dialogue
  var msg = "confirmation de la suppression";
  var chaineMessage = "";
  chaineMessage = chaineMessage + "<img src='images/divers/interogation.gif'>" + "&nbsp;" + msg + " ?";
  chaineMessage = chaineMessage + "<br><br>";

  // on cache la div si annuler sinon on retourne false et on cache la boîte de dialogue
  chaineMessage = chaineMessage + "&nbsp;&nbsp;<img id='nokConfirm' src='images/divers/nokConfirm.gif' onclick='document.getElementById(\"msgConfirmation\").style.visibility = \"hidden\";return false;' style='border: none;'/>";
  chaineMessage = chaineMessage + "&nbsp;&nbsp;<img id='okConfirm' src='images/divers/okConfirm.gif' onclick='document.getElementById(\"msgConfirmation\").style.visibility = \"hidden\";travailEnCours();documentLocation(\"" + locationNv + "\");' style='border: none;'/>";


  document.getElementById('msgConfirmation').innerHTML= chaineMessage;
  document.getElementById('msgConfirmation').style.visibility = "visible";
  document.getElementById("nokConfirm").focus();
}
// document location
function documentLocation(locationDocument)
{
  document.location.href =locationDocument;
}
// submit d'un formulaire
function soumissionForm(action, documentForm)
{
  document.getElementById('msgConfirmation').style.visibility = "hidden";
  document.getElementById("travail_en_cours").innerHTML= "<font size='+1'>&nbsp;&nbsp;&nbsp;&nbsp;Travail en cours&nbsp;... &nbsp;&nbsp;&nbsp;&nbsp;</font>";
  clignotement();
  documentForm = RemplaceChaine(documentForm,"S1","'");
  eval(documentForm + ".action = \"" + action + "\"");
  eval(documentForm + ".submit()");
}
// affichage de la date du jour
function DateDuJour()
{
  var csChaine;
  var nJour, nMois, nAnnee, nHeures , nMinutes, nSecondes;
  var dtJour;
  csChaine = " ";
  dtJour = new Date();
  nJour = dtJour.getDate();
  if ( nJour < 10 ) csChaine += "0";
  csChaine += nJour;
  nMois = dtJour.getMonth() + 1;
  if (nMois == 1) csChaine += " Janvier";
  else if (nMois == 2) csChaine += " Février";
  else if (nMois == 3) csChaine += " Mars";
  else if (nMois == 4) csChaine += " Avril";
  else if (nMois == 5) csChaine += " Mai";
  else if (nMois == 6) csChaine += " Juin";
  else if (nMois == 7) csChaine += " Juillet";
  else if (nMois == 8) csChaine += " Août";
  else if (nMois == 9) csChaine += " Septembre";
  else if (nMois == 10) csChaine += " Octobre";
  else if (nMois == 11) csChaine += " Novembre";
  else if (nMois == 12) csChaine += " Décembre";
  csChaine += " ";
  nAnnee = dtJour.getFullYear();
  csChaine += nAnnee;
  document.write( "<b><font color='#000000' size='2'>" + "le " + csChaine + "</font></b>");
}
// impression du document
function impressionPage()
{
  document.write("<div style='position:absolute;left:950px;top:65px;'>");
  document.write("<a href='javascript:window.print();' accesskey='I'><img src='images/divers/print.gif' title='impression page' border='0'></a>");
  document.write("</div>");
}
// ouverture fenêtre qui contient les données à imprimer(div id="zoneImpression")
function impressionZoneImpression()
{
    var windowOpen = window.open('','myWindow2','width=1000, height=600, left='+(screen.width-1000)/2+', top='+(screen.height-600)/2+', resizable=yes, scrollbars=yes, toolbars=no, location=no, directories=no, status=no, menubar=yes, copyhistory=yes');
    windowOpen.document.write("<html><body style='background: url(images/fonds/FOND_VISU.GIF)'><table width='100%' height='100%'><tr><td align='center' style='vertical-align: middle;'><span style='color: rgb(255, 0, 0);'> <b><br><br><br><br><H2>Travail en cours ...</H2></b></span></td></tr></table></body></html>");
    windowOpen.location = "impressionZone.do";
    windowOpen.focus();
}

// ouverture fenêtre lien
function ouvertureFenetreLien(lien)
{
    var windowOpen = window.open('','myWindow3','width=1000, height=600, left='+(screen.width-1000)/2+', top='+(screen.height-600)/2+', resizable=yes, scrollbars=yes, toolbars=no, location=no, directories=no, status=no, menubar=yes, copyhistory=yes');
    windowOpen.document.write("<html><body style='background: url(images/fonds/FOND_VISU.GIF)'><table width='100%' height='100%'><tr><td align='center' style='vertical-align: middle;'><span style='color: rgb(255, 0, 0);'> <b><br><br><br><br><H2>Travail en cours ...</H2></b></span></td></tr></table></body></html>");
    windowOpen.location = "uploadPDF.do" + "?nomPDF=" + lien;
    windowOpen.focus();
}

// ouverture fenêtre lien menu
function ouvertureFenetreLien2(lien)
{
    var windowOpen = window.open('','myWindow4','width=1000, height=600, left='+(screen.width-1000)/2+', top='+(screen.height-600)/2+', resizable=yes, scrollbars=yes, toolbars=no, location=no, directories=no, status=no, menubar=yes, copyhistory=yes');
    windowOpen.document.write("<html><body style='background: url(images/fonds/FOND_VISU.GIF)'><table width='100%' height='100%'><tr><td align='center' style='vertical-align: middle;'><span style='color: rgb(255, 0, 0);'> <b><br><br><br><br><H2>Travail en cours ...</H2></b></span></td></tr></table></body></html>");
    windowOpen.location = "uploadPDF2.do" + "?nomPDF=" + lien;
    windowOpen.focus();
}

// rendre tous les champs input d'un formulaire inactif
function inactif_input_form(numeroFormulaire)
{
  var nombre = document.forms[numeroFormulaire].elements.length;


  for(cpt=0;cpt< nombre;cpt++)
  {
    if(document.forms[numeroFormulaire].elements[cpt] != undefined)
    {
      if(document.forms[numeroFormulaire].elements[cpt].type == "text" ||
         document.forms[numeroFormulaire].elements[cpt].type == "password" ||
         document.forms[numeroFormulaire].elements[cpt].type == "select-one" ||
         document.forms[numeroFormulaire].elements[cpt].type == "select-multiple")
      {
        obj_zone= document.forms[numeroFormulaire].elements[cpt];
        // rendre saisie impossible
        obj_zone.disabled = true;
      }
    }
  }
}

// appel Service depuis rejet (pop_up)
function apRejServ(pageAppele, valeurs)
{
  // suppression des caractères spéciaux dans nom de la page
  nomPages= supCarSpec(nomPages);

  // affichage travail en cours
  document.getElementById("travail_en_cours").innerHTML= "<font size='+1'>&nbsp;&nbsp;&nbsp;&nbsp;Travail en cours&nbsp;... &nbsp;&nbsp;&nbsp;&nbsp;</font>";

  var param ="";

  // valorisation des cookies pour gestion du retour
  var pg_NomPages      = getCookie("pgNomPages");
  var pg_NomParametres = getCookie("pgNomParametres");
  var pg_ValParametres = getCookie("pgValParametres");
  var pg_NomActions    = getCookie("pgNomActions");


  if(pg_NomPages != null)
  {
    setCookie("pgNomPages", pg_NomPages + '#' + nomPages);
    setCookie("pgNomParametres", pg_NomParametres + '#' + nomParametres);
    setCookie("pgValParametres", pg_ValParametres + '#' + valParametres);
    setCookie("pgNomActions", pg_NomActions + '#' + nomActions);

  }
  else
  {
    setCookie("pgNomPages",nomPages);
    setCookie("pgNomParametres",nomParametres);
    setCookie("pgValParametres",valParametres);
    setCookie("pgNomActions",nomActions);
  }

  // valorisation pour redirection de la page
  var nomParam    = eval(pageAppele + "Par.split(',')");
  var valeurParam = valeurs.split(',');

  param = nomParam[0] + "=" + valeurParam[0];

  for(var cpt=1; cpt < (nomParam.length); cpt ++)
  {
     param = param + "&" + nomParam[cpt] + "=" + valeurParam[cpt];
  }
  var debug=false;
  if(debug == true)
  {
    alert("action: " + pageAppele);
    alert("paramètres : " + param);
    alert("lien: "  + eval(pageAppele) + "&" + param);
  }
  var propriete = "top=0,left=0,resizable=no,";
  propriete += "toolbar=no, scrollbars=yes, menubar=no, location=no, statusbar=no"
  propriete += ",width=" + screen.width + ",height=" + screen.height;

  var nouvelle_fenetre = window.open(eval(pageAppele) + "&" + param, "", propriete);
  if (parseInt(navigator.appVersion) > 2)
  {
    nouvelle_fenetre.focus();
  }
}

// appel gestion fonction
function apGestionFonction(pageAppele)
{
  // suppression des caractères spéciaux dans nom de la page
  nomPages= supCarSpec(nomPages);

  // affichage travail en cours
  document.getElementById("travail_en_cours").innerHTML= "<font size='+1'>&nbsp;&nbsp;&nbsp;&nbsp;Travail en cours&nbsp;... &nbsp;&nbsp;&nbsp;&nbsp;</font>";


  var debug=false;
  if(debug == true)
  {
    alert("action: " + pageAppele);
  }
  var screenWidth  = (screen.width -1000)/2;
  var screenHeight  = (screen.height-800)/2;

  var propriete = "resizable=no,";
  propriete += "toolbar=no, scrollbars=yes, menubar=no, location=no, statusbar=no"
  propriete += ",width=1000,height=800," + "left= " + screenWidth + ",top=" + screenHeight;

  var nouvelle_fenetre = window.open(pageAppele, "myWindow1", propriete);
  if (parseInt(navigator.appVersion) > 2)
  {
    nouvelle_fenetre.focus();
  }
}

// appel valider appliquer depuis generé fct appeler par un rejet
function validerAppliquer(actionForm, memoRedirect, damaba, numaba)
{
  document.getElementById("travail_en_cours").innerHTML= "<font size='+1'>&nbsp;&nbsp;&nbsp;&nbsp;Travail en cours&nbsp;... &nbsp;&nbsp;&nbsp;&nbsp;</font>";
  var redirect = actionForm;
  var memoRedirect = memoRedirect;
  var location1 =  redirect + "?aprej=O&memoRedirect=" + memoRedirect + "&damaba=" + damaba + "&numaba=" + numaba;

  document.forms[0].action = location1;
  openWindowModificationCenter();
  document.forms[0].submit();
}

function clignotement()
{
   window.onerror = null;
  var bName = navigator.appName;
  var bVer = parseInt(navigator.appVersion);
  var NS4 = (bName == "Netscape" && bVer >= 4);
  var IE4 = (bName == "Microsoft Internet Explorer"
  && bVer >= 4);
  var NS3 = (bName == "Netscape" && bVer < 4);
  var IE3 = (bName == "Microsoft Internet Explorer" && bVer < 4);
  var blink_speed=100;
  var i=0;

  if (NS4 || IE4) {
  if (navigator.appName == "Netscape") {
  layerStyleRef="layer.";
  layerRef="document.layers";
  styleSwitch="";
  }else{
  layerStyleRef="layer.style.";
  layerRef="document.all";
  styleSwitch=".style";
  }
  }

  // Clignotement
  function Blink(layerName){
  if (NS4 || IE4) {
  if(i%2==0)
  {
  eval(layerRef+'["'+layerName+'"]'+
  styleSwitch+'.visibility="visible"');
  }
  else
  {
  eval(layerRef+'["'+layerName+'"]'+
  styleSwitch+'.visibility="hidden"');
  }
  }
  if(i<1)
  {
  i++;
  }
  else
  {
  i--
  }
  setTimeout("Blink('"+layerName+"')",blink_speed);
  }
}
// trim à droite
function droiteTrim(sString)
{
while (sString.substring(sString.length-1, sString.length) == ' ')
{
sString = sString.substring(0,sString.length-1);
}
return sString;
}

// détermine si une case a coche est cochée
function caseACocheEstCoche(radiobutton)
{
  var returnValue = "";

  if (radiobutton.value)
  {

    returnValue = radiobutton.value;
    if (radiobutton.checked==true)
    {
      returnValue = true;
    }
    else
    {
      returnValue = false;
    }
  }
  else
  {
    for (i=0;i<radiobutton.length;i++)
    {
      if (radiobutton[i].checked==true)
      {
        returnValue=radiobutton[i].value;
      }
    }
  }
  return returnValue;
}
function date2Supdate1(dateParam2, dateParam1)
{
  <!-- date 1 format jj/mm/aaaa -->
  var jour1 = Number(dateParam1.substring(0,2));
  var mois1 = Number(dateParam1.substring(3,5));
  var annee1 = Number(dateParam1.substring(6,10));
  var Somme1 = jour1+mois1*100+annee1*10000;
  <!-- date 2 jj/mm/aaaa -->
  var jour2 = Number(dateParam2.substring(0,2));
  var mois2 = Number(dateParam2.substring(3,5));
  var annee2 = Number(dateParam2.substring(6,10));
  var Somme2 = jour2+mois2*100+annee2*10000;
  if(Somme2 == Somme1)
  {
    return false;
  }
  else if(Somme2 < Somme1)
  {
    return false;
  }
  else
  {
    return true;
  }
}