//requires mootools

function fader(elementID,ancAr,fx){
	this.IDNum = elementID;
	this.elemID = 'anc'+this.IDNum;
	this.ancs = ancAr;
	this.position = 0;
	this.timer;
	this.status = 'in';
	
	this.fx = fx;

	this.advancePos = function(){
		if(this.position == (ancAr.length-1)){
			this.position = 0;
		} else {
			this.position = this.position + 1;
		}
	}
	
	this.fadeIn = function(){
		$(this.elemID).innerHTML = this.ancs[this.position];
		this.status = 'in';
    	this.fx.start("opacity", 0, 1);
	}
	
	this.fadeOut = function(){
		clearTimeout(this.timer);
		this.advancePos();
		this.status = 'out';
		this.fx.start("opacity", 1, 0);
	}
	
	$(this.elemID).innerHTML = this.ancs[this.position];
	this.fx.set('opacity',0);
	this.fadeIn();
}
