var topLock = false;
var topTime = null;

function RunTopEngine(){
  topTime = setTimeout(RunTopNext,5000);
}

function RunTopNext(){
  if(!nowTopIndex) nowTopIndex = 0;
  var el = document.getElementById("topii");
  var ell = el.childNodes[nowTopIndex];
  if(ell.nextSibling) RunMove(nowTopIndex, nowTopIndex+1);
  else nowTopIndex = RunMove(nowTopIndex, 0);
}
function RunMove(from, to){
  if(!from) from = 0;
  var el = document.getElementById("topii");
  var eel = document.getElementById("menu_o");
  el.childNodes[to].className = 'buh';
  eel.childNodes[to].className = 'active';
  el.childNodes[to].blur();
  el.childNodes[from].className = 'bu';
  eel.childNodes[from].className = '';
  nowTopIndex = to;
  clearTimeout(topTime);
  topTime = setTimeout(RunTopNext,5000);
}