//This function takes care of any tasks needed
//as part of the bodyOnload of every page
function pageInit(sLeftNavigationClassNameOverride)
{        
    //if a value was passed in for which sub-navigation (left side) tab
    //should be selected, then select it...
    if(m_leftNavigationLinkSelected != null && m_leftNavigationLinkSelected.toUppercase != "NULL")
    {
        //see if an override was passed in (b/c some pages need specialized class
        //b/c they have indented sub-menus or the like)
        
        var sClassName = "selected";
        
        if(sLeftNavigationClassNameOverride != null)
        {
            sClassName = sLeftNavigationClassNameOverride;
        }
        
        //with dropdown menu including the same menu items as the side bar menu, can't use ID to identify
        //them anymore, b/c more than one.  So use NAME, get array (of > 1 items), and set the last to be
        //selected (b/c some things show up two different places in dropdown menu)...
        var arrMenuItems = document.getElementsByName(m_leftNavigationLinkSelected);
        var numMenuItems = arrMenuItems.length;
        arrMenuItems[numMenuItems-1].className = sClassName;
    }      

}

/******************************************************************************/

//This set of functions keeps track of the X and Y coordinates of the cursor.
//Thanks to http://snipplr.com/view/3624/show-floating-div-near-cursor-on-mouseover-hide-on-mouseout/
var cursorX = 0;
var cursorY = 0;
var offsetX = 0;
var offsetY = 0;

if(document.all)
{
  document.onmousemove = UpdateCursorPositionDocAll;
}
else
{
  document.onmousemove = UpdateCursorPosition;
}

function UpdateCursorPositionDocAll(e)
{
  cursorX = event.clientX;
  cursorY = event.clientY;
}

function UpdateCursorPosition(e)
{
  cursorX = e.pageX;
  cursorY = e.pageY;
}

/******************************************************************************/

//This function assigns the current X and Y coordinates (plus a small offset)
//to the object passed in, to the top and left syle attributes...
function setXYPosition(oObject)
{
  //this if/else figures out if an offset is necessary...
  if(self.pageYOffset)
  {
	  offsetX = self.pageXOffset;
	  offsetY = self.pageYOffset;
	}
  else if(document.documentElement && document.documentElement.scrollTop)
  {
	  offsetX = document.documentElement.scrollLeft;
	  offsetY = document.documentElement.scrollTop;
	}
  else if(document.body)
  {
	  offsetX = document.body.scrollLeft;
	  offsetY = document.body.scrollTop;
	}
  
  //and for IE, assigns it to main cursor coordinates
  if(document.all)
  {
	  cursorX += offsetX; 
	  cursorY += offsetY;
	}

  // assign to top and left, +/- small fudge factor...
  //(NOTE: For JPConcerts, since all events on Thursday or later, make it so TOP RIGHT
  // corner of popup is at cursor...)
  oObject.style.left = (cursorX - oObject.clientWidth) + "px";
  oObject.style.top = (cursorY - 5) + "px";
}