var $ticker_tape_headlines = Array();
var $ticker_tape_current_headline = 0;
	$ticker_tape_headlines[$ticker_tape_headlines.length] = Array("Subscribe to our RSS feed for all the latest news.","http://feeds.feedburner.com/eeducation");
	$ticker_tape_headlines[$ticker_tape_headlines.length] = Array("eCMS launched after 16 months development.","e-education-content-management-system.html");
	$ticker_tape_headlines[$ticker_tape_headlines.length] = Array("eCMS \"the best choice\" say local schools.","e-education-content-management-system.html");
	$ticker_tape_headlines[$ticker_tape_headlines.length] = Array("Underley Schools use E-education","news--underley-schools-use-e-education.html");


function prepareTickerTape() {
	if (!document.getElementById) return false;
	if (!document.getElementById('ticker_tape')) return false;
	
	var $ticker_tape = document.getElementById('ticker_tape');
	var $ticker_tape_link = document.createElement('a');
	$ticker_tape_link.setAttribute('id','ticker_tape_link');
	$ticker_tape_link.onmousedown = function() {
		if (this.href) window.location = this.href;
		return true;
	}
	$ticker_tape.appendChild($ticker_tape_link);
	
	$ticker_tape.timer = setTimeout('runTickerTape(0);',500);
	return false;
}
addLoadEvent(prepareTickerTape);


function runTickerTape($string_position) {
	var $ticker_tape = document.getElementById('ticker_tape');
	var $ticker_tape_link = document.getElementById('ticker_tape_link');
	clearTimeout($ticker_tape.timer);
	
	var $headline = Array(2);
	$headline['name'] = $ticker_tape_headlines[$ticker_tape_current_headline][0];
	$headline['url'] = $ticker_tape_headlines[$ticker_tape_current_headline][1];
	
	if ($headline['name'].length < $string_position) {
		clearTimeout($ticker_tape.timer);
		$ticker_tape_current_headline++;
		if ($ticker_tape_current_headline >= $ticker_tape_headlines.length) $ticker_tape_current_headline = 0;
		$ticker_tape.timer = setTimeout('runTickerTape(0);',3000);
		return false;
	}
	
	if ($string_position == 0) {
		$ticker_tape_link.href = $headline['url'];
		$ticker_tape_link.setAttribute('title',$headline['name']);
	}
	
	if ($headline['name'].substring($string_position-1,$string_position) == ' ') $string_position++;
	var $text_node = document.createTextNode($headline['name'].substring(0,$string_position));
	if ($ticker_tape_link.childNodes[0]) $ticker_tape_link.removeChild($ticker_tape_link.childNodes[0]);
	$ticker_tape_link.appendChild($text_node);
	
	$string_position++;
	$ticker_tape.timer = setTimeout('runTickerTape('+$string_position+');',100);
	return false;
}

