// -------------------------------------------------------------------------------------------------
// Affecte la valeur _blanck à la cîble des liens marqués comme pointant vers l'exterieur
// -------------------------------------------------------------------------------------------------
function externalLinks()
{
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i < anchors.length; i++)
	{
		if (anchors[i].getAttribute("href"))
		{
			if (anchors[i].getAttribute("rel"))
			{
				if (anchors[i].getAttribute("rel").lastIndexOf("external") >= 0)
				{
					anchors[i].target = "_blank";
					if (!anchors[i].getAttribute("title"))
					{
						txt = 'Lien externe ';
						if (anchors[i].getAttribute('hreflang'))
						{
							txt = txt + '[' + anchors[i].getAttribute('hreflang') + '] ';
						}
						txt = '' + txt + ': ' + anchors[i].getAttribute('href');
						anchors[i].setAttribute("title", txt);
					}
				}
			}
		}
	}
}

// -------------------------------------------------------------------------------------------------
// initialise les éléments du menu
// -------------------------------------------------------------------------------------------------
function sfHover()
{
	var x = document.getElementById("menu").getElementsByTagName("LI");
	for (var i=0; i < x.length; i++)
	{
		x[i].onmouseover = function() { this.className +=" sfhover";}
		x[i].onmouseout = function() { this.className = this.className.replace(new RegExp(" sfhover\\b"), "");}
	}
}

// -------------------------------------------------------------------------------------------------
// Fonction de stockage des scripts à charger une fois la page intégralement chargée
// -------------------------------------------------------------------------------------------------
OnLoadFunc = new Array(); 
OnUnloadFunc = new Array(); 
function AddOnLoadFunc(Obj) { 	OnLoadFunc[OnLoadFunc.length] = Obj; } 
function AddOnUnloadFunc(Obj) { 	OnUnloadFunc[OnUnloadFunc.length] = Obj; } 

// -------------------------------------------------------------------------------------------------
// Execution les scripts au chargement de la page 
// -------------------------------------------------------------------------------------------------
var previousOnload = window.onload;
window.onload = function()
{ 
	if (previousOnload) previousOnload();
	for(i = 0; i < OnLoadFunc.length; i++)
	{
		OnLoadFunc[i]();
	} 
}

// -------------------------------------------------------------------------------------------------
// Execution les scripts au déchargement de la page 
// -------------------------------------------------------------------------------------------------
var previousOnunload = window.onunload;
window.onunload = function()
{ 
	if (previousOnunload) previousOnunload();
	for(i = 0; i < OnUnloadFunc.length; i++)
	{
		OnUnloadFunc[i]();
	} 
}

// pour toutes les pages...
AddOnLoadFunc(externalLinks);
// uniquement pour IEX
if (document.all) AddOnLoadFunc(sfHover);
