cfx_versions["ticker"] = "1.0";

function cfx_ticker () {
	var args = cfx_ticker.arguments;
	cfx_makeobjindex(this);	
	this.make = cfx_ticker_make;
	this.tick = cfx_ticker_tick;
	this.timeoutid = null;
	this.origmsg = args[0];
	this.msg = args[0];
	this.size = args[1];
	this.clickaway = false;
	if (args[3]) {
		this.dest = args[3];
	} else {
		this.dest = false;
	} //endif
	this.onclick = cfx_ticker_click;
	while (this.msg.length < this.size) {
		this.msg += " ";
	} //endwhile
	this.delay = eval(args[2]);
	this.targetobj = "cfx_unassigned";
} //endfunction

function cfx_ticker_make() {
	document.writeln('<form name="cfxprivate_ticker_' + this.objindex + '">');
	if (test.microsoft) {
		document.writeln('<input name="tickertext" style="font-family:monospace" type="text" size="' + this.size + '" onfocus="objects[' + this.objindex + '].onclick();">');
	} else {
		document.writeln('<input name="tickertext" type="text" size="' + this.size + '" onfocus="objects[' + this.objindex + '].onclick();">');
	} //endif
	document.writeln('</form>');
	this.targetobj = eval("document.cfxprivate_ticker_" + this.objindex + ".tickertext");
	this.tick();
} //endfunction

function cfx_ticker_tick() {
	var first = this.msg.substring(0,1);
	this.msg = this.msg.substring(1,this.msg.length) + first;
	this.targetobj.value = this.msg;
	this.timeoutid = window.setTimeout("objects[" + this.objindex + "].tick()",this.delay);
} //endfunction

function cfx_ticker_click() {
	this.targetobj.blur();
	if (this.dest && !this.clickaway) {
		window.setTimeout("window.location = '" + this.dest + "';",5);
		this.clickaway = true;
		window.setTimeout("objects[" + this.objindex + "].clickaway = false;",100);
	} //endif
} //endfunction