var interval = 500;                // Jak dlouho bude menu aktivni po odjeti
var casovac = null;
var listMenu = new Array();

function menuOff() {
 clearTimer();  
 if(listMenu.length > 0) {
  while(obj = listMenu.pop()) {
    if(obj != null && typeof obj == 'object') {
     obj.style.display = 'none';
     obj.parentNode.className = '';
    } 
   }
 }  
}

function clearTimer() {
 if(casovac!=null) {
  clearTimeout(casovac);
  casovac=null;
 } 
}

function setTimer(owenInt) {
  if(owenInt==null) {
   owenInt = interval;
  }
  casovac = setTimeout('menuOff()',owenInt);
}

function menu(id) {
  var obj = id;
  if(typeof id != 'object') {
   obj = gebi(id);   
  } 
  menuOff();
  if(obj != null) {
   obj.parentNode.className = 'main_menu_hoverable';
   obj.style.display='block';
   listMenu.push(obj);
   clearTimer();   
  } 
}