agent = navigator.userAgent.toLowerCase();
entier = parseInt(navigator.appVersion);

var isNS = ((agent.indexOf('mozilla') != -1) && ((agent.indexOf('spoofer') == -1) && (agent.indexOf('compatible') == -1)));
var isNS6 = (isNS && entier >= 5);
var isMacIE = ( (navigator.userAgent.indexOf("IE 4")  > -1) && (navigator.userAgent.indexOf("Mac")  > -1) );
var layerRef = (isNS) ? "document" : "document.all";
var styleRef = (isNS) ? "" : ".style";
var isDynamic = ( (isNS || document.all || isNS6) && !isMacIE );

var activeMenu = 0;

function activateMenu(menuLayerRef,horizon,haut) {
        
        if (isDynamic && activeMenu != menuLayerRef) {

                if (activeMenu) hideMenu("menu" + activeMenu);
                        
                menuID = "menu" + menuLayerRef;
                activeMenu = menuLayerRef;
        
                if (isNS && !isNS6) { 
                        document[menuID].top = haut;
                        document[menuID].left = horizon;
                }
								else if (isNS6) { 
												this.obj = document.getElementById(menuID).style;
												this.obj.left = horizon ;
												this.obj.top = haut;
												 }
								else { 
                        document.all[menuID].style.pixelTop = haut;
                        document.all[menuID].style.pixelLeft = horizon;
                }

                showMenu(menuID)
        }
}

function fini() 
				 					{//alert('yo');
									killMenu();
									}
									
function showMenu(layerID) { // alert(document.getElementById(menuID));
				  if (isNS6) { document.getElementById(menuID).style.visibility = "visible";}
					else { eval(layerRef + '["' + layerID + '"]' + styleRef + '.visibility = "visible"');}
				//setTimeout('fini()', 6000);
									
}

function hideMenu(layerID) {
         if (isNS6) {  document.getElementById(menuID).style.visibility = "hidden";}
					else { eval(layerRef + '["' + layerID + '"]' + styleRef + '.visibility = "hidden"');}
}

function killMenu(e) {
        //check if theres a menu active
        if (activeMenu) {
                menuID = "menu" + activeMenu;
                hideMenu(menuID);
                activeMenu = 0;
        }  

}

function init() {
        if (isDynamic) {
                if (isNS) {document.captureEvents(Event.MOUSEUP);} 
                document.onmouseup = killMenu;
        }
}


