function textRotator(e, file) {

	
	this.howOften = 20; 
	this.e = document.getElementById(e);
	this.file = file;
	
	this.rotate = function() {
		if (this.e){
			this.e.innerHTML = textLines[this.file][0];
			textLines[this.file].push(textLines[this.file].shift());
		}
	}
	
	this.rotate(this);
	
	if (this.e) {
		var elem = this;
		window.setInterval(function(){elem.rotate();}, this.howOften * 1000);
	}
		
}



var loaded = [];
var head = document.getElementsByTagName('head')[0];
var textLines = [];

for (var i=0;i<textRotators.length;i++) {
	if (textRotators[i][1] in loaded) break;
	
	loaded[loaded.length] = textRotators[i][1];
	var script = document.createElement('script');
	script.setAttribute('type', 'text/javascript');
	script.setAttribute('src', 'textfiles/' + textRotators[i][1] + '.js');
	head.appendChild(script);

}

if (typeof window.onload == 'function') {
	var old = window.onload;
	window.onload = function() {
		old();
		for (var i = 0; i < textRotators.length; i++)
			new textRotator(textRotators[i][0], textRotators[i][1]);
	}
} else {
	window.onload = function() {
		for (var i = 0; i < textRotators.length; i++)
			new textRotator(textRotators[i][0], textRotators[i][1]);
	}
}
