var topLevelMenu = new Array()
var numTopLevel = 0

function addTopLevel(name, menuId, childId) {
    topLevelMenu[numTopLevel++] = new menuObj(name, menuId, childId)
}

function menuObj(name, menuId, childId) {
    this.name = name
    this.menuElement = document.getElementById(menuId)
   // this.child = document.getElementById(childId)
}

function select(menuName) {
    var menu = null
    for (var i=0; i<numTopLevel; i++) {
        if (topLevelMenu[i].name == menuName) {
            menu = topLevelMenu[i]
        }
        else {
            topLevelMenu[i].menuElement.style.background='#a8bcbc';
            topLevelMenu[i].menuElement.style.cursor='default';
        }
    }
    if (menu == null) return;

   menu.menuElement.style.background = '#000000';
   menu.menuElement.style.cursor = 'hand';
}

function selectside(boxId)
{
   //alert('Select Side for' + boxId);
   var menubox = document.getElementById(boxId);
   //var menutable = document.getElementById('sideNavMenu');
   
   //for (i=1; i< menutable.childNodes[0].childNodes.length - 1; i++)
   //{
   //    if( menutable.childNodes[0].childNodes[i].firstChild.id != boxId)
   //    {      
   //       menutable.childNodes[0].childNodes[i].firstChild.className = 'sideMenuBox';
   //    }
  // }
   //alert('Menu box id: ' + menubox.id + ' type: ' + menubox.nodeName);
   menubox.className = 'sideMenuBoxOver';
   
}

function unselectside(boxId, selected)
{
   var menubox = document.getElementById(boxId);
   if(selected == true)
   {
      menubox.className = 'sideMenuboxSel';
   }
   else
   {
      menubox.className = 'sideMenuBox';
   }
}

function high(menu) {
    menu.style.background = "#a8bcbc"
}

function deHigh(menu) {
    menu.style.background = "#000000"
}

function load(url) {
    document.location.href = url
}

function OpenWindow(url, winName, width, height) {
  aPopup=window.open(url,'_'+winName,'toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width=' + width + ',height=' + height)
  //aPopup=window.open(url,'_'+winName)
  aPopup.focus()
  return aPopup
}
