/* All content below is the intellectual property of Crown Productions. */

// runs the function fn once the entire page has been loaded
function runAfterLoad(fn)
{
  if (typeof window.addEventListener != 'undefined'){
    window.addEventListener('load', fn, false);
  }else if (typeof document.addEventListener != 'undefined'){
    document.addEventListener('load', fn, false);
  }else if (typeof window.attachEvent != 'undefined'){
    window.attachEvent('onload', fn);
  }else{
    var oldfn = window.onload;
    if (typeof window.onload != 'function'){
      window.onload = fn;
    }else{
      window.onload = function()
      {
        oldfn();
        fn();
      };
    }
  }
}
// gets the current scroll position of the page in any browser
function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    // Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    // DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    // IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}