/**
 * @author Bartek G
 */
var FontSize = new Class({
	Implements: Options,
    options: {
		content: 'content',
        selector: 'tools',
        path: 'fontsize/',
        id: 'fontsize',
		text: ['Text size:','Small','Normal','Big']
    },
    initialize: function(options){
		this.setOptions(options);
		var bind = this;
		if($(this.options.selector) && $(this.options.content)) {
			this.prepare();
		}
	},
	prepare: function() {
		new Element('div',{
			'id':this.options.id,
			'class':'fontsize',
			'html':'<span>' + this.options.text[0] + '</span> <a href="#" class="fontsize1" rel="small" title="' + this.options.text[1] + '">' + this.options.text[1] + '</a> <a href="#" class="fontsize2" rel="default" title="' + this.options.text[2] + '">' + this.options.text[2] + '</a> <a href="#" class="fontsize3" rel="big" title="' + this.options.text[3] + '">' + this.options.text[3] + '</a>'
		}).inject(this.options.selector);
		this.change();
	},
	change: function() {
		var bind = this;
		$(this.options.id).getElements('a').addEvent('click',function(e){
			var e = new Event(e);
			e.preventDefault();
			if(this.get('rel')=='default') bind.deactivate();
			else bind.activate(this);
		});
	},
	activate: function(el) {
		var bind = this;
		var size = el.get('rel');
		this.deactivate();
		$(this.options.content).addClass('fontsizeContent-' + size);
	},
	deactivate: function() {
		$(this.options.content).removeClass('fontsizeContent-small').removeClass('fontsizeContent-big');
	}
});

