/**
*  Show dropdowns
*/
function showCategories(aElement)
{
	 if(document.getElementById) {
		    var divObj = document.getElementById(aElement);
     }else if (document.all){
	    var divObj = document.all[aElement];
	 }
	 if (divObj != null)
	 {
	     if (divObj.style.visibility == "visible")
	     {
		     divObj.style.visibility ="hidden"; 
		     divObj.style.position = "absolute";
		     hideChildFlyouts(aElement); //Hide all child flyout	 
	     }else{
		     divObj.style.visibility ="visible";
		     divObj.style.position = "relative"; 
	     }
	 }
	return false;
}

/**
*  Hide dropdowns + sub dropdowns
*/
function hideChildFlyouts(aElement)
{
	 if(document.getElementById) {
		    var divObj = document.getElementById(aElement);
     }else if (document.all){
	        var divObj = document.all[aElement];
	 }
	 
	var thisChild = divObj.firstChild;
	//loop the child nodes
	while ( thisChild != divObj.lastChild )
	{
		if ( thisChild.nodeType == 1 )
		{
			var subFlyOuts = thisChild.id;
			//only use nodes with a id that contains FlyOut
			if ((subFlyOuts.length > 0) && (subFlyOuts.indexOf("FlyOut")  >= 0))
			{
			    //Find if the child is visable
				if(document.getElementById) {
		            var childObj = document.getElementById(subFlyOuts);
                }else if (document.all){
	                var childObj = document.all[subFlyOuts];
	            }
				if (childObj.style.visibility == "visible")
				{
	                showCategories(subFlyOuts);	//use the same function so we cascade down the div tree
                }
			}
		}
		thisChild = thisChild.nextSibling;
	}
		
}

