
register_hook('load', function() {
      var as = $('scroll').getElementsByTagName('a');
      addEvent(as[0], 'mousedown', function() { scroller.start_scroll(-40) });
      addEvent(as[1], 'mousedown', function() { scroller.start_scroll(40) });
      addEvent(document.body, 'mouseup', scroller.stop_scroll);
      document.attachEvent?
      $('innerExhibit').attachEvent("onmousewheel", scroller.wheel)
      :$('innerExhibit').addEventListener("DOMMouseScroll", scroller.wheel,false);
   });

var scroller = {
   move: 0,
   timer: null,

   wheel: function(e) {
      var move=e.wheelDelta||(e.preventDefault(),-e.detail);
      scroller.do_scroll(-move);
      return false;
   },

   start_scroll:  function(m) {
      scroller.move = m;
      scroller.do_scroll(scroller.move);
      scroller.timer = setInterval(function() { scroller.do_scroll(scroller.move); }, 100);
   },

   stop_scroll: function() {
      if(!scroller.timer) return;
      scroller.move = 0;
      clearInterval(scroller.timer);
      scroller.timer = null;
   },

   do_scroll: function(move) {
      var ifm = $('txtExhibit').contentWindow;
      var top = (ifm.document.documentElement.scrollTop || ifm.document.body.scrollTop);
      ifm.scrollTo(0, top+move);
   }
};


