// Base JavasSript code for the VisWeb site.
//
// Author:  OrdinaSoft
//          Patrick Lanz
//          Lausanne
//          www.ordinasoft.ch
//
// First version: November 2, 2006


// Management of the "onload" event.
var
  OnLoadFired  = false;  // indicates if we have received an "onload" event


function AddLoadEvent (Func) {  // Adds the specified function
  if (OnLoadFired) {
    Func ();
    return true;
  }

  if (typeof window.addEventListener != 'undefined')
    window.addEventListener ('load', Func, false);
  else if (typeof document.addEventListener != 'undefined')
    document.addEventListener ('load', Func, false);
  else if (typeof window.attachEvent != 'undefined')
    window.attachEvent ('onload', Func);
  else {
    var
      OldFn = window.onload;
    if (typeof window.onload != 'function')
      window.onload = Func;
    else window.onload = function () {
        OldFn ();
        Func ();
      }
  }
  return true;
}


function BaseOnLoad () {  // Base "onload" event handler
  OnLoadFired = true;
  return true;
}

AddLoadEvent (BaseOnLoad);

