var marquee_step = 1;
var marquee_timer = "";
var scroller1, scroller2;

function initMarquee(){
  divScroller = $('marquee_div');
  scroller1 = $('scroller1');
  scroller2 = $('scroller2');
  divScroller.childElements().each(function(el){
    el.onmouseout = function() {
      marquee_step = 1;
    };
    el.onmouseover = function() {
      marquee_step = 0;
    };
  });

  scroller2.style.left = scroller1.getWidth() + 5 + "px";
  scrollDivUp();
}

function scrollDivUp(){
  clearInterval(marquee_timer);
  scroller1.style.left = parseInt(scroller1.style.left) - marquee_step + "px";
  scroller2.style.left = parseInt(scroller2.style.left) - marquee_step + "px";

  if(parseInt(scroller1.style.left) * (-1) >= scroller1.getWidth() + 10){
    scroller1.style.left = scroller2.getWidth() + 2 + "px";
  };
  if(parseInt(scroller2.style.left) * (-1) >= scroller2.getWidth() + 10){
    scroller2.style.left = scroller1.getWidth() + 2 + "px";
  };

  marquee_timer=setInterval("scrollDivUp()",0)
}

document.observe('dom:loaded', function(){
  initMarquee();
})
