var fontSize = new Class({
	standard: 101,
	steps: 10,
	body: false,
	els: [],
	current: false,

	initialize: function() {
		var _this = this;
		this.body = $$('body')[0];
		this.current = this.read();
		if(this.current === false) this.current = this.standard;
		this.set(this.current);
		this.els = $$('#accessiblenav ul li a');
		if($chk(this.body) && $chk(this.els) && this.els.length >= 2) {
			//größer
			this.els[0].addEvent('click',function(e) {
				new Event(e).preventDefault();
				this.blur();
				_this.bigger();
			});
			//kleiner
			this.els[1].addEvent('click',function(e) {
				new Event(e).preventDefault();
				this.blur();
				_this.smaller();
			});
		};
	},

	set: function(fontSize) {
		this.body.style.fontSize = fontSize+'%';
		this.current = fontSize;
		this.write(fontSize);
	},

	read: function() {
		var fontSize = Cookie.read('fontsize');
		if($chk(fontSize)) return parseInt(fontSize);
		else return false;
	},

	write: function(value) {
		var domain = window.location.hostname;
		if(domain.match(/\.alias\.e-k-i-r\.de/i)) domain = '.alias.e-k-i-r.de';
		else if(domain.match(/\.ekir\.de/i)) domain = '.ekir.de';
		Cookie.write('fontsize',value,{'domain':domain});
	},

	bigger: function() {
		this.set(Math.round(this.current+this.steps));
	},

	smaller: function() {
		this.set(Math.round(this.current-this.steps));
	}
});

window.addEvent('domready',function () { new fontSize(); });
