var mCollapseId;
var mOkToClose = true;
var mInterval
var mIdOther;

function okToClose( pBoolean )
{
	mOkToClose = pBoolean;
}

function showSideSubMenu( pId )
{
	mIdOther = pId;
	
	setTimeout( "closeOther( )", 10000);
	
	if(mInterval)
	{
		clearInterval( mInterval );
	}
	
	var zMenu = document.getElementById(pId);
	
	if(zMenu)
	{
		zMenu.style.display = "block";
	}
}

function hideSideSubMenu( pId )
{
	mCollapseId = pId;
	mInterval = setInterval("closeSubMenu()", 5000);
}


function closeSubMenu()
{
	var zMenu = document.getElementById(mCollapseId);
	
	if(zMenu)
	{
		if(mOkToClose)
		{
			zMenu.style.display = "none";
			clearInterval( mInterval );
		}
	}
}

function closeOther( )
{
	var zMenu;
	
	if( mIdOther )
	{
		if( mIdOther != "medspa_dropdown" )
		{
			zMenu = document.getElementById( "medspa_dropdown" )
			if(zMenu)
			{
				zMenu.style.display = "none";
			}
		}

		if( mIdOther != "healthcare_dropdown" )
		{
			zMenu = document.getElementById( "healthcare_dropdown" )
			if(zMenu)
			{
				zMenu.style.display = "none";
			}
		}
	}
}


