/**
 * Article scroll script
 *
 */

var boxHeight = $('latest_articles').style.height.replace('px','');

var repeatHeight = $('latest_articles').scrollHeight //get the current height so we know when to wrap

// alert(repeatHeight);

// if(repeatHeight > boxHeight)
 
// $('latest_articles').innerHTML = $('latest_articles').innerHTML + $('latest_articles').innerHTML  //add a second copy so we can scroll down to the wrap point

var stopScroll = 0;
var x;

function scrollMe() 
{
  clearTimeout(x);
  if(stopScroll == 1) {
    return;
  }
  $('latest_articles').scrollTop = $('latest_articles').scrollTop + 1;
  if($('latest_articles').scrollTop <= repeatHeight) 
  {
    // keep on scrolin' 
    x = setTimeout("scrollMe()", 40);
  }
  else // we have hit the wrap point 
  { 
    $('latest_articles').scrollTop = 0;
    x = setTimeout("scrollMe()", 40);
  }
};

// start scrolling after one second
x = setTimeout("scrollMe()", 1000);
