

$(function(){
	var nowsize;
	
	var s = {
			status    :"s",
			selecter  :"#textsize_trans dl dd#textsize_trans_s",
			image_off :"textsize_trans_s.jpg",
			image_on  :"textsize_trans_s_on.jpg",
			font_size :"75%"
		}
	var m = { 
			status    :"m",
			selecter  :"#textsize_trans dl dd#textsize_trans_m",
			image_off :"textsize_trans_m.jpg",
			image_on  :"textsize_trans_m_on.jpg",
			font_size :"87.5%"
		}
	var l = { 
			status    :"l",
			selecter  :"#textsize_trans dl dd#textsize_trans_l",
			image_off :"textsize_trans_l.jpg",
			image_on  :"textsize_trans_l_on.jpg",
			font_size :"100%"
		}
	
	var textSizeTrans = function(target){
		var imgsrc = $(target.selecter + " img").attr("src");
		imgsrc = imgsrc.substring(0, imgsrc.lastIndexOf("/") + 1);
		if(nowsize != undefined)
		$(nowsize.selecter + " img").attr("src", imgsrc + nowsize.image_off);
		$(target.selecter + " img").attr("src", imgsrc + target.image_on);
		$("body").css("font-size", target.font_size);
		$.cookie("textSizeStatus", target.status,{path:"/"});
		nowsize = target;
	}
	
	var textSizeStatus = $.cookie("textSizeStatus");
	if(textSizeStatus != null)
	textSizeTrans(eval(textSizeStatus));
	else
	textSizeTrans(m);
	
	$(s.selecter).click(function(){ textSizeTrans(s) }).css("cursor", "pointer");
	$(m.selecter).click(function(){ textSizeTrans(m) }).css("cursor", "pointer");
	$(l.selecter).click(function(){ textSizeTrans(l) }).css("cursor", "pointer");
	
});



