﻿var curMenuId = "";
var oTimeoutMenu = null;

function showMenu( id )
{
	// Si hide en court, on patiente...
	if ( oTimeoutMenu ) clearTimeout( oTimeoutMenu );
	oTimeoutMenu = null;
	
	if ( curMenuId == id ) return;
	
	if ( curMenuId != "" && curMenuId != id )
	{
		_hideMenu( curMenuId );
	}
	curMenuId = id;
	$('#'+id).attr( "oldClass", $('#'+id)[0].className );
	$('#'+id)[0].className = "OngletRoll";
	
	// IE Patch, z-index relative in div
	if ( $.browser.msie && $('#Sous'+id).parent().length && $('#Sous'+id).parent()[0].nodeName.toUpperCase() != "BODY" )
	{
		$("body").append( $('#Sous'+id) );
		// realigne with top...
		$('#Sous'+id).css('font-family','Arial')
		$('#Sous'+id).css('top', ($('#'+id).offset().top+$('#'+id).outerHeight()-3)+'px')
	}
	var finalLeft = $($('#'+id)[0]).offset().left;
	if ( !$.browser.msie )
		if ( typeof gGlobalOffsetMenuModeAdmin != "undefined" ) finalLeft -= gGlobalOffsetMenuModeAdmin;
	
	$('#Sous'+id).css('left', finalLeft +'px').show();
}

function hideMenu( id )
{
	if ( oTimeoutMenu == null )
		oTimeoutMenu = setTimeout( "_hideMenu('"+id+"')", 500 )
}

function _hideMenu( id )
{
	// Test si un second menu de type MenuVP n'est pas 
	if ( typeof MenuVN_currentActiveId != "undefined" && MenuVN_currentActiveId ) 
	{
		MenuVNOut( MenuVN_currentActiveId, true ) 
	}

	if ( oTimeoutMenu ) clearTimeout( oTimeoutMenu );
	oTimeoutMenu = null;
	
	$('#'+id)[0].className = $('#'+id).attr("oldClass");
	$('#Sous'+id).hide();
	curMenuId = "";
	

}

function setMouseOverMenu( id )
{
	//curMenuId = id;
}

