var sd, td, sc, tc, m1, m2, u1, u2, wn, s, t;

function preloadmenus() {
    sd = MM_findObj('secpd'); td = MM_findObj('thrpd'); sc = MM_findObj('secct'); tc = MM_findObj('thrct');
    wn = MM_findObj('whatLayer'); s = MM_findObj('second'); t = MM_findObj('third');
    m1 = m2 = u1 = u2 = null;
    // var menuId = getCookie('mid');
    // 	if (menuId != null && menuId != '')
    // 		showMenu(menuId);
    // 	else
    // 		showMenu('main_menu');
}

function showMenu(menu_id) {
    menus = menu_id.split('.');
    hideMenus();
    if (menus.length == 2 && (m2 = MM_findObj(menus[1])) != null) {
	t.className = 'ttd';
	u2 = MM_findObj('u' + menu_id);
	if (u2 != null)
	    u2.className = 'ls';
	td.style.visibility = 'visible';
	tc.innerHTML = m2.innerHTML;
    }
    if ((m1 = MM_findObj(menus[0])) != null) {
	s.className = 'std';
	u1 = MM_findObj('u' + menus[0]);
	if (u1 != null)
	    u1.className = 'ls';
	sd.style.visibility = 'visible';
	sc.innerHTML = m1.innerHTML;
    }
    //	setCookie(menu_id, 'mid');
    return false;
}

function hideMenus() {
    sc.innerHTML = ''; tc.innerHTML = '';
    sd.style.visibility = 'hidden'; td.style.visibility = 'hidden';
    m1 = null; m2 = null;
    s.className = 'htd';
    t.className = 'htd';
    if (u1 != null) 
	u1.className = 'll';
    if (u2 != null) 
	u2.className = 'l2';
}

function setCookie(cValue, cookieID) {
    var NameOfCookie = cookieID;
    document.cookie = NameOfCookie + "=" + escape(cValue);
}

function getCookie(cookieID) {
    var dc = document.cookie, prefix = cookieID + "=", begin = dc.indexOf("; " + prefix);
    if (begin == -1) { begin = dc.indexOf(prefix); if (begin != 0) return null; }
    else begin += 2;
    var end = document.cookie.indexOf(";", begin);
    if (end == -1) end = dc.length;
    return unescape(dc.substring(begin + prefix.length, end));
}

function MM_findObj(n, d) { //v4.01
    var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
    if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
    for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
    if(!x && d.getElementById) x=d.getElementById(n); return x;
}