/*****************************************************/
/**************** Menu automatique CSS ***************/
/*****************************************************/
/*** Création : Magnus MARIE SAINT GERMAIN (DCR)   ***/
/*** Date     : 01/11/2005                         ***/
/*****************************************************/
/*** onMouseOver et onMouseOut automatique sur les ***/
/*** liens dans un tableau comportant l'ID = menu  ***/
/*****************************************************/
/*** Styles obligatoires pour DIV :                ***/
/*** -> unStyleDiv pour le div caché               ***/
/*** -> unStyleDivActive pour le div visible       ***/
/*****************************************************/
/*** Styles obligatoires pour effet surbrillance : ***/
/*** -> unStyle pour l'effet onMouseOut            ***/
/*** -> unStyleHover pour l'effet onMouseOver      ***/
/*****************************************************/

/* --- DEBUT compatibilité DOM GECKO --- */
/* --- différence GECKO : saut à la ligne et tab = un childnode ! --- */
var ie = /MSIE/.test(navigator.userAgent);
var moz = !ie && navigator.product == "Gecko";

if (moz) {
     HTMLElement.prototype.__defineGetter__("children", function() {
           var arr = new Array(), i = 0, l = this.childNodes.length;
           for ( i = 0; i < l; i++ ) {
               if ( this.childNodes[ i ].nodeType == 1 ) {
                    arr.push( this.childNodes[ i ] );
               }
           }
      return arr;
      });

      HTMLElement.prototype.__defineGetter__("firstChild", function() {
            var node = this.childNodes[ 0 ];
            while (node.nodeType != 1) node = node.nextSibling;
                 return node;
            });

     HTMLElement.prototype.__defineGetter__("lastChild", function() {
     var node = this.childNodes[ this.childNodes.length - 1 ];
     while (node.nodeType != 1) node = node.previousSibling;
           return node;
      });
} 
/* --- FIN compatibilité DOM GECKO --- */


/* --- DEBUT fonction recherche position de l'objet --- */
function getTop(monObj) 
{
	if (monObj.offsetParent)
		return(monObj.offsetTop + getTop(monObj.offsetParent));
	else
		return(monObj.offsetTop);
}
function getLeft(monObj) 
{
	if (monObj.offsetParent)
		return(monObj.offsetLeft + getLeft(monObj.offsetParent));
	else
		return(monObj.offsetLeft);
}
/* --- FIN fonction recherche position de l'objet --- */


/* --- DEBUT fonction inclusion onMouseOver et onMouseOut sur TD --- */
startList = function() 
{
//	if (document.all && document.getElementById) 
	if (document.getElementsByTagName) 
	{
		intTable = document.getElementsByTagName("Table").length;
		for (z = 0; z < intTable; z++) 
		{
			navRoot = document.getElementsByTagName("Table").item(z);
			if ( (navRoot.id=="menu") && navRoot.hasChildNodes() ) 
			{
				for (i = 0; i < navRoot.lastChild.childNodes.length; i++)
				{
					for (x = 0; x < navRoot.lastChild.childNodes[i].childNodes.length; x++)
					{
						node = navRoot.lastChild.childNodes[i].childNodes[x];
						if (node.nodeName=="TD")
						{
							node.onmouseover=function() 
							{
								var hoverTD = this;
								//--- cell onMouseOver effect
								if (hoverTD.className!=null)
									if (hoverTD.className.indexOf("Hover")==-1)
											hoverTD.className = hoverTD.className+"Hover";
										
								if (hoverTD.getElementsByTagName("div").item(0)!=null) 
								{
									var hoverDIV = hoverTD.getElementsByTagName("div").item(0);
									
									if (hoverDIV.className.indexOf("Active")==-1)
									{
										hoverDIV.className = hoverDIV.className+"Active";
										//if (hoverDIV.style.top != null)
										//	hoverDIV.style.top = hoverDIV.style.top;
										//else
											hoverDIV.style.top = getTop(hoverTD);
											hoverDIV.style.left = getLeft(hoverTD);
									}
								}
							}
							node.onmouseout=function() 
							{
								var hoverTD = this;
								//--- cell onMouseOver effect
								if (hoverTD.className!=null) 
									hoverTD.className = hoverTD.className.replace(/Hover/, "");
								
								if (hoverTD.getElementsByTagName("div").item(0)!=null) 
								{
									var hoverDIV = hoverTD.getElementsByTagName("div").item(0);
									hoverDIV.className=hoverDIV.className.replace(/Active/, "");
								}
							}
						}
					}
				}
			}
		}
	}
	// activate for thickbox onload open
	// showBox();
}

window.onload = startList;
/* --- FIN fonction inclusion onMouseOver et onMouseOut sur TD --- */

