// This file contains globally useful functions. It should be called before
// loading any other javascript in the page.

// This function allows multiple javascript functions to run at page-load time
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  }
  else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

// This function replaces a default image specified by mapID (typically because
// it's an image map) with the new image.
function swapImage(mapID,newImage) {
  
  // Make sure the browser is worthy
  if (!document.getElementsByTagName) return false;
  if (!document.getElementById) return false;

  // Hunt down the image map
  if (!document.getElementById(mapID)) return false;
  var defimage = document.getElementById(mapID);
  defimage.setAttribute("src", newImage);
}
