// JavaScript Document
// zmiana wielkości fonta
//wywolanie
/*

var fontSize = new FontSize();
		fontSize.area = area;	--kontener
		fontSize.small = $('fs9');	--font maly swich
		fontSize.medium  = $('fs11');	--font sredni swich
		fontSize.big = $('fs14');	--font duzy swich
		fontSize.size = Array(10,12,14); 	--wielkosci fontow
		fontSize.store = false				--przechowywanie wybranej wielkosci w cookie
		fontSize.events();					--exec


*/
var FontSize = new Class({
	initialize: function(){
		this.area = null
		this.small = this.small
		this.medium  = this.medium
		this.big = this.big
		this.size = this.size
		this.store = true
	},
	
	changeFont: function(size){
		this.area.setStyle('fontSize',size);
	},
	
	sizeDefault: function(){
		var myCookie = Cookie.read('fontsize');
		if(myCookie && this.store){	
			myCookie = myCookie.toInt();
			this.changeFont(myCookie);
		}
	},
	
	fontStore: function(size){
		if(this.store == true){
			var storeCookie = Cookie.write('fontsize', size,{duration:30});
		}

	},
	events: function(){
		this.sizeDefault();
		this.small.addEvent('click',function(e){
										this.area.each(function(index,val){
														this.changeFont(this.size[0]);
														}.bind(this));
										this.fontStore(this.size[0]);
										e.stop();
									 }.bind(this));
	
		this.medium.addEvent('click',function(e){
										this.area.each(function(index,val){
														this.changeFont(this.size[1]);
														}.bind(this));
										e.stop();
										this.fontStore(this.size[1]);
									 }.bind(this));

		this.big.addEvent('click',function(e){
										this.area.each(function(index,val){
														this.changeFont(this.size[2]);
														}.bind(this));
										e.stop();
										this.fontStore(this.size[2]);
									 }.bind(this));
	}
});

