activateMenu = function(nav, currentElNum) 
{
        // currentElNum is 1-based index. 1 is subtracted to make is 0-based index for the array
        currentElNum--;

        var navroot = document.getElementById(nav);
        
        /* Get all the list items within the menu */
        var lis=navroot.getElementsByTagName('LI');  

        var lis2=navroot.getElementsByTagName('UL');

       // current number of active sub menu item

        for (var i=0; i<lis.length; i++) 
        {
        
           /* If the LI has another menu level */
            if((lis[i].lastChild.tagName=='UL'))
            {
	if(lis[i].lastChild.id!="currentsub")
	{
                /* assign the function to the LI */

             	lis[i].onmouseover=function() 
                {	
                   /* display the inner menu */
                   this.lastChild.style.display="block";
	   lis2[currentElNum].id="sub";
	   this.lastChild.id="currentsub";
                }

                lis[i].onmouseout=function()
                {
                   this.lastChild.style.display="none";
	   this.lastChild.id="sub";
	   lis2[currentElNum].id="currentsub";
                }
	}
            }
        }
	
}