function Fader() {
	this.opacity = -1;
	this.inout = 'in';
	this.ele = false;
	this.runner = false;
	this.speed = 20;
	this.callback = false;
}
Fader.prototype.init = function(ele, runner, speed, callback) {
	this.ele = ele;
	this.runner = runner;
	this.speed = speed;
	this.callback = callback;
}
Fader.prototype.fadeIn = function() {
	this.fade('in');
}
Fader.prototype.fadeOut = function() {
	this.fade('out');
}
Fader.prototype.fade = function(inout) {
	if (this.opacity == -1) {
		this.inout = inout;
		this.opacity = (this.inout == 'in' ? 0 : 10);
	}
	this.opacity += (this.inout == 'in' ? 1 : -1);
	
	setOpacity(this.ele, this.opacity);
	if (this.opacity == (this.inout == 'in' ? 10 : 0)) {
		this.opacity = -1;
		if (this.callback) {
			var fn = new Function(this.callback);
			fn();
			this.callback = false;
		}
	} else {
		setTimeout(this.runner+'.fade(false)', this.speed);
	}
}