
var isExpanding;

function showMenu( idShow ) 
{
	var table = document.getElementById( idShow );

	if ( table != null )
	{
		table.style.visibility = "visible";
		table.style.position = "absolute";			
	}

} 

function positionMenu( idMenu, top ) 
{
	var table = document.getElementById( idShow );

	if ( table != null )
	{
		table.style.top = top;
	}

} 


function hideMenu( idHide ) 
{

	var table = document.getElementById( idHide );

	if ( table != null )
	{
		table.style.visibility = "hidden";
		table.style.position = "absolute";	
	}
	
}

function expandOnLoad( idToExpand ) 
{ 


	var table = document.getElementById( idToExpand );

	if ( table != null )
	{		


		var parent = table.parentNode;	
		var list;
		var i = 0;
		list = new Array();
		while ( parent.id != "dnn_dnnMLVMENU_menuNav1" )
		{	


			if ( parent.id != null )
			{								
				if ( parent.id.match( "dnn_dnnMLVMENU_items_menuNavID_" )  )
				{
					list[i] = parent.id.substring(21, parent.id.length ) ;
					i++;
				}		
			}
			
			parent = parent.parentNode;
		}
		
		for( var j = 0; j < list.length ; j++ )
		{


			expandSingle( list[j] );
		}


					
	}


}


function stripDNNInfo( dnnID )
{
	return dnnID.replace("dnn_dnnMLVMENU_items_","")
}


function expand(idToExpand) { 

	if ( isExpanding )
	{
		return;
	}
	isExpanding = true;


	var table = document.getElementById( 'dnn_dnnMLVMENU_items_' + idToExpand );

	if ( table != null )
	{
		var child = table.childNodes(0);
		if ( child != null )
		{
			var child1 = child.childNodes(0);		
			if ( child1 != null )
			{
				var child2 = child1.childNodes(0);
				
				if ( child2.id != null )
				{
					collapseAll();

					expandOnLoad( child2.id  );
	
				}
			}
		}

	}

	isExpanding = false;	
}
function expandSingle(idToExpand) { 


	

	
	var table = document.getElementById( 'dnn_dnnMLVMENU_items_' + idToExpand )
	
	if ( table != null )
	{
		if ( table.style.visibility == "visible" )
		{
			table.style.visibility = "hidden";
			table.style.position = "absolute";
		}
		else
		{
			table.style.visibility = "visible";
			table.style.position = "";
		}		
	}
}

function collapseAll(  )
{

		var elements;
		elements = new Array();

		elements = document.all

		for( var j = 0; j < elements.length ; j++ )
		{
			if ( elements[j].id != null )
			{
				if ( elements[j].id.match( "dnn_dnnMLVMENU_items_menuNavID_" )  )
				{
					elements[j].style.visibility = "hidden";
					elements[j].style.position = "absolute";
				}
			}

		}

}

