var asahi = asahi || new Object();
/**************************************************************************
 * ■FontSizeController
 **************************************************************************/
asahi.FontSizeController = function()
{
	this.initialize.apply(this, arguments);
}

asahi.FontSizeController.prototype =
{
	initialize: function()
	{
		this.size = asahi.cookie.read('size') || 'm';
		this.setStyle();
	},
	
	
	setStyle: function()
	{
		var style = new Object();
		style["s"] = "body { font-size: 90%}";
		style["m"] = "body { font-size: 100%}";
		style["l"] = "body { font-size: 115%}";

		var styleHtml ="";
		styleHtml += '<style type="text/css">';
		styleHtml += style[this.size];
		styleHtml += '</style>';

		document.write(styleHtml);
	},
	
	
	createButton: function()
	{
		var btnHtml = 
		{
			s: '<em id="s"><img src="http://www.asahicom.jp/images08/common/btn_fontsize_s_on.gif" alt="小" width="21" height="17" /></em><a href="#" id="m"><img src="http://www.asahicom.jp/images08/common/btn_fontsize_m_off.gif" alt="中" width="20" height="17" /></a><a href="#" id="l"><img src="http://www.asahicom.jp/images08/common/btn_fontsize_l_off.gif" alt="大" width="21" height="17" /></a>',
			m: '<a href="#" id="s"><img src="http://www.asahicom.jp/images08/common/btn_fontsize_s_off.gif" alt="小" width="21" height="17" /></a><em id="m"><img src="http://www.asahicom.jp/images08/common/btn_fontsize_m_on.gif" alt="中" width="20" height="17" /></em><a href="#" id="l"><img src="http://www.asahicom.jp/images08/common/btn_fontsize_l_off.gif" alt="大" width="21" height="17" /></a>',
			l: '<a href="#" id="s"><img src="http://www.asahicom.jp/images08/common/btn_fontsize_s_off.gif" alt="小" width="21" height="17" /></a><a href="#" id="m"><img src="http://www.asahicom.jp/images08/common/btn_fontsize_m_off.gif" alt="中" width="20" height="17" /></a><em id="l"><img src="http://www.asahicom.jp/images08/common/btn_fontsize_l_on.gif" alt="大" width="21" height="17" /></em>'
		}
		
		jQuery('#Nav').append('<p id="FontSizeCtrl"><img src="http://www.asahicom.jp/images08/common/icn_fontsize_s.gif" alt="文字サイズ" width="45" height="17" /></p>');
		jQuery('#FontSizeCtrl').append(btnHtml[this.size]);
		
		var self = this;
		jQuery('#FontSizeCtrl').find('a').each
		(
			function()
			{
				this.onclick = function()
				{
					self.changeFontSize(this.id);
					return false;
				}
			}
		);
	},
	
	changeFontSize: function(size)
	{
		asahi.cookie.create('size', size, 365);
		location.reload();
	}
}




if(asahi.agent.getTarget())
{
	asahi.fontSizeController = new asahi.FontSizeController();
	jQuery(function()
	{
		asahi.fontSizeController.createButton();
	});
}



