//glimmer_text.js
//Author: Joshua Birk
//current modDate: Aug,05,1999

//glimmer.js mod for manipulating text within a layer.
//Note that all of these functions rewrite the layer content

//init function for this mod.  goes before initAll() is called.
function initGtext() {
	addMod("overwrite",layer_write);
	addMod("fadeBlackWhite",layer_fadeBlackWhite);
	addMod("fadeWhiteBlack",layer_fadeWhiteBlack);
	addMod("colorRipple",layer_colorRipple);
	}


//erase old content, replace with new HTML 
function layer_write(content,y,codette) {	
	if (!codette){codette = new Array('end');}
	if (document.getElementById) {
		eval(this.layer+'.innerHTML = ' + '"' + content + '"');
	}
	if (document.layers) {
		content = "<body>" + content + "</body>";
		eval(this.layer+'.document.open()');
		eval(this.layer+'.document.write("'+content+'")');
		eval(this.layer+'.document.close()');
	}
	if (document.all) {
	eval (this.name + '.innerHTML = ' + '"' + content + '"');
	}
	if (codette){this.runMe(codette);}
}


//'trick' functions - combination of other functions for canned effects
function layer_fadeBlackWhite(content,time,codette) {
	color1_text = "'<font color=#000000>"+content+"</font>'";
	color2_text = "'<font color=#4E4E4E>"+content+"</font>'";
	color3_text = "'<font color=#808080>"+content+"</font>'";
	color4_text = "'<font color=#C0C0C0>"+content+"</font>'";
	color5_text = "'<font color=#FFFFFF>"+content+"</font>'";
	func = this.obj_name + ".overwrite";
	setcodette = func+"|"+color1_text+"|"+time+"|"+pause+"|"+0+"|"+time+"|"+func+"|"+color2_text+"|"+time+"|"+pause+"|"+0+"|"+time+"|"+func+"|"+color3_text+"|"+time+"|"+pause+"|"+0+"|"+time+"|"+func+"|"+color4_text+"|"+time+"|"+pause+"|"+0+"|"+time+"|"+func+"|"+color5_text+"|"+time+"|"+pause+"|"+0+"|"+time+"|"+codette;
	this.runMe(setcodette);
	}

function layer_fadeWhiteBlack(content,time,codette) {
	color1_text = "'<font color=#FFFFFF>"+content+"</font>'";
	color2_text = "'<font color=#C0C0C0>"+content+"</font>'";
	color3_text = "'<font color=#808080>"+content+"</font>'";
	color4_text = "'<font color=#4E4E4E>"+content+"</font>'";
	color5_text = "'<font color=#000000>"+content+"</font>'";
	func = this.obj_name + ".overwrite";
	setcodette = func+"|"+color1_text+"|"+time+"|"+pause+"|"+0+"|"+time+"|"+func+"|"+color2_text+"|"+time+"|"+pause+"|"+0+"|"+time+"|"+func+"|"+color3_text+"|"+time+"|"+pause+"|"+0+"|"+time+"|"+func+"|"+color4_text+"|"+time+"|"+pause+"|"+0+"|"+time+"|"+func+"|"+color5_text+"|"+time+"|"+pause+"|"+0+"|"+time+"|"+codette;
	this.runMe(setcodette);
	}

//Ripple function essentially replaces the above.  Initial code/design by Valerie Duncan.
function layer_colorRipple(colors,content,codette) {
	var setcodette;
	var thiscontent;
	setcodette = "";
	time = this.speed;
	func = this.obj_name + ".overwrite";
	local_colors = colors.split ("|");
	for (n = 0; n < local_colors.length; n++) {
		thiscontent = "'<font color="+local_colors[n]+">"+content+"</font>'";
		setcodette += func+"|"+thiscontent+"|"+time+"|"+pause+"|"+0+"|"+time+"|";
		}
	setcodette += "end";
	this.runMe(setcodette);
	} 

initGtext();