//Fade
var Fade=function(obj,step,fadeInterval){
		this.obj = obj;
		this.alphaOut = 0.0;
		this.alphaIn = 1.0;
		this.step = step || 0.1;
		this.fadeInterval = fadeInterval || 100;
};
Fade.prototype = {
	fadeOut : function(){
		var _this = this;
		if(this.alphaOut < 1.0) { 
			this.alphaOut += this.step; 
			this.alphaOut > 1.0 ? this.alphaOut =1.0 : {}; 
			this.setOpacity(this.obj, this.alphaOut);
			setTimeout(function(){_this.fadeOut()},this.fadeInterval); 
		} 
		else{
			this.alphaOut = 0.0;
			return;
		} 
	},
	fadeIn : function(){
		var _this = this;
		if(this.alphaIn > 0.0) {
			this.alphaIn -= this.step; 
			this.alphaIn < 0.0 ? this.alphaIn =0.0 : {}; 
			this.setOpacity(this.obj, this.alphaIn);
			setTimeout(function(){_this.fadeIn()},this.fadeInterval); 
		} 
		else{
			this.alphaIn = 1.0;
			return;
		} 
	},
	setOpacity : function(obj, opacity){
		obj.style.opacity = opacity;
		obj.style.MozOpacity = opacity;
		obj.style.KhtmlOpacity = opacity;
		obj.style.filter = "alpha(opacity="+ (opacity * 100) +")";
	},
	setStep : function(step){
		this.step = step || 0.1;
	},
	getStep : function(){
		return this.step;
	},
	setFadeInterval : function(fadeInterval){
		this.fadeInterval = fadeInterval || 100;
	},
	getFadeInterval : function(){
		return this.fadeInterval;
	}
};