/* ------------------------------------------------------------------
global.js
Javscript functions that are used throughout the site.
------------------------------------------------------------------ */


/* ------------------------------------------------------------------
Global Javascripts
Scripts to be used globally throughout a site
------------------------------------------------------------------ */


/* addLoadEvent() - Allows multiple javascript functions to be 
called when the document loads.
------------------------------------------------------------------ */
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } 
  else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}


/* externalLinks() - Causes any anchor tag with rel="external" to be 
opened in a new window.
------------------------------------------------------------------ */
function externalLinks() {
  if (!document.getElementsByTagName) return;
  var anchors = document.getElementsByTagName("a");
  for (var i=0; i<anchors.length; i++) {
    var anchor = anchors[i];
    if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
      anchor.target = "_blank";
    }
  }
}


/* Call JS Functions
------------------------------------------------------------------ */
addLoadEvent(function() {
  
  // sIFR Calls
  if(typeof sIFR == "function"){
    sIFR.replaceElement(named({sSelector:"#main h1",sFlashSrc:"_assets/flash/sifr-bankgothic.swf", sColor:"#d9531e", sLinkColor:"#d9531e", sBgColor:"#f8f8f8", sHoverColor:"#d9531e"}));
  };
  
  // External Links
  externalLinks();
  
});


