var TextLoader = new Class({
	Implements: [Options],
	
	options:{
		delay 		: 100,
		character	: ".",
		maxChars	: 3,
		charWrapper	: "span"
	},
	
	chars: [],
	
	initialize: function(element, options)
	{
		this.setOptions(options);
		this.element = element;
		this.counter = 0;
		this.activated = false;
		this.setUp();
	},
	
	setUp: function()
	{
		this.chars = [];
		for(var counter = 1; counter<= this.options.maxChars;counter++)
			this.chars.push(new Element(this.options.charWrapper, {"text":this.options.character}));
	},
	
	loading: function()
	{
		if(this.activated) return;
		this.activated = true;
		this.timer = this.addChar.periodical(this.options.delay, this);
	},
	
	loaded: function()
	{
		this.activated = false;
		this.counter = 0;
		this.disposeChars();
		$clear(this.timer);
	},
	
	disposeChars: function()
	{
		this.chars.each(function(char, index){
			this.chars[index] = char.dispose(); 
		}.bind(this))
	},
	
	addChar: function()
	{
		if(this.counter == 3) 
		{
			this.counter = 0;
			this.disposeChars();
			return;
		}
		this.chars[this.counter].inject(this.element);
		this.counter += 1
	}
});