    OverMenu = 0;
    CurrentID = 0;

    function menuShow(N, level)
    {       
        if (level == 1)
        {
            hide_menu(CurrentID);
            show_menu(N);
            CurrentID = N;
        }
        OverMenu = 1;
    }

    function menuHide(N, level)
    {            
        OverMenu = 0;
        setTimeout("hide_menu('"+CurrentID+"');", 1000); 
    }

    function hide_menu(N)
    {      
        if(OverMenu)
            return;
        if (N!=0)
        {   
        	d = document.getElementById('topmenu_'+N); // a
if(!d) return;
			d.className = 'topmenu';

            d = document.getElementById('submenu_'+N);
            if (!d)
            	return;
            d.style.display = 'none';
        }
    }

    function show_menu(N)
    {
        d = document.getElementById('topmenu_'+N); // a
if(!d) return;
		d.className = 'topmenuSel';

        d = document.getElementById('submenu_'+N); // div
if (!d) return;

        tds = d.getElementsByTagName("td"); 
        if(tds.length > 1)
        {
            d.style.display = '';
            t = document.getElementById("leftmenutable");
if (!t) return;
            d.style.left = d.parentNode.offsetLeft + t.offsetWidth + 39; 
            d.style.width = d.parentNode.offsetWidth+2; 
        } 
    }
