newsscroller_lstart=160;
newsscroller_loop=true;
newsscroller_speed=100;
newsscroller_pr_step=2;
newsscroller_timeout_id=false;

var NewsScroller = function(obj_id) {
  // initialize
  var _self = this;
  this.el = document.getElementById(obj_id);
  this.scrollHeight = this.el.offsetHeight;

  addEvent(this.el, 'mouseover', function(){ clearTimeout(newsscroller_timeout_id) });
  addEvent(this.el, 'mouseout', function(){ _self.newsScrollTimeout() });

  // methods
  this.newsScrollTimeout = function() {
    var _self = this;
    newsscroller_timeout_id = setTimeout(function(){ _self.newsScroll(newsscroller_speed) }, newsscroller_speed);
  };

  this.newsScroll = function() {
    if(this.y > -this.scrollHeight) {
      this.moveIt(this.y - newsscroller_pr_step);
      this.newsScrollTimeout();
    } else if (newsscroller_loop) {
      this.start();
    }
  };

  this.moveIt = function(y) {
    this.y = y;
    this.el.style.top = this.y + "px";
  };

  this.start = function() {
    this.moveIt(newsscroller_lstart);
    this.newsScrollTimeout();
  };
}

//Makes the object
function InitialiseAutoScrollArea(){
  new NewsScroller('divASContent').start();
}

function addEvent( obj, type, fn ) {
  if ( obj.attachEvent ) {
    obj['e'+type+fn] = fn;
    obj[type+fn] = function(){obj['e'+type+fn]( window.event );}
    obj.attachEvent( 'on'+type, obj[type+fn] );
  } else
    obj.addEventListener( type, fn, false );
}

function removeEvent( obj, type, fn ) {
  if ( obj.detachEvent ) {
    obj.detachEvent( 'on'+type, obj[type+fn] );
    obj[type+fn] = null;
  } else
    obj.removeEventListener( type, fn, false );
}

