/* CREDITS
 * ----------------------------------------------------------
 * Title:		Dynamically change page font-size
 * Author:		Dirk Bonhomme <dirk@inventis.be>
 * Date:		11/09/2009
 * Last Edit:	11/09/2009 [Dirk Bonhomme]
 * ----------------------------------------------------------
 * Inventis - Web Architects - We design the Web!
 * www.inventis.be
*/
window.addEvent('domready', function(){
	$$('#font_size a').addEvent('click', function(e){
		var e = new Event(e);
		changeFontSize(e.target.rel)
		e.stop();
	});
});

function changeFontSize(value){
	
	// Parse fontsize
	var fontSize = parseInt(value) / 100;
	if(fontSize > 300 || fontSize < 80) return false;

	// Set live fontsize
	document.getElement('body').setStyle('font-size', fontSize + '%');
	
	// Request to save in cookie
	new Request({
		url: '/public/setfont',
		data: {
			value: fontSize
		}
	}).send()
}
