


function menuLoad(SRC) {
  var temp = new Image();
  temp.src = SRC;
}

var menu = null;


function menuOn(thisId, SRC, SRC2,  ID) {
 if(SRC!=null) {
  thisId.src=SRC;
 }
 thisNav = document.getElementById('nav_'+ID);
 if(!thisNav) 
  return;
 if(menu && menu.id == thisId) 
  return;
 menuOff();
 menu = new Object();
 menu.id = thisId;
 menu.nav = thisNav; 
 menu.navTop = getTop(thisId)+thisId.offsetHeight;
 menu.navLeft = getLeft(thisId); 
 menu.top = getTop(thisId);
 menu.left = menu.navLeft;
 menu.src = SRC2;

 thisNav.style.top = menu.navTop;
 thisNav.style.left = menu.navLeft;
 thisNav.style.display = 'block';
 thisNav.style.width = thisId.offsetWidth + 3;
 setOpacity(thisNav, "99");
 
}

//function menuOff(thisId, SRC,  ID) {
function menuOff() {
 if(menu == null) 
  return;
 
 menu.nav.style.display = 'none';
 if(menu.src != null) {
  menu.id.src = menu.src;
 }
 menu = null;
}

function checkNavBounds(evt) {
 if(!menu)
  return;
 if(evt) {
  posX = evt.pageX ;
  posY = evt.pageY ;
 }
 else {
  posX = event.x+document.body.scrollLeft ;
  posY = event.y+document.body.scrollTop ;
 }
 var left = menu.left;
 var top = menu.top;
 var bottom = menu.navTop + menu.nav.offsetHeight;
 var right = menu.left + menu.nav.offsetWidth;
 
 if(posX < menu.left || posX > right || posY < top || posY > bottom) {
  window.status = posY;
  menuOff();
 }
}

document.onmousemove = checkNavBounds;
