// Horizontal scroller for css defined uniform-width layers contained in table cells
// Table is with "0" cellpadding and cellspacing
// You can modify bropcs, browdth, contwdth, flowstep and reflow to fit scroller into your page

  var bropcs = 6;         // number of brochures in row
  var browdth = 200;      // uniform width of brochures
  var contwdth = 800;     // box width containing scrolling row 
  var flowstep = 5;       // movement step when browsing the row
  var reflow = 100;       // time between movement steps (in ms)
  var wrapwdth = bropcs*browdth; // wrapper table calculated overall width

  function stepBro(dir) { // browsing the row in 'dir' direction
   object = document.getElementById("wrapper");
   pos = object.scrollLeft;
   if ((dir=="l") && (contwdth<wrapwdth+pos-flowstep)) pos = pos+flowstep;
   if ((dir=="r") && (pos>0)) pos = pos-flowstep;
   object.scrollLeft = pos;
   to = setTimeout("stepBro('"+dir+"')", reflow);
  }
 
  function stopBro() {    // stop browsing
   clearTimeout(to);
  }

  function nextBro(dir) { // step to the next unit in row in 'dir' direction
   object = document.getElementById("wrapper");
   pos = object.scrollLeft;
   if ((dir=="l") && (contwdth<wrapwdth+pos-browdth)) object.scrollLeft = Math.floor((pos+browdth)/browdth)*browdth;
   if ((dir=="r") && (pos>0)) object.scrollLeft = Math.floor((pos-1)/browdth)*browdth;
  }

