Fx.Font = new Class({
	initialize: function(elements, sid, gid, growsize){
		this.growsize = growsize || 2;
		this.elements = [];

		var currentSize;
 		elements.each(function(el){
			//store the fontsize of 'el'
			currentSize = el.getStyle('font-size').toInt();

			//check if you have the Cookie module and if fontSize is set and if so if it's set to 'large'
			if(Cookie.get != null && (size = Cookie.get('fontSize')) && size == 'large'){
				//now change the font-size of 'el' to large
				el.setStyle('font-size',currentSize+this.growsize+'px');
			}

			this.elements.push([el,currentSize]);
		},this);

		$(gid).onclick = function(){this.grow()}.bind(this);
		$(sid).onclick = function(){this.shrink()}.bind(this);
	},
	grow: function(){
		this.elements.each(function(el){
			if(el[0].getStyle('font-size').toInt() == el[1])
				el[0].effect('font-size',{duration:300,unit:'px'}).custom(el[1],el[1]+this.growsize);
		},this);

		//remember the users preference, keep the data for 1 day
		Cookie.set('fontSize','large',{path: "/",duration: 10});
	},
	shrink: function(){
		this.elements.each(function(el){
			if(el[0].getStyle('font-size').toInt() == el[1]+this.growsize)
				el[0].effect('font-size',{duration:300,unit:'px'}).custom(el[1]+this.growsize, el[1]);
		},this);

		//remember the users preference, keep the data for 1 day
		Cookie.set('fontSize','small',{path: "/",duration: 10});
	}
});

window.onload = function(){
   new Fx.Font($$('div#content p', 'div#content span', 'div#content font', 'div#content h1', 'div#content h2', 'div#content h3', 'div#content h4', 'div#content h5', 'div#content div'),$('shrink'),$('grow'));
}