// load events
addLoadEvent(externalLinks);
addLoadEvent(stopFlicker);

// addLoadEvent
// queues load events, and executes them on page load one after the other

function addLoadEvent(func)
{
  var oldonload = window.onload;
  if (typeof window.onload != 'function')
    window.onload = func;
  else
  {
    window.onload = function()
    {
      if (oldonload) oldonload();
      func();
    } // function()
  } // else
} // addLoadEvent()

// externalLinks
// opens links with a class of "externalLink" in a new window

function externalLinks()
{
  if (!document.getElementsByTagName) return false;
  var links = document.getElementsByTagName("a");
  for (var i=0; i < links.length; i++)
  {
    if (links[i].className.match("externalLink"))
    {
      links[i].onclick = function()
      {
        window.open(this.href);
        return false;
      } // function()
    } // if
  } // for
} // externalLinks()

// stopFlicker
// stops background image flicker in IE when hovering over an item

function stopFlicker()
{
  try
  {
    document.execCommand("BackgroundImageCache", false, true);
  } catch(err) {}
} // stopFlicker()