if (document.cookie.indexOf('x_site_sess')>=0) { // ログイン状態
	name = decodeURI(getCookie('user_name'));
	html  = '<li class="welcome">ようこそ、'+name+"さま</li>\n";
	html += '<li class="mypage"><a href="https://yamatogokoro.jp/mypage/"><img src="http://www.yamatogokoro.jp/images/login/btn_mypage.jpg" alt="マイページへ" width="95" height="19" border="0"></a></li>\n';
	html += '<li class="logout"><a href="https://yamatogokoro.jp/users/?page=Login&action=logout"><img src="http://www.yamatogokoro.jp/images/login/btn_logout.jpg" alt="ログアウト" width="85" height="19" border="0"></a></li>\n';
	document.getElementById('login').innerHTML=html;
} else { // not ログイン状態
	html  = '<li class="login2"><a href="https://yamatogokoro.jp/mypage/"><img src="http://www.yamatogokoro.jp/images/login/btn_login.jpg" alt="ログイン" width="75" height="19" border="0"></a></li>\n';
	html += '<li class="signup"><a href="https://yamatogokoro.jp/users/"><img src="http://www.yamatogokoro.jp/images/login/btn_signup.jpg" alt="登録" width="115" height="19" border="0"></a></li>\n';
	document.getElementById('login').innerHTML=html;
}

function getCookie(key) {
    tmp1 = " " + document.cookie + ";";
    xx1 = xx2 = 0;
    len = tmp1.length;
    while (xx1 < len) {
        xx2 = tmp1.indexOf(";", xx1);
        tmp2 = tmp1.substring(xx1 + 1, xx2);
        xx3 = tmp2.indexOf("=");
        if (tmp2.substring(0, xx3) == key) {
            return(unescape(tmp2.substring(xx3 + 1, xx2 - xx1 - 1)));
        }

        xx1 = xx2 + 1;
    }
    return("");
}

