function menu_switch(n) {
        var o = document.getElementById("sw_"+n);
        o.style.display = o.style.display=='none' ? "block" : "none";
        return true;
}

var stm = {};
var inz = {};

function showMenu(N, ss) {
        if (N<0) N0 = -N; else N0=N;
	var o = document.getElementById("msm"+(N<0 ? '0' : '')+"_"+N0);
	if (stm[N]) clearTimeout(stm[N]);
	if (!o) return true;
	if (!inz[N]) {
		var n = o.getElementsByTagName("li").length;
		var k = (navigator.userAgent.match(/MSIE\s\d\./) ? 3 : 0);
                var $H = (n*26+k-5);
		o.style.height = $H+"px";
//	o.style.zIndex = "65500";
		o.parentNode.removeChild(o);

		document.body.appendChild(o);
	if (ss) {
            if (N>0) {
                o.style.top = (ss.offsetTop+30) + "px";
		o.style.left = (266+ss.offsetLeft) + "px";
                }
                    else { 
                o.style.top = (document.body.clientHeight - 152 - k*3 - $H) + "px";
		o.style.left = (ss.offsetLeft) + "px";
                }

	}

	inz[N] = 1;
	}


	o.style.display = 'block';
	return true;
}

function hideMenu(N) {
        if (N<0) N0 = -N; else N0=N;
	var o = document.getElementById("msm"+(N<0 ? '0' : '')+"_"+N0);
	if (!o) return true;

	o.style.display = 'none';
	return true;
}

window.onload = function () {
        var mm = document.getElementById("main-menu");
        var n = mm.getElementsByTagName("li");
        var w = 2;
        for (i=0; i<n.length; i++) w+= n[i].offsetWidth+3;
        mm.style.width = w+"px";
//        document.body.style.width = (w+266)  +"px";
        return true;
}