var active_timer = null;
var active_navigation = null;

function position_left(obj) {
 if (obj.offsetParent == null) {
  return obj.offsetLeft;
 } else {
  return obj.offsetLeft + position_left(obj.offsetParent);
 }
}

function position_top(obj) {
 if (obj.offsetParent == null) {
  return obj.offsetTop;
 } else {
  return obj.offsetTop + position_top(obj.offsetParent);
 }
}

function show_navigation(nav, menu) {
 hide_navigation_total();
 active_navigation = document.getElementById(menu);
 active_navigation.style.top = (position_top(nav) + 26) + 'px';
 active_navigation.style.left = position_left(nav) + 'px';
 active_navigation.style.visibility = 'visible';
}

function hide_navigation(nav) {
 active_navigation = nav;
 active_timer = window.setTimeout("hide_navigation_total()", 500);
}

function hide_navigation_total() {
 if (active_navigation != null) {
  active_navigation.style.visibility = "hidden";
 }
}

function keep_navigation(menu) {
 window.clearTimeout(active_timer);
 this_menu = document.getElementById(menu);
 this_menu.style.visibility = "visible";
}