<!-------------------------------------------------------------------------------------------------
//
//	Begin IE Script
//
//------------------------------------------------------------------------------------------------>

// Event handlers ---------------------------------------------------------------------------------

var acoreie_expandedObjects = new Array();  // array of expanded groups 
var acoreie_expandCount = 0;                // expanded group count 

var acoreie_expandTimerID = 0;	          // timer for the current expanding group 
var acoreie_collapseTimerID = 0;          // timer for the current collapsing group 
var acoreie_collapseAllTimerID = 0;       // timer for collapseAll
var acoreie_expandingGroup = '';          // current expanding group name 
var acoreie_collapsingGroup = '';         // current collapsing group name 
var acoreie_restoredGroup = '';           // group that got focus after collapseAll has been called
var acoreie_collapsingAll = false;        // whether the collapseAll command is pending 
var acoreie_curItem = '';                 // current menu item 
var acoreie_hideSelectElems = true;       // whether to hide HTML select elements
var acoreie_overlayWindowed = true;      // whether to overlay windowed controls
var acoreie_shadows = new Array();        // used to hold shadow rectangles
var acoreie_shadowEnabled = true;        // whether shadow is enabled
var acoreie_shadowColor = '#777777';      // shadow color
var acoreie_shadowOffest = 4;             // shadow offset
var acoreie_contextUp = false;            // whether a context menu is up 
var acoreie_mac = false;		  // whether the client is a Mac IE
var acoreie_marginX = false;		  // Left page margin in pixels (only matters on Macs)
var acoreie_marginY = false;	          // Top page margin in pixels (only matters on Macs)


// Positions the subgroup for the given item, and initiates its expansion 
function acoreie_itemMsOver(item, subGroup, expandDirection, horAdj, verAdj, expandDelay, effect) 
{
  var newLeft = 0; 
  var newTop = 0; 
  var oItem = document.all[item]; 
  var oSubGroup = document.all[subGroup]; 
    
  if (acoreie_curItem != item)
  {
    acoreie_curItem = item; 
  
    switch (expandDirection)
    {
      case 'belowleft': 
        newLeft = acoreie_pageX(oItem); 
        if (newLeft + oSubGroup.offsetWidth > window.document.body.clientWidth)
          newLeft = acoreie_pageX(oItem) + oItem.offsetWidth - oSubGroup.offsetWidth; 
        newTop = acoreie_pageY(oItem) + oItem.offsetHeight; 
        break; 
      case 'belowright': 
        newLeft = acoreie_pageX(oItem) + oItem.offsetWidth - oSubGroup.offsetWidth; 
        newTop =  acoreie_pageY(oItem) + oItem.offsetHeight; 
        break; 
      case 'aboveleft': 
        newLeft = acoreie_pageX(oItem); 
        newTop =  acoreie_pageY(oItem) - oSubGroup.offsetHeight; 
        break; 
      case 'aboveright': 
        newLeft = acoreie_pageX(oItem) + oItem.offsetWidth - oSubGroup.offsetWidth; 
        newTop =  acoreie_pageY(oItem) - oSubGroup.offsetHeight; 
        break; 
      case 'rightdown': 
        newLeft = acoreie_pageX(oItem) + oItem.offsetWidth; 
        if (newLeft + oSubGroup.offsetWidth > window.document.body.clientWidth)
          newLeft = acoreie_pageX(oItem) - oSubGroup.offsetWidth; 
        newTop = acoreie_pageY(oItem); 
        if (newTop + oSubGroup.offsetHeight > window.document.body.clientHeight)
          newTop = acoreie_pageY(oItem) - oSubGroup.offsetHeight + oItem.offsetHeight; 
        break; 
      case 'rightup': 
        newLeft = acoreie_pageX(oItem) + oItem.offsetWidth; 
        newTop = acoreie_pageY(oItem) - oSubGroup.offsetHeight + oItem.offsetHeight; 
        break; 
      case 'leftdown': 
        newLeft = acoreie_pageX(oItem) - oSubGroup.offsetWidth; 
        newTop = acoreie_pageY(oItem); 
        break; 
      case 'leftup': 
        newLeft = acoreie_pageX(oItem) - oSubGroup.offsetWidth; 
        newTop = acoreie_pageY(oItem) - oSubGroup.offsetHeight + oItem.offsetHeight; 
        break; 
      default: 
        newLeft = acoreie_pageX(oItem) + oItem.offsetWidth; 
        newTop = acoreie_pageY(oItem); 
        break; 
    }  
    newLeft += horAdj; 
    newTop += verAdj; 
    if (newTop < 0) newTop = 0; 
    if (newLeft < 0) newLeft = 0; 
    
    oSubGroup.style.left = newLeft + 'px'; 
    oSubGroup.style.top = newTop + 'px'; 

    acoreie_startExpand(subGroup, expandDelay, effect); 
  }
}

// If the mouse pointer is not over the given item or its subGroup, 
// this function initiates the collapse of the subGroup. 
function acoreie_itemMsOut(item, group, subGroup, expandDelay, effect)
{
  if ((!(acoreie_isMouseOnObject(item))) && subGroup) 
    if (!(acoreie_isMouseOnObject(subGroup)))
    {
      acoreie_curItem = ''; 
      acoreie_startCollapse(subGroup, expandDelay, effect);
    }  
}

// This event handler is only called on expandable groups. If collapseAll is pending, it sets the 
// global variable acoreie_restoredGroup to the given group, so that the group and its parent groups 
// are not collapsed. It also stops the collapse if it has been issued for this group. 
function acoreie_groupMsOver(group)
{
  if (acoreie_collapsingAll) acoreie_restoredGroup = group; 

  if (acoreie_collapsingGroup == group) 
  {
    acoreie_stopCollapse(); 
    acoreie_stopExpand(); 
  }
}

// If the mouse pointer is on the given group, its subGroup, or its parent item this function 
// does nothing. If the pointer is over the parent group, but outside the parent item, then it
// initiates the collapse of itself and its subGroup (if any). 
// Otherwise, the pointer is outside the menu structure and it initiates the collapse of all 
// expanded objects. 
function acoreie_groupMsOut(group, parentItem, parentGroup, expandDelay, effect)
{ 
  if (!(acoreie_isMouseOnObject(group)))
  {
    acoreie_curItem = ''; 

    var subGroup = acoreie_expandedObjects[acoreie_expandCount]; 
    if (subGroup == group) subGroup = null; 

    if (parentItem == null && parentGroup == null && !(acoreie_isMouseOnObject(group)))
      acoreie_startCollapseAll(expandDelay, effect);     
    else if (acoreie_isMouseOnObject(group) || acoreie_isMouseOnObject(subGroup) || acoreie_isMouseOnObject(parentItem))
      ; // do nothing 
    else if (acoreie_isMouseOnObject(parentGroup))
    {
      acoreie_startCollapse(group, expandDelay, effect); 
      acoreie_startCollapse(subGroup, expandDelay, effect); 
    }
    else
      acoreie_startCollapseAll(expandDelay, effect);     
  }
}

// Expand/collapse timer functinos ----------------------------------------------------------------

// Initiates the expand of the given group. 
function acoreie_startExpand(group, interval, effect)
{
  if (group == acoreie_collapsingGroup) acoreie_stopCollapse(); 
  if (group != acoreie_expandingGroup) acoreie_stopExpand();  
  
  acoreie_restoredGroup = group; 
  
  acoreie_expandingGroup = group; 
  if (group) group += '.id'; 
  if (effect) effect = "'" + effect + "'";  
  acoreie_expandTimerID = setTimeout('acoreie_expand(' + group + ', ' + effect + ')', interval); 
}

// Initiates the collapse of the given group. 
function acoreie_startCollapse(group, interval, effect)
{
  if (group == acoreie_expandingGroup) acoreie_stopExpand(); 

  if (group) 
    if (document.all[group].style.visibility == 'visible') 
    {
      acoreie_collapsingGroup = group; 
      group += '.id'; 
      if (effect) effect = "'" + effect + "'";  
      acoreie_collapseTimerID = setTimeout('acoreie_collapse(' + group + ', ' + effect + ')', interval); 
    }  
}

// Initiates the collapse of all expanded objects. 
function acoreie_startCollapseAll(interval, effect)
{
  acoreie_stopCollapse(); 
  acoreie_stopExpand(); 
  acoreie_stopCollapseAll(); 

  acoreie_collapsingAll = true; 
  if (effect) 
  {
    effect = "'" + effect + "'";  
    acoreie_collapseAllTimerID = setTimeout('acoreie_collapseAll(' + effect + ')', interval); 
  }
  else
    acoreie_collapseAllTimerID = setTimeout('acoreie_collapseAll(null)', interval); 
}

// Stops the expand of the currently expanding group. 
function acoreie_stopExpand()
{
  clearTimeout(acoreie_expandTimerID); 
  acoreie_expandingGroup = ''; 
}

// Stops the collapse of the currently collapsing group. 
function acoreie_stopCollapse()
{
  clearTimeout(acoreie_collapseTimerID); 
  acoreie_collapsingGroup = ''; 
}

// Stops the collapse of all currently expanding objects. 
function acoreie_stopCollapseAll()
{
  clearTimeout(acoreie_collapseAllTimerID); 
  acoreie_restoredGroup = '';
}


// Core functions ---------------------------------------------------------------------------------

// Expands the given menu group 
function acoreie_expand(group, effect)
{
  if (document.all[group].style.visibility != 'visible')
  {
    acoreie_hideSelectElements(group); 
    if (effect) 
    {
      document.all[group].style.filter = effect; 
      document.all[group].filters[0].Apply(); 
    }  
    document.all[group].style.visibility = 'visible'; 
    acoreie_makeDropShadow(group); 
    if (effect) document.all[group].filters[0].Play(); 
    acoreie_expandCount++; 
    acoreie_expandedObjects[acoreie_expandCount] = group; 
  }  
}


// Collapses the given menu group 
function acoreie_collapse(group, effect)
{
  if (group) 
  {
    if (document.all[group].style.visibility != 'hidden')
    {
      if (effect)
      {
        document.all[group].style.filter = effect; 
        document.all[group].filters[0].Apply(); 
      }
      document.all[group].style.visibility = 'hidden';     
      if (effect) document.all[group].filters[0].Play(); 
      acoreie_expandCount--; 
      acoreie_clearDropShadow(group); 
    }      
  }
  if (!(acoreie_contextUp) && acoreie_expandCount == 0) 
    acoreie_restoreSelectElements(); 
}

// Collapses all expanded menu groups 
function acoreie_collapseAll(effect)
{
  for (var i = acoreie_expandCount; i >= 1; i--)
  {
    if (acoreie_expandedObjects[i] == acoreie_restoredGroup) break; 

    if (effect)
    {
      document.all[acoreie_expandedObjects[i]].style.filter = effect; 
      document.all[acoreie_expandedObjects[i]].filters[0].Apply(); 
    }
    document.all[acoreie_expandedObjects[i]].style.visibility = 'hidden';
    acoreie_clearDropShadow(acoreie_expandedObjects[i]); 
    if (effect) document.all[acoreie_expandedObjects[i]].filters[0].Play(); 
  }

  acoreie_collapsingAll = false; 
  acoreie_expandCount = i;
  acoreie_restoredGroup = ''; 
  if (!(acoreie_contextUp) && acoreie_expandCount == 0) 
    acoreie_restoreSelectElements(); 
}

// Hides all menu groups prior to calling ClientSideOnClick event handler
function acoreie_hideAllGroups()
{
  acoreie_curItem = ''; 
  acoreie_restoredGroup = ''; 
  acoreie_collapseAll(null); 
}

// Utilities --------------------------------------------------------------------------------------

// Updates menu item class, left icon, and right icon 
function acoreie_updateCell(Element, NewClassName, LeftImage, LeftImageSrc, RightImage, RightImageSrc, direction)
{  
  if (direction == 'out' && acoreie_isMouseOnObject(Element))    
    ;   
  else  
  {    
    if (Element != null & NewClassName != '') document.all[Element].className = NewClassName;
    if (LeftImage != null  && LeftImageSrc != '') document.images[LeftImage].src = LeftImageSrc;     
    if (RightImage != null && RightImageSrc != '') document.images[RightImage].src = RightImageSrc;   
  }
}

// Determines whether the mouse pointer is currently over the given object 
function acoreie_isMouseOnObject(objName)
{
  if (objName)
  {
    var objLeft = acoreie_pageX(document.all[objName]) - window.document.body.scrollLeft + 1; 
    var objTop = acoreie_pageY(document.all[objName]) - window.document.body.scrollTop + 1; 
    var objRight = objLeft + document.all[objName].offsetWidth - 1; 
    var objBottom = objTop + document.all[objName].offsetHeight - 1;
  
    if ((event.x > objLeft) && (event.x < objRight) && 
        (event.y > objTop) && (event.y < objBottom))
      return true; 
    else  
      return false; 
  }
  else
    return false; 
}

// Calculates the absolute page x coordinate of any element
function acoreie_pageX(element)
{
  var x = 0;
  do 
  {
    if (element.style.position == 'absolute') 
    {
      return x + element.offsetLeft; 
    }
    else
    {
      x += element.offsetLeft;
      if (element.offsetParent) 
        if (element.offsetParent.tagName == 'TABLE') 
          if (parseInt(element.offsetParent.border) > 0)
          {
            x += 1; 
          }
    }
  }
  while ((element = element.offsetParent));
  return x; 
}

// Calculates the absolute page y coordinate of any element
function acoreie_pageY(element)
{
  var y = 0;
  do 
  {
    if (element.style.position == 'absolute') 
    {
      return y + element.offsetTop; 
    }
    else
    {
      y += element.offsetTop;
      if (element.offsetParent) 
        if (element.offsetParent.tagName == 'TABLE') 
          if (parseInt(element.offsetParent.border) > 0)
          {
            y += 1; 
          }
    }
  }
  while ((element = element.offsetParent));
  return y; 
}


// Hides HTML select elements that are overlapping the given menu group 
function acoreie_hideSelectElements(group)
{
  if (document.getElementsByTagName) 
  {
    var arrElements = document.getElementsByTagName('select'); 
    if (acoreie_hideSelectElems) 
    {
      for (var i = 0; i < arrElements.length; i++) 
        if (acoreie_objectsOverlapping(document.all[group], arrElements[i]))
          arrElements[i].style.visibility = 'hidden';          
    }
  }
}

// Restores all HTML select elements on the page 
function acoreie_restoreSelectElements()
{
  if (document.getElementsByTagName) 
  {
    var arrElements = document.getElementsByTagName('select'); 
    if (acoreie_hideSelectElems) 
      for (var i = 0; i < arrElements.length; i++) 
        arrElements[i].style.visibility = 'visible'; 
  }
}

// Whether the given objects are overlapping 
function acoreie_objectsOverlapping(obj1, obj2)
{
  var result = true; 
  var obj1Left = acoreie_pageX(obj1) - window.document.body.scrollLeft; 
  var obj1Top = acoreie_pageY(obj1) - window.document.body.scrollTop; 
  var obj1Right = obj1Left + obj1.offsetWidth; 
  var obj1Bottom = obj1Top + obj1.offsetHeight;
  var obj2Left = acoreie_pageX(obj2) - window.document.body.scrollLeft; 
  var obj2Top = acoreie_pageY(obj2) - window.document.body.scrollTop; 
  var obj2Right = obj2Left + obj2.offsetWidth; 
  var obj2Bottom = obj2Top + obj2.offsetHeight;
  
  if (obj1Right <= obj2Left || obj1Bottom <= obj2Top || 
      obj1Left >= obj2Right || obj1Top >= obj2Bottom) 
    result = false; 
  return result; 
}

// Creates a drop shadow for an object 
function acoreie_makeDropShadow(objName)
{
  if (acoreie_shadowEnabled) 
  {
    acoreie_shadows[objName] = new Array(); 
	  for (var i = acoreie_shadowOffest; i > 0; i--)
	  {
	    var obj = document.all[objName]; 
		  var rect = document.createElement('div');
		  var rs = rect.style
		  rs.position = 'absolute';
		  rs.left = (obj.style.posLeft + i) + 'px';
		  rs.top = (obj.style.posTop + i) + 'px';
		  rs.width = obj.offsetWidth + 'px';
		  rs.height = obj.offsetHeight + 'px';
		  rs.zIndex = obj.style.zIndex - i;
		  rs.backgroundColor = acoreie_shadowColor;
		  var opacity = 1 - i / (i + 1);
		  rs.filter = 'alpha(opacity=' + (100 * opacity) + ')';
		  obj.insertAdjacentElement('afterEnd', rect);
		  acoreie_shadows[objName][acoreie_shadows[objName].length] = rect; 
	  }
	}
}

// Clears the drop shadow for the given object 
function acoreie_clearDropShadow(objName)
{
  if (acoreie_shadowEnabled) 
  {
    var curShadow; 
    for (var i = 0; i < acoreie_shadows[objName].length; i++)
    {
      curShadow = acoreie_shadows[objName][i]; 
      curShadow.style.filter = 'alpha(opacity=0)'; 
      curShadow.removeNode(true); 
    }
  }  
}

// Positions the menu based on the alignment, offsetX, and offsetY properties
function acoreie_positionMenu(menu, alignment, offsetX, offsetY)
{
  var scrlLeft = 0; 
  var scrlTop = 0;
  var clientW = window.document.body.clientWidth; 
  var clientH = window.document.body.clientHeight; 
  var menuWidth = menu.offsetWidth; 
  var menuHeight = menu.offsetHeight; 
  var newLeft = 0; 
  var newTop = 0; 

  switch (alignment)
  {
    case 'topleft': 
      newLeft = scrlLeft;
      newTop = scrlTop;
      break; 
    case 'topmiddle': 
      newLeft = (clientW - menuWidth) / 2 + scrlLeft;
      newTop = scrlTop;
      break; 
    case 'topright': 
      newLeft = clientW + scrlLeft - menuWidth;
      newTop = scrlTop;
      break; 
    case 'bottomleft': 
      newLeft = scrlLeft;
      newTop = clientH + scrlTop - menuHeight;
      break; 
    case 'bottommiddle': 
      newLeft = (clientW - menuWidth) / 2 + scrlLeft;
      newTop = clientH + scrlTop - menuHeight;
      break; 
    case 'bottomright': 
      newLeft = clientW + scrlLeft - menuWidth;
      newTop = clientH + scrlTop - menuHeight;
      break; 
    default: 
      newLeft = clientW + scrlLeft;
      newTop = clientH + scrlTop;
      break; 
  }    
  
  newLeft += offsetX; 
  newTop += offsetY; 
  menu.style.left = newLeft; 
  menu.style.top = newTop; 
}

<!-------------------------------------------------------------------------------------------------
//
//	Begin Mozilla Script
//
//------------------------------------------------------------------------------------------------>
var acoremoz_hideSelectElems = true;     // whether to hide HTML select elements 
var acoremoz_overlayWindowed = true;    // whether to overlay windowed controls
var acoremoz_dragging = false;           // whether the menu is being moved 
var acoremoz_contextUp = false;          // whether a context menu is up

var acoremoz_expandedObjects = new Array();  // array of expanded groups 
var acoremoz_expandCount = 0;                // expanded group count 


// Event handlers ---------------------------------------------------------------------------------

// Positions the subgroup for the given item, and initiates its expansion 
function acoremoz_itemMsOver(item, subGroup, expandDirection, horAdj, verAdj, expandDelay) 
{
  var newLeft = 0; 
  var newTop = 0; 
  var oItem = document.getElementById(item); 
  var oSubGroup = document.getElementById(subGroup); 

  switch (expandDirection)
  {
    case 'belowleft': 
      newLeft = acoremoz_pageX(oItem); 
      newTop = acoremoz_pageY(oItem) + oItem.offsetHeight; 
      break; 
    case 'belowright': 
      newLeft = acoremoz_pageX(oItem) + oItem.offsetWidth - oSubGroup.offsetWidth; 
      newTop =  acoremoz_pageY(oItem) + oItem.offsetHeight; 
      break; 
    case 'aboveleft': 
      newLeft = acoremoz_pageX(oItem); 
      newTop =  acoremoz_pageY(oItem) - oSubGroup.offsetHeight; 
      break; 
    case 'aboveright': 
      newLeft = acoremoz_pageX(oItem) + oItem.offsetWidth - oSubGroup.offsetWidth; 
      newTop =  acoremoz_pageY(oItem) - oSubGroup.offsetHeight; 
      break; 
    case 'rightdown': 
      newLeft = acoremoz_pageX(oItem) + oItem.offsetWidth; 
      newTop = acoremoz_pageY(oItem); 
      break; 
    case 'rightup': 
      newLeft = acoremoz_pageX(oItem) + oItem.offsetWidth; 
      newTop = acoremoz_pageY(oItem) - oSubGroup.offsetHeight + oItem.offsetHeight; 
      break; 
    case 'leftdown': 
      newLeft = acoremoz_pageX(oItem) - oSubGroup.offsetWidth; 
      newTop = acoremoz_pageY(oItem); 
      break; 
    case 'leftup': 
      newLeft = acoremoz_pageX(oItem) - oSubGroup.offsetWidth; 
      newTop = acoremoz_pageY(oItem) - oSubGroup.offsetHeight + oItem.offsetHeight; 
      break; 
    default: 
      newLeft = acoremoz_pageX(oItem) + oItem.offsetWidth; 
      newTop = acoremoz_pageY(oItem); 
      break; 
  }  

  newLeft += horAdj; 
  if (verAdj < 0) newTop += verAdj; 
  if (!(navigator.userAgent.indexOf('Netscape6') > 0))   {    var cs = window.getComputedStyle(oSubGroup, ''); 
    var topCorrection = parseInt(cs.getPropertyValue('border-top-width').replace('px', ''));  
    var leftCorrection = parseInt(cs.getPropertyValue('border-left-width').replace('px', ''));  
    newLeft += topCorrection;     newTop += topCorrection;   }
  oSubGroup.style.left = newLeft + 'px'; 
  oSubGroup.style.top = newTop + 'px'; 
  
  acoremoz_expand(subGroup); 
}

// If the mouse pointer is not over the given item or its subGroup, 
// this function initiates the collapse of the subGroup. 
function acoremoz_itemMsOut(item, group, subGroup, expandDelay, evt)
{
  if (!(acoremoz_isMouseOnObject(subGroup, evt)))
    acoremoz_collapse(subGroup);
}

// Not needed if expand delay is not implemented. 
function acoremoz_groupMsOver(group)
{

}

// If the mouse pointer is on the given group, its subGroup, or its parent item this function 
// does nothing. If the pointer is over the parent group, but outside the parent item, then it
// initiates the collapse of itself and its subGroup (if any). 
// Otherwise, the pointer is outside the menu structure and it initiates the collapse of all 
// expanded objects. 
function acoremoz_groupMsOut(group, parentItem, parentGroup, expandDelay, evt)
{ 
  var subGroup = acoremoz_expandedObjects[acoremoz_expandCount]; 
  if (subGroup == group) subGroup = null; 

  
  if (acoremoz_isMouseOnObject(group, evt) || acoremoz_isMouseOnObject(subGroup, evt) || acoremoz_isMouseOnObject(parentItem, evt))
    ; //alert('do nothing');   // do nothing 
  else if (acoremoz_isMouseOnObject(parentGroup, evt))
  {
    acoremoz_collapse(group); 
    acoremoz_collapse(subGroup); 
  }
  else
  {
    acoremoz_collapseAll(); 
  }
}

// Core functions ---------------------------------------------------------------------------------

// Expands the given menu group 
function acoremoz_expand(group)
{
  var oGroup = document.getElementById(group); 
  if (oGroup.style.visibility != 'visible')
  {
    acoremoz_hideSelectElements(group); 
    oGroup.style.visibility = 'visible'; 
    acoremoz_expandCount++; 
    acoremoz_expandedObjects[acoremoz_expandCount] = group; 
  }  
}

// Collapses the given menu group 
function acoremoz_collapse(group)
{
  var oGroup = document.getElementById(group); 
  if (group != null && group) 
    if (oGroup.style.visibility != 'hidden')
    {
      oGroup.style.visibility = 'hidden';     
      acoremoz_expandCount--; 
    }  
  if (!(acoremoz_contextUp) && acoremoz_expandCount == 0) 
    acoremoz_restoreSelectElements(); 
}

// Collapses all expanded menu groups 
function acoremoz_collapseAll()
{
  for (var i = acoremoz_expandCount; i >= 1; i--)
  {
    var oGroup = document.getElementById(acoremoz_expandedObjects[i]); 
    oGroup.style.visibility = 'hidden';
  }
  acoremoz_expandCount = 0;   
  if (!(acoremoz_contextUp) && acoremoz_expandCount == 0) 
    acoremoz_restoreSelectElements(); 
}

// Hides all menu groups prior to calling ClientSideOnClick event handler
function acoremoz_hideAllGroups()
{
  acoremoz_collapseAll(); 
}

// Utilities --------------------------------------------------------------------------------------

// Determines whether the mouse pointer is currently over the given object 
function acoremoz_isMouseOnObject(objName, evt)
{
  if (objName != null)
  {
    var obj = document.getElementById(objName); 
    var objLeft = acoremoz_pageX(obj) - 1; 
    var objTop = acoremoz_pageY(obj) - 1; 
    var objRight = objLeft + obj.offsetWidth + 1; 
    var objBottom = objTop + obj.offsetHeight + 1;
    
    if ((evt.pageX > objLeft) && (evt.pageX < objRight) && 
        (evt.pageY > objTop) && (evt.pageY < objBottom))
      return true; 
    else  
      return false; 
  }
  else
    return false; 
}

// Calculates the absolute page x coordinate of any element
function acoremoz_pageX(element)
{
  var x = 0;
  do 
  {
    if (element.style.position == 'absolute') 
    {
      return x + element.offsetLeft; 
    }
    else
    {
      x += element.offsetLeft;
      if (element.offsetParent) 
        if (element.offsetParent.tagName == 'TABLE') 
          if (parseInt(element.offsetParent.border) > 0)
          {
            x += 1; 
          }
    }
  }
  while ((element = element.offsetParent));
  return x; 
}

// Calculates the absolute page y coordinate of any element
function acoremoz_pageY(element)
{
  var y = 0;
  do 
  {
    if (element.style.position == 'absolute') 
    {
      return y + element.offsetTop; 
    }
    else
    {
      y += element.offsetTop;
      if (element.offsetParent) 
        if (element.offsetParent.tagName == 'TABLE') 
          if (parseInt(element.offsetParent.border) > 0)
          {
            y += 1; 
          }
    }
  }
  while ((element = element.offsetParent));
  return y; 
}


// Hides HTML select elements that are overlapping the given menu group 
function acoremoz_hideSelectElements(group)
{
  if (document.getElementsByTagName) 
  {
    var arrElements = document.getElementsByTagName('select'); 
    if (acoremoz_hideSelectElems) 
      for (var i = 0; i < arrElements.length; i++) 
        if (acoremoz_objectsOverlapping(document.getElementById(group), arrElements[i]))
          arrElements[i].style.visibility = 'hidden'; 
  }
}

// Whether the given objects are overlapping 
function acoremoz_objectsOverlapping(obj1, obj2)
{
  var result = true; 
  var obj1Left = acoremoz_pageX(obj1); 
  var obj1Top = acoremoz_pageY(obj1); 
  var obj1Right = obj1Left + obj1.offsetWidth; 
  var obj1Bottom = obj1Top + obj1.offsetHeight;
  var obj2Left = acoremoz_pageX(obj2); 
  var obj2Top = acoremoz_pageY(obj2); 
  var obj2Right = obj2Left + obj2.offsetWidth; 
  var obj2Bottom = obj2Top + obj2.offsetHeight;
  
  if (obj1Right <= obj2Left || obj1Bottom <= obj2Top || 
      obj1Left >= obj2Right || obj1Top >= obj2Bottom) 
    result = false; 
  return result; 
}

// Restores all HTML select elements on the page 
function acoremoz_restoreSelectElements()
{
  if (document.getElementsByTagName) 
  {
    var arrElements = document.getElementsByTagName('select'); 
    if (acoremoz_hideSelectElems) 
      for (var i = 0; i < arrElements.length; i++) 
        arrElements[i].style.visibility = 'visible'; 
  }
}

// Positions the menu based on the alignment, offsetX, and offsetY properties
function acoremoz_positionMenu(menu, alignment, offsetX, offsetY)
{
  if (acoremoz_dragging) return false; 
  var scrlLeft = window.pageXOffset; 
  var scrlTop = window.pageYOffset;
  var clientW = window.innerWidth; 
  var clientH = window.innerHeight; 
  var menuWidth = menu.offsetWidth; 
  var menuHeight = menu.offsetHeight; 
  var newLeft = 0; 
  var newTop = 0; 

  switch (alignment)
  {
    case 'topleft': 
      newLeft = scrlLeft;
      newTop = scrlTop;
      break; 
    case 'topmiddle': 
      newLeft = (clientW - menuWidth) / 2 + scrlLeft;
      newTop = scrlTop;
      break; 
    case 'topright': 
      newLeft = clientW + scrlLeft - menuWidth;
      newTop = scrlTop;
      break; 
    case 'bottomleft': 
      newLeft = scrlLeft;
      newTop = clientH + scrlTop - menuHeight;
      break; 
    case 'bottommiddle': 
      newLeft = (clientW - menuWidth) / 2 + scrlLeft;
      newTop = clientH + scrlTop - menuHeight;
      break; 
    case 'bottomright': 
      newLeft = clientW + scrlLeft - menuWidth;
      newTop = clientH + scrlTop - menuHeight;
      break; 
    default: 
      newLeft = clientW + scrlLeft;
      newTop = clientH + scrlTop;
      break; 
  }    
  
  newLeft += offsetX; 
  newTop += offsetY; 
  menu.style.left = newLeft; 
  menu.style.top = newTop; 
}

