// *****************************************************************************
// ECEDI - Webuilder
//
// File: handilog.js
// Rôle: Fonctions javascript pour handilog
// Creation: Mars 2004
// *****************************************************************************


// *****************************************************************************
// SelectLiensAuto() [ NS6.1 | IE5 ] : sélection automatique avec changement
// de class des liens d'une page
// paramètres:
// activeWindow : fenêtre active qui a le focus
// nbLiens=activeWindow.document.links.length
// idCurrentSelected=-1 (initialisation à -1)
// Lancer un traitement à intervalle régulier de la fonction par
// delay=1; choisir la fréquence en secondes
// var timer=setInterval("SelectLiensAuto(activeWindow)", delay*1000);
// *****************************************************************************
function SelectLiensAuto(class1,class2) {
   if(idCurrentSelected>nbLiens-2) idCurrentSelected=-1;
   idCurrentSelected++;
   // if(activeWindow==window.parent.contenu)
   // alert(idCurrentSelected);
   for(j=0;j<nbLiens;j++)
   {
      if(idCurrentSelected==j)      {
         activeWindow.document.links[j].className=class1;
         activeWindow.document.links[j].focus();
      }
      else{
         activeWindow.document.links[j].className=class2;
      }
   }
}


// *****************************************************************************
// SelectLiensAutoMenuHandilog() : idem SelectLiensAuto()
// sélection ciblée et automatique de certains liens de la page Mode Handilog
// la position des liens dans la page est indicée dans le tableau indiceLiens
// *****************************************************************************
function SelectLiensParticuliersAuto() {
   if(idCurrentSelected>nbLiens-2) idCurrentSelected=-1;
   idCurrentSelected++;
   // if(activeWindow==window.parent.contenu)
   // alert(idCurrentSelected);
   for(j=0;j<nbLiens;j++)
   {
      if(idCurrentSelected==j)      {
         activeWindow.document.links[indiceLiens[j]].className="menuselect";
         activeWindow.document.links[indiceLiens[j]].focus();
      }
      else{
         activeWindow.document.links[indiceLiens[j]].className="menu";
      }
   }
}

// *****************************************************************************
// LocationLien() [ NS6.1 | IE5 ] : Gestion de l'évènement clavier [KeyPress]
// pour sélectionner un lien
// paramètres:
// menuRub | 1 - navigation du site | 2 - navigation Handilog
//         | 3 - liens dans les pages | 4 - page choix Handilog
//         | 5 - Personnalisation graphique Handilog
// *****************************************************************************
function LocationLien(e){
// if (bw.ns4||bw.ns6){
// }
// elseif (document.all){
// }
// alert(window.parent.menu.activeWindow.name);
   if(idCurrentSelected<nbLiens-2 && 1==menuRub )
   {
      // alert(idCurrentSelected);
      if("_top"==activeWindow.document.links[idCurrentSelected].target)
         window.parent.location=activeWindow.document.links[idCurrentSelected].href;
      else
         window.parent.contenu.location=activeWindow.document.links[idCurrentSelected].href;
   }
   else if(idCurrentSelected==nbLiens-1 && 1==menuRub )
   {
      window.parent.menu.fnGo();
   }
   else if(idCurrentSelected<nbLiens && idCurrentSelected!=2 && 3==menuRub )
   {
      // alert(idCurrentSelected);
      if("_top"==activeWindow.document.links[idCurrentSelected].target)
         window.parent.location=activeWindow.document.links[idCurrentSelected].href;
      else
         window.parent.contenu.location=activeWindow.document.links[idCurrentSelected].href;
   }
   else if(idCurrentSelected<nbLiens-1 && 2==menuRub)
   {
      if("#up"==activeWindow.document.links[idCurrentSelected].hash)
         window.parent.contenu.ScrollUp();
      else if("#down"==activeWindow.document.links[idCurrentSelected].hash)
         window.parent.contenu.ScrollDown();
      else if("#contenuFocus"==activeWindow.document.links[idCurrentSelected].hash)
      {
         clearInterval(timerRubrique);
         nbLiens=window.parent.contenu.document.links.length;
         idCurrentSelected=-1;
         activeWindow=window.parent.contenu;
         menuRub=3;
         window.parent.contenu.location.reload();
      }
   }
   else if(4==menuRub)//page Handilog
   {
      clearInterval(timerRubrique);
      window.location=activeWindow.document.links[indiceLiens[idCurrentSelected]].href;
   }
   else if(5==menuRub)//page personnalisation Handilog
   {
      clearInterval(timerRubrique);
      window.location=activeWindow.document.links[idCurrentSelected].href;
   }
   else
   {
      if(1==menuRub)
         window.parent.contenu.stopScroll();
      else if(2==menuRub)
         window.parent.contenu.initScroll();
      else if(3==menuRub)
         clearInterval(timerRubrique);
      window.parent.menu.location=activeWindow.document.links[idCurrentSelected].href;
   }

}

