function TextAnimation(
	oAnimationHandler,
	aElements,
	iStep
	) {

	this.oAnimationHandler = oAnimationHandler;	
	this.aElements = aElements;
	this.iStep = iStep;
	this.iIndex = this.oAnimationHandler.addAnimation(this);

	
}

TextAnimation.prototype = {

	process : function() {
			
			for(var i = 0; i < this.aElements.length; i++) {	
				
				this.aElements[i].process();
			
			}
		
	},
	
	stop : function() {

		this.oAnimationHandler.removeAnimation(this.iIndex);
	
	},

	activateByPos : function(iPos) {
		if (this.aElements[iPos]) this.aElements[iPos].activate()
	},
	
	deactivateByPos : function(iPos) {
		if (this.aElements[iPos]) this.aElements[iPos].deactivate()
	}

}


var AnimatedItem = {
	
	instance : function(aParams) {
		this.TextAnimation = aParams.TextAnimation;
		this.iId = aParams.iId;
		this.oParent = aParams.oParent;
		this.aTexts = aParams.aTexts;
		this.aSmokerings= aParams.aSmokerings;
		this.isMouseOver=false;
		this.isMouseOut=false;
		this.isDisappear=false;
		this.isOver=false;
		this.iCurrentOpacity = 100;
		this.iCurrentBlurancy = 100;
		this.iStep = 4;
		this.iStep2 = this.iStep * 3;
		
	}
	
}

AnimatedItem.instance.prototype = {
	
	process : function () {
		
		if (this.isDisappear) 
		{ 
			this.disappear();
			this.render();
		};
		
		
		
	},
	
	render : function() {
		
		for (var i=0; i<this.aSmokerings.length; i++) {
			if(this.aSmokerings[i].runtimeStyle) {			
				this.aSmokerings[i].runtimeStyle.filter = 'Alpha(opacity=' + this.iCurrentOpacity + ')';												
			}
			else {
				this.aSmokerings[i].style.opacity = this.iCurrentOpacity / 100;
			};
			
			
			
		};
		
	},
	

	disappear : function() {
			
		if (this.iCurrentOpacity > 0 ) 
		{
			this.iCurrentOpacity -= this.iStep
		} else {	
			this.isDisappear = false;
			
			Common.Class.add(this.aSmokerings[0], 'hidden');
			
		};
	
	},
	
	activate : function() { 
		Common.Class.replace(this.aTexts[0],'hidden', '');
		Common.Class.replace(this.aSmokerings[0], 'cursor-pointer-hand');
		this.isDisappear = true;
	},
	
	deactivate : function() { 
	
	}
	
}
