//
function getCookie(){
    zoom = "";
    cName = "FontSize=";
    tmpCookie = document.cookie + ";";
    start = tmpCookie.indexOf(cName);
    if (start != -1)
    {
        end = tmpCookie.indexOf(";", start);
        zoom = tmpCookie.substring(start + cName.length, end);
        document.getElementById(target).style.fontSize = zoom;
    } else {
        document.getElementById(target).style.fontSize = "100%";
    }
    //color
    var p;
    pName = "F_Color=";
    tmpCookie = document.cookie + ";";
    start = tmpCookie.indexOf(pName);
    if (start != -1)
    {
        end = tmpCookie.indexOf(";", start);
        p = tmpCookie.substring(start + pName.length, end);
        changeCSS(p);
    }
}

////文字拡大・縮小///////////////////////////
var target = "whole";    //*文字拡大・縮小対象エリア（ID名）
//
function setCookie(s){
    cName = "FontSize=";
    exp = new Date();
    exp.setTime(exp.getTime() + 31536000000);
    document.cookie = cName + s + "; path=/; expires=" + exp.toGMTString();
}
//
function textSizeUp(){
    currentSize = document.getElementById(target).style.fontSize;
    if (!currentSize) {
        currentSize = "100%";
    }
    selectSize = "";
    if ( currentSize=="100%" || currentSize=="1.0em"){
        selectSize = "120%";
    } else if(currentSize=="120%") {
        selectSize = "140%";
    } else if(currentSize=="140%") {
        selectSize = "160%";
    } else if(currentSize=="160%") {
        selectSize = "180%";
    } else if(currentSize=="180%") {
        selectSize = "200%";
    } else if(currentSize=="200%") {
        alert("これ以上文字を拡大することはできません。");
        selectSize = "200%";
    } else {
        selectSize = "100%";
    }
    document.getElementById(target).style.fontSize = selectSize;
    setCookie(selectSize);
}

function textSizeDown(){
    currentSize = document.getElementById(target).style.fontSize;
    if (!currentSize) {
        currentSize = "100%";
    }
    selectSize = "";
    if ( currentSize=="200%" || currentSize=="2.0em"){
        selectSize = "180%";
    } else if(currentSize=="180%") {
        selectSize = "160%";
    } else if(currentSize=="160%") {
        selectSize = "140%";
    } else if(currentSize=="140%") {
        selectSize = "120%";
    } else if(currentSize=="120%") {
        selectSize = "100%";
    } else if(currentSize=="100%") {
        selectSize = "80%";
    } else if(currentSize=="80%") {
        selectSize = "60%";
    } else if(currentSize=="60%") {
        selectSize = "40%";
    } else if(currentSize=="40%") {
        alert("これ以上文字を縮小することはできません。");
        selectSize = "40%";
    } else {
        selectSize = "100%";
    }
    document.getElementById(target).style.fontSize = selectSize;
    setCookie(selectSize);
}

function textSizeDefault(){
    currentSize = document.getElementById(target).style.fontSize;
    selectSize = "100%";
    document.getElementById(target).style.fontSize = selectSize;
    setCookie(selectSize);
}
