// *****************************************************************************
// ECEDI - Webuilder
//
// File: handilog.js
// Rôle: Fonctions javascript pour handilog
// Creation: Mars 2004
// *****************************************************************************

// *****************************************************************************
// 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);
	try 
	{	
		for(j = 0; j < nbLiens; j++)
		{
			if(idCurrentSelected == j)      
			{
				tmp = activeWindow.document.links[indiceLiens[j]].className;
				activeWindow.document.links[indiceLiens[j]].className= tmp.concat("_select");
				
				if (doAutoScroll)
				{
					self.scrollBy(0, f_clientHeight());	
				}
	
				if (doFocus)
				{
					document.links[indiceLiens[j]].focus();

					id = document.activeElement.href.length;
					if (document.activeElement.href[id-1] == '#')
					{
						document.onclick = document.activeElement.onclick;
					}
					else
					{
						document.onclick = LocationLien;
					}
				}
				else
					trtFocus();	
			}
			else
			{
				tmp = activeWindow.document.links[indiceLiens[j]].className;
				
				regEx = new RegExp("_select$");
				if (regEx.test(tmp))
				{
					tmp2 = tmp.substring(0, (tmp.length - 7));
					activeWindow.document.links[indiceLiens[j]].className=tmp2;
				}
			}
		}
	}
	catch(e)
	{
		//alert(e);
	}
}


// *****************************************************************************
// 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)
{
	clearInterval(timerRubrique);
	
	if (idCurrentSelected  < 0)
	{
		idCurrentSelected = 0;
	}
		
	id = activeWindow.document.links[indiceLiens[idCurrentSelected]].href.length;
	if (activeWindow.document.links[indiceLiens[idCurrentSelected]].href[id-1] != '#')
	{
	  	window.location=activeWindow.document.links[indiceLiens[idCurrentSelected]].href;
	}
}


/*************
	Var globales
**************/
var timerRubrique = null;
//var menuRub = 4;
var activeWindow = window.self;
//tableau d'indice des liens ciblés par la fonction
var indiceLiens = null;
var secondsEllapsed;
var doFocus = true;
var doAutoScroll = false;

// _____________________________________________________________________________
// Browsercheck object : détection du navigateur
// _____________________________________________________________________________
var bw=new cm_bwcheck();