//初期化
function reset()
{
    for (i = 0; i <= 2; i++) 
    {
        var selectf = $(".font_size img").eq(i).attr('src');
        var onimg2 = selectf.replace(/_on.gif/, "_off.gif");
        $(".font_size img").eq(i).attr('src', onimg2);
    }
		$("body").removeClass("font_sizeA");
				$("body").removeClass("font_sizeB");
		$("body").removeClass("font_sizeC");
}
//クッキー読み込み処理
$(function ()
{
    if ($.cookie("style")) 
    {
        box = $.cookie('style');
        box2 = $.cookie('style2');
        reset();
        var stylesheet = $(".font_size img").eq(box).attr('src');
        var ter = stylesheet.replace(/_off.gif/, "_on.gif");
        $("body").addClass(box2);
        $(".font_size img").eq(box).attr('src', ter);
    }
		else{
		}
});
//各ボタンクリックしたときの処理
$(document).ready(function ()
{
    inter_max = $(".font_size").length;
    $(".font_size").click(function () 
    {
        var inter_now = $(".font_size").index(this);
        if (0 == inter_now) 
        {
            reset();
            $("body").addClass("font_sizeA");
            var select_src = $(".font_size img").eq(inter_now).attr('src');
            var onimg = select_src.replace(/_off.gif/, "_on.gif");
            $(".font_size img").eq(inter_now).attr('src', onimg);
						txtLink = "font_sizeA";
            $.cookie('style', '0',{expires:30,path:'/'});
            $.cookie('style2', txtLink,{expires:30,path:'/'});
        }
        else if (1 == inter_now) 
        {
            reset();
            $("body").addClass("font_sizeB");
            var select_src = $(".font_size img").eq(inter_now).attr('src');
            var onimg = select_src.replace(/_off.gif/, "_on.gif");
            $(".font_size img").eq(inter_now).attr('src', onimg);
            $.cookie('style', null,{expires:30,path:'/'});
            $.cookie('style2', null,{expires:30,path:'/'});
        }
        else if (2 == inter_now) 
        {
            reset();
            $("body").addClass("font_sizeC");
            var select_src = $(".font_size img").eq(inter_now).attr('src');
            var onimg = select_src.replace(/_off.gif/, "_on.gif");
            $(".font_size img").eq(inter_now).attr('src', onimg);
						txtLink = "font_sizeC";
            $.cookie('style', '2',{expires:30,path:'/'});
            $.cookie('style2', txtLink,{expires:30,path:'/'});
        }
    });
		
	

});

