/* This is complement to ticker.js.
   Probably should use object literal instead but nm.
   global delay + speed declared in ticker.js */

var position_2 = 0;
var ticking_2;
var container_2;
var list_2;

function ticker_2_init() {

  var ticker_2;

  if (ticker_2 = document.getElementById("ticker_2")) {
		container_2 = ticker_2.getElementsByTagName("div")[0];
		container_2.style.height="6em";

		/* clone the list twice over to get rid of whitespace near the end of the tick cycle */
		list_2 = container_2.getElementsByTagName("ul")[0];
		list_length_2 = list_2.getElementsByTagName("li").length * 2;
		for (i=0;i<list_length_2;i++) {
			list_2.appendChild(list_2.getElementsByTagName("li")[i].cloneNode(true));
		}

		container_2.scrollTop = 0;

		ticker_links_2 = list_2.getElementsByTagName("a");
		for (i=0;i<ticker_links_2.length;i++) {
			addEvent(ticker_links_2[i], 'mouseover', tick_pause_2);
			addEvent(ticker_links_2[i], 'mouseout', tick_2);
		}
		ticking_2 = window.setTimeout("tick_2()", (delay * 1000));
  }
}

function tick_2() {
  clearTimeout(ticking_2); /* in case two timeouts have managed to start somehow */
  if ((list_2.offsetHeight / 3) <= position_2) {
    container_2.scrollTop = position_2 = 1;
  }
  else {
		container_2.scrollTop = ++position_2;
  }
  ticking_2 = window.setTimeout("tick_2()", speed);
}

function tick_pause_2() {
  clearTimeout(ticking_2);
}