function initScroller(container_id, highlight_class, interval, offset) {
var interval = (interval == null) ? 0.04 : interval;
var offset = (offset == null) ? 2 : offset;
var scroller = $(container_id);
var highlights = $$('#' + container_id + ' .' + highlight_class); // lista highlightow
var scroller_width = scroller.getDimensions().width;
var highlight_width = highlights.first().getDimensions().width; // szerokosc pojedynczego elementu
var highlights_count = highlights.length;

scroller.setStyle({position: 'relative', overflow: 'hidden'});

if((highlights_count-1) * highlight_width < scroller_width) {
  var missing_count = Math.floor((scroller_width - highlights_count * highlight_width)/highlight_width) + 10
    for(var i = 0; i < missing_count; i++) {
      var index = i %  highlights.length;
      scroller.appendChild(highlights[index].cloneNode(true));
    }
  // update
  highlights = $$('#' + container_id + ' .' + highlight_class);
  highlights_count = highlights.length;
}



// pozycja i styl poczatkowy
highlights.each(function(value, index) {
  value.setStyle({position: 'absolute', left: (index * highlight_width) + "px"});
});


function tick() {
  highlights.each(function(value, index) {
    var left = parseInt(value.getStyle('left')) - offset; // obcinamy px
    if(left + highlight_width <= 0) {
     left = ((highlights_count - 1) * highlight_width) + left + highlight_width;
    }
	left=left+"px";
    value.setStyle({left: left});
  });
}
var executer = new PeriodicalExecuter(tick, interval);
Event.observe(scroller, 'mouseover', function() {executer.callback = function(){}});
Event.observe(scroller, 'mouseout', function() {executer.callback = tick});
};
