// becker_menu.js

function get_location(){
   object=document.getElementById("bg_navbar");
   fx = findPosX(object);
   fy = findPosY(object);
   placeobjects(fx, fy)
}

function placeobjects(x, y) {
   placeIt("landscape", x+310, y+30);// calls placeIt()
}

function placeIt(id, x, y){//places object id at the following coordinates (x,y)
   object=document.getElementById(id);
   object.style.left=x+"px";
   object.style.top=y+"px";
}

function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

  function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }

//////////////////////////////////////////////////////////////////////////////
function hideIt(object) {
   object.style.visibility="hidden";
}

function showIt(object) {
   object.style.visibility="visible";
}

// end external script -------------------------------------------------------------------------------------------->
var ActiveMenu = null;//check that a variable does not have an assigned value

function hideActive(){
   if (ActiveMenu !== null){//if ActiveMenu doesnot equal no value then
       hideIt(ActiveMenu);// hide id
	   ActiveMenu = null;//check that a variable does not have an assigned value
   }
}

function popMenu(M){
   hideActive();
   ActiveMenu = document.getElementById(M);
   showIt(ActiveMenu);
}

function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            if (oldonload) {
                oldonload();
            }
            func();
        }
    }
}
