
// <!--
var pWidth = 0;

/**
 * Initialize the marquee, and start the marquee by calling the marquee function.
 */
function initTicker(){
  var div = document.getElementById("marquee_replacement");
  div.style.overflow = 'hidden';
  
  var ps = div.getElementsByTagName('p');
  for(var j=0;j<ps.length;j++){
    pWidth += ps[j].offsetWidth;
  }
  
  var startdiv = document.getElementById("start");
  startdiv.style.width = pWidth+'px';
  div.scrollLeft = 0;
  setTimeout("scrollFromSide()",50);
}
 
var go = 0;
var timeout = '';
 
/**
 * This is where the scroll action happens.
 * Recursive method until stopped.
*/
function scrollFromSide(){
  clearTimeout(timeout);
  var el = document.getElementById("marquee_replacement");
  if(el.scrollLeft >= pWidth-jsMarquee.barwidth){
    el.scrollLeft = 0;
  };
  el.scrollLeft = el.scrollLeft+jsMarquee.speed;
  if(go == 0){
    timeout = setTimeout("scrollFromSide()",50);
  };
} 
 
/**
 * Set the stop variable to be true (will stop the marquee at the next pass).
 */
function stopMarquee(){
  go = 1;
  timeout = '';
}
 
/**
 * Set the stop variable to be false and call the marquee function.
 */
function startMarquee(){
  go = 0;
  scrollFromSide();
  //outputtext();
}
window.init[window.init.length]=initTicker;
// -->
