function isFunction(a) {
    return typeof a == 'function';
}

if (!isFunction(Array.prototype.push)) {
    Array.prototype.push = function (obj) {        
        this[this.length] = obj;
        return this.length;
    };
}

var OnLoadFunctions = new Array();
var OnLoadFunctionsEx = new Array();
function AddOnLoadFunction(OnLoadFunction, OnLoadFunctionEx)
{
    OnLoadFunctions.push(OnLoadFunction);
    OnLoadFunctionsEx.push(OnLoadFunctionEx);
}

var OnUnloadFunctions = new Array();
var OnUnloadFunctionsEx = new Array();
function AddOnUnloadFunction(OnUnloadFunction, OnUnloadFunctionEx)
{
    OnUnloadFunctions.push(OnUnloadFunction);
    OnUnloadFunctionsEx.push(OnUnloadFunctionEx);
}



window.onload = OnBodyLoad;
function OnBodyLoad()
{
	for (var i = 0; i < OnLoadFunctions.length; i++)
    {
        var cfunction = OnLoadFunctions[i];
        var cfunctionex = OnLoadFunctionsEx[i];
        eval("if (window." + cfunction + ") { " + cfunctionex + "; }");
    }   
}

window.onunload = OnBodyUnload;
function OnBodyUnload()
{
	for (var i = 0; i < OnUnloadFunctions.length; i++)
    {
        var cfunction = OnUnloadFunctions[i];
        var cfunctionex = OnUnloadFunctionsEx[i];
        eval("if (window." + cfunction + ") { " + cfunctionex + "; }");
    }  
}




function GetEventObject( evt )
{
	if( !evt && window.event )
	{
		evt = window.event;
	}

    if (evt)
	{
		if( evt.srcElement )
			return evt.srcElement;
		else
			return evt.target;
	}
	else
		return null;
}

function getRealLeft(imgElem)
{
	xPos = eval(imgElem).offsetLeft;
	tempEl = eval(imgElem).offsetParent;
  	while (tempEl != null)
	{
  		xPos += tempEl.offsetLeft;
  		tempEl = tempEl.offsetParent;
  	}
  	
    if(navigator.platform == "MacPPC" && navigator.userAgent.indexOf("MSIE") != -1)
    {           
        //Dans IE pour Mac, il faut additionner la marge du body.
        xPos += parseInt(document.body.currentStyle.marginLeft);       
    }
      	
	return xPos;
}

function getRealTop(imgElem)
 {
	yPos = eval(imgElem).offsetTop;
	tempEl = eval(imgElem).offsetParent;
	while ( tempEl != null )
	{
        //Note: On a pas besoin de passer par ici pour calculer la position avec
        //      opera car offsetTop contient déjà la bonne position.  On a pas besoin
        //      de l'additionnner aux positions de ses éléments parent.
  		yPos += tempEl.offsetTop;
  		
  		if(navigator.userAgent.indexOf("Opera") != -1 && yPos != 0)
  		    tempEl = null;
  		else
  		    tempEl = tempEl.offsetParent;	
  	}
  	
    if( (navigator.platform == "MacPPC" && navigator.userAgent.indexOf("MSIE") != -1) )
    {           
        //Dans IE pour Mac, il faut additionner la marge du body.
        yPos += parseInt(document.body.currentStyle.marginTop);       
    }
              	
	return yPos;
}