var mm=null;    // active menu by default
var sm=null;    // active submenu by default

// menus style
var main_on ="mb_on";
var main_off="mb_off";
var main_act="mb_act";

var sub_on="ms_on";
var sub_off="ms_off";
var sub_act="ms_act";

var hide_table="hide_table";
var show_table="show_table";

var menu_timer = null;
var submenu_timer = null;
var menu_delay = 500;



function _menu_over(n,s,hash) {

	clearTimeout(menu_timer);
        clearTimeout(submenu_timer);       
   
       	if (!n) {
		nc=document.getElementsByName("main_menu");
		t=document.getElementsByName("sub_menu")
		if(nc && t){
			for(i=0;i<nc.length;i++){
				nc.item(i).className=main_off;
				t.item(i).className=hide_table;
			}
                  if (mm) nc.item(mm-1).className=main_act;
		}
		return true;
	}

 	if (n) { 
		nc=document.getElementsByName("main_menu");
		t=document.getElementsByName("sub_menu")
		if(nc && t){
			for(i=0;i<nc.length;i++){
				nc.item(i).className=main_off;
				t.item(i).className=hide_table;
			}
			nc.item(n-1).className=main_on;
  			t.item(n-1).className =show_table;
          		if (mm) nc.item(mm-1).className=main_act;
		}
	}
      	

}

function _menu_out(delay) {	
	if (!delay) delay=menu_delay;
	menu_timer = window.setTimeout("_menu_over(null,sm);", delay); 

}

function _menu_sub_over(obj) {
	clearTimeout(menu_timer);
}

function _menu_sub_out(obj) {
        _menu_out(menu_delay);
	
}
