
var pageID = null;
var ticker = null;
var flash = null;
var index = 0;

function init() {
	if (Loader != null) {
		try {
			pageID = Loader.getHTML('TickerID');
			if (pageID == "") return;
			getObject('Ticker').href = "/console/PageViewer.aspx?page=" + pageID + "&ticker=yes";
			ticker = Loader.getHTML('Ticker');
			ticker = ticker.replace('&amp;', '&');
			flash = Loader.getHTML('IsFlash');
			if (flash == 'True') { getStyle("theTable").background = "#AA0000"; getStyle('Ticker').color = '#FFFFFF'; }
			getStyle('Ticker').bold = 'bold';
			nextLetter();
		} catch (e) {
			window.setTimeout("init();", 1000);
		}
	} else {
		window.setTimeout("init();", 1000);
	}
}

function nextLetter() {
	if (index < ticker.length-1) {
		var html = "<b>" + ticker.substring(0, index) + "</b> _";
		if (flash == "True") {
			html = "<span style=\"color:#AA0000; background-color:#FFFFFF\"><b>&nbsp;NEWS FLASH&nbsp;</b></span>&nbsp;&nbsp;&nbsp;&nbsp;" + html;
		}
		setHTML('Ticker',html);
		index++;
		window.setTimeout("nextLetter();", 3000/ticker.length);
	} else {
		var html = "<b>" + ticker + "</b>";
		if (flash == "True") {
			html = "<span style=\"color:#AA0000; background-color:#FFFFFF\"><b>&nbsp;NEWS FLASH&nbsp;</b></span>&nbsp;&nbsp;&nbsp;&nbsp;" + html;
		}
		setHTML('Ticker',html);
		index = 0;
		window.setTimeout("init();", 7000);
	}
}
