// author: Bas Wenneker		website: http://www.solutoire.com
// Fx.Font is MIT-Licensed

Fx.Font = new Class({
	initialize: function(elements, sid, gid, growsize){
		this.growsize = (growsize) ? growsize : 2;
		this.elements = [];
 		elements.each(function(el){
			this.elements.push([el,el.getStyle('font-size').toInt()]);									   
		},this);
		$(gid).onclick = function(){this.grow()}.bind(this);
		$(sid).onclick = function(){this.shrink()}.bind(this);
	},
	grow: function(){
		this.elements.each(function(el){
				var myFx = new Fx.Morph(el[0], {duration: 200, transition: Fx.Transitions.Sine.easeOut});
				//Transitions the background color of the Element from black to red:
				myFx.start({
				'font-size': [el[1], el[1]+this.growsize],
				'line-height': [el[1]+4, el[1]+this.growsize+4]
				});
				el[1]+=	this.growsize;	
//				el[0].effect('font-size',{duration:300,unit:'px'}).custom(el[1],el[1]+this.growsize);			
		},this);							
	},
	shrink: function(){
		this.elements.each(function(el){
				var myFx = new Fx.Morph(el[0], {duration: 200, transition: Fx.Transitions.Sine.easeOut});
				//Transitions the background color of the Element from black to red:
				myFx.start({
				'font-size': [el[1], el[1]-this.growsize],
				'line-height': [el[1]+4, el[1]+4-this.growsize]
				});
				el[1]-=this.growsize;
		},this);		
	}						
});

