//-------------------------------------------------------------------
//
//　フォントサイズ変更
//
//-------------------------------------------------------------------

//--------------------------------------------------------
// 変数の宣言
//--------------------------------------------------------
var FontSizeList;
var ClassName;
var EffectiveDays;

FontSize = new Array();
FontSize['0'] = 'small';
FontSize['1'] = 'normal';
FontSize['2'] = 'large';
ClassName = 'changefont';
FontSizeType = '0';
Expires = 30;

//
// フォントサイズ初期化（Bodyタグ"onload"に記述）
//
function initialFontSize() {
    try {
        
        // フォントサイズタイプの読込み（cookieから)
        if (document.cookie) {
            cookie = document.cookie;
            if (cookie.match(/FontSizeType=([\d.]*)/)) {
                FontSizeType = RegExp.$1;
            }
        }

        // フォントサイズを指定
        var e = document.getElementsByClass(ClassName);
        if (e.length) {
            for (var i = 0; i < e.length; i++) {
                e[i].style.fontSize = FontSize[FontSizeType];
            }
        }
    }
    catch (e) {}    
}

//
// フォントサイズの変更
//
function changeFontSize(FontSizeType) {

    // 日付の計算
    var toDay = new Date;
    var xDay = new Date;
    parseInt(Expires);
    xDay.setDate(toDay.getDate() + Expires);
    ExpiresText = xDay.toGMTString();
    
    // 書込
    document.cookie = "FontSizeType = " + FontSizeType + ";expires=" + ExpiresText;
    
    // 再読込
    location.reload();
}

