var NewsTicker = function() {
	var u = NewsTicker;
	if(u.phase > u.s.length + u.hold_time) {
		u.phase = -u.blackout_time;
		if(++u.i == u.text.length) { u.i = 0; }
		u.s = u.text[u.i];
	}
	var html = u.s.substr(0, ++u.phase);
	document.getElementById(u.id).innerHTML = html ? html : '&nbsp;';
}
NewsTicker.Run = function(id, speed, hold, blackout, text) {
	timer = 1000 / speed; // milliseconds per cycle
	NewsTicker.id = id;
	NewsTicker.blackout_time = Math.round(blackout * 1000 / timer);
	NewsTicker.hold_time = Math.round(hold * 1000 / timer);
	NewsTicker.phase = Number.POSITIVE_INFINITY;
	NewsTicker.text = text;
	NewsTicker.i = -1;
	NewsTicker.s = text[0];
	setInterval(NewsTicker, timer);
}
