
    

function horizScroller(opt)
{
   var d = 0;
   opt.delay = opt.delay || 50;
   opt.dist = opt.dist || 2;
   opt.leftEl.onmouseover = function() { d = -opt.dist; scroll(); }
   opt.leftEl.onmouseout = function() { d = 0 }
   opt.rightEl.onmouseover = function() { d = opt.dist; scroll(); }
   opt.rightEl.onmouseout = function() { d = 0 }
   
    function scroll()
   {
       if (!d) return;
       var x = opt.contentEl.scrollLeft+d, stop = false, rightBoundary = opt.contentEl.scrollWidth-opt.contentEl.offsetWidth;
       if (x < 0) {
           addClassName(opt.leftEl, 'disabled');
           x = 0;
           stop = true;
       } else {
           removeClassName(opt.leftEl, 'disabled');
       }
       if (x>=rightBoundary) {
           addClassName(opt.rightEl, 'disabled');
           x = rightBoundary;
           stop = true;
       } else {
           removeClassName(opt.rightEl, 'disabled');
       }
       opt.contentEl.scrollLeft = x;
       if (stop) return;
       window.setTimeout(scroll, opt.delay);
   }
   
   function addClassName(el, className)
   {
       el.className = el.className.replace(new RegExp(' ?'+className+'|$'), ' '+className);
   }
   
   function removeClassName(el, className)
   {
       el.className = el.className.replace(new RegExp(' ?'+className+'( |$)'), '$1');
   }
}


    

