function addLoadEvent(fn) {
      var old = window.onload;
      if (typeof window.onload != 'function') {
         window.onload = fn;
      }
      else {
         window.onload = function() {
         old();
         fn();
         }
      }
   }
addLoadEvent(function(){
  ScrollerInit();
})

function ScrollerInit() {
  //calculate height of scroller and resize the scroller div
  //(however, we make sure that it isn't to small for long pages)
  //if(scroller.scrollH < 15) scroller.scrollH = 15;
  
  var sDocH = document.getElementById("myScrollContent").offsetHeight;
  var sContH = document.getElementById("myScrollContainer").offsetHeight;
  var sAreaH = document.getElementById("scrollArea").offsetHeight;
  var sHeight = (sContH * sAreaH) / sDocH;

  document.getElementById("scroller").style.height = Math.round(sHeight) + "px";
  

  //what is the effective scroll distance once the scoller's height has been taken into account
  var sDist = Math.round(sAreaH-sHeight);
  if (sDist<0) { sDist=0; }
  if (sDist>0) { objScroller.load(true); } else { objScroller.load(false); }
  
  //make the scroller div draggable
  Drag.init(document.getElementById("scroller"),null,0,0,-1,sDist);

  //add ondrag function
  document.getElementById("scroller").onDrag = function (x,y) {
    var scrollY = parseInt(document.getElementById("scroller").style.top);
    var docY = (scrollY * (sDocH - sContH) / sDist);
    objScroller.jumpTo(null, docY);
  }
}