var JadeTextZoom = {
	_vars: function(){
		this.value=10;
		this.minValue=9;
		this.maxValue=13;
		this.step=1;
	},
	_auto: function(){
		var cookieZoom = Jade.Cookie.Get('zoom');
		if(cookieZoom!=null) { Jade.TextZoom.value = Jade.Convert.ToInt(cookieZoom); }
		if(Jade.TextZoom.value<Jade.TextZoom.minValue){ Jade.TextZoom.value=Jade.TextZoom.minValue  }
		Jade.TextZoom.CreateStyle();
	},
	Change: function(value){
		value=Jade.TextZoom.value+value;
		if(value >= Jade.TextZoom.minValue && value <= Jade.TextZoom.maxValue)
		{
			Jade.TextZoom.value=value;
			Jade.TextZoom.SetStyle();
			Jade.Cookie.Set('zoom',value,30);
		}
	},
	CreateStyle: function(){
		var strCSS = '.text-size {font-size: '+Jade.TextZoom.value+'px; ';
		if($.TextZoom.value==$.TextZoom.maxValue){ strCSS += 'line-height: 11px; '; }
		strCSS+='}';
		var test = document.createElement('div');
		test.innerHTML = '<p>x</p><style id="style_jade_textzoom">'+strCSS+'</style>';
		document.getElementsByTagName('head').item(0).appendChild(test.childNodes[1],document.body.firstChild);
	},
	SetStyle: function(){
		var strCSS = '.text-size { font-size: '+Jade.Convert.ToInt(Jade.TextZoom.baseValue)+Jade.Convert.ToInt(Jade.TextZoom.value)+'px; ';
		if($.TextZoom.value==$.TextZoom.maxValue){ strCSS += 'line-height: 11px; '; }
		strCSS+='}';
		
		var linkStyle = document.getElementById('style_jade_textzoom');
		document.getElementsByTagName('head').item(0).removeChild(linkStyle);
		
		var test = document.createElement('div');
		test.innerHTML = '<p>x</p><style id="style_jade_textzoom">'+strCSS+'</style>';
		document.getElementsByTagName('head').item(0).appendChild(test.childNodes[1], document.body.firstChild);
	},
	ZoomIn: function(){
		Jade.TextZoom.Change(Jade.TextZoom.step);
	},
	ZoomOut: function(){
		Jade.TextZoom.Change(Jade.TextZoom.step * -1);
	}
}
Jade.LoadLibrary('TextZoom',JadeTextZoom);