var old_scroll_newsline = 0;
var dir_scroll_newsline = true;

function applyNewsLine() {
  Event.observe(window, 'load', function () {
      setTimeout('moveNewsLine()', 500);
    });
}

function moveNewsLine() {
  block = $("news_items");

  if (Prototype.Browser.IE) { // Bug at overflow hidden
    it_pos = Position.cumulativeOffset($("news_items"))[0];
    m_pos = Position.cumulativeOffset($("mark"))[0];
    block.style.width = m_pos - it_pos  + "px";
  }

  if (dir_scroll_newsline) {
    block.scrollLeft  = block.scrollLeft + 10;
  } else {
    block.scrollLeft  = block.scrollLeft - 10;
  }
  if (old_scroll_newsline == block.scrollLeft) {
    dir_scroll_newsline = !dir_scroll_newsline;
  }
  old_scroll_newsline = block.scrollLeft;
  setTimeout('moveNewsLine()', 100);
}

function addToCompare(item_id) {
  loc = location.href.split('?');
  loc = loc[0] + "?cmp=" + item_id;
  new Ajax.Request(loc, {method: 'post'});
  return false;
}
function addToBasket(item_id) {
  loc = location.href.split('?');
  loc = loc[0] + "?basket=" + item_id;
  new Ajax.Request(loc, {method: 'post'});
  return false;
}

