/* Marquee Effect using JavaScript and CSS   -  this is the vertical scrolling one */
/* sourced from here: http://www.talkincode.com/javascript-scrolling-box-marquee-replacement-52.html */
/* Steve Note: You need to set an onload event on the body tag so that the init() function is run when the page loads.  */
/* Steve Note: I renamed the original div and Javascript code from marquee_replacement to plain old marquee ! */

var speed = 1; // change scroll speed with this value
/**
 * Initialize the marquee, and start the marquee by calling the marquee function.
 */
function init(){
  var el = document.getElementById("marquee");
  el.style.overflow = 'hidden';
  scrollFromBottom();
}
 
var go = 0;
var timeout = '';
/**
 * This is where the scroll action happens.
 * Recursive method until stopped.
 */
function scrollFromBottom(){
  clearTimeout(timeout);
  var el = document.getElementById("marquee");
  if(el.scrollTop >= el.scrollHeight-150){
    el.scrollTop = 0;
  };
  el.scrollTop = el.scrollTop + speed;
  if(go == 0){
    timeout = setTimeout("scrollFromBottom()",100); /* I changed this to 100, from 50 - Slows the scroll speed down */
  };
}
 
/**
 * Set the stop variable to be true (will stop the marquee at the next pass).
 */
function stop(){
  go = 1;
}
 
/**
 * Set the stop variable to be false and call the marquee function.
 */
function startit(){
  go = 0;
  scrollFromBottom();
}

