﻿var url_root = "/";
var https_url_root = "https://www.celbest.net/";

function initCartItem() {
    var url = url_root + "state.ashx";
   	new Ajax.Request(url, {method: 'get', onComplete: receiveJsonComplete,
   	                    requestHeaders: ['If-Modified-Since', '01 Jan 1970 00:00:00 GMT']});
}

function receiveJsonComplete(httpObj){
    var loginInfo = httpObj.responseText.evalJSON();
    if (loginInfo.Login == 1) {
        document.getElementById("loginInfo").innerHTML = '<img src="' + url_root + 'img_cmn/welcome.gif" width="49" height="17" />' + loginInfo.Name + '<img src="' + url_root + 'img_cmn/sama.gif" width="17" height="17" /><a href="' + https_url_root + 'ec/mypage.aspx"><img src="' + url_root + 'img_cmn/mypage.gif" alt="マイページへ" width="105" height="18" /><a/><a href="' + https_url_root + 'ec/logout.aspx"><img src="' + url_root + 'img_cmn/logout.gif" alt="ログアウト" width="93" height="24" /></a><a href="' + https_url_root + 'cart.aspx"><img src="' + url_root + 'img_cmn/cart.gif" alt="カートを見る" width="103" height="24" /></a>';
    } else {
        document.getElementById("loginInfo").innerHTML = '<img src="' + url_root + 'img_cmn/welcome.gif" width="49" height="17" />' + loginInfo.Name + '<img src="' + url_root + 'img_cmn/sama.gif" width="17" height="17" /><a href="' + https_url_root + 'ec/UserLogin.aspx?mode=login"><img src="' + url_root + 'img_cmn/login.gif" width="93" height="24" /></a><a href="' + https_url_root + 'cart.aspx"><img src="' + url_root + 'img_cmn/cart.gif" width="103" height="24" /></a>';
    }
}


