var GA2ResultParam = null;
// ゲットアンプドⅡSNSログイン
function jumpSNS_GA2() {
	var url = "http://www.getamped2.jp/index_at.php?c=op&m=login&enc_param=";

	DWREngine.setTimeout(5000);
	DWREngine.setAsync(false);

	GA2ResultParam = null;
	ContentCyberStep.getAutoLoginParam(CallbackResultParamGA2, 1561);
	if(GA2ResultParam == null) {
		alert(getMessage('content.error.system'));
		return;
	}
	if(GA2ResultParam == "ER1") {
		alert(getMessage('content.error.login'));
		return;
	}
	if(GA2ResultParam == "ER2") {
		alert(getMessage('ga2.error.entry'));
		return;
	}

	url = url + GA2ResultParam;
	window.open(url,'GA2SNS');
}

function CallbackResultParamGA2(value) {
	GA2ResultParam = value;
}

// Ｇコイン、ぐっせる所有数表示関連
function getGA2Data(accountId,itemid)
{
	DWREngine.setTimeout(5000);
	DWREngine.setAsync(true);
    ChangeAvatarInfo.getCoinInfo(CallbackCoinInfo);
    ContentCyberStep.productRef(CallbackGA2Info, accountId, '1561','315610000');
}

function CallbackCoinInfo(value)
{
    var strgcoin      = null;
    var strtodaypcoin = null;
    var strpcoin      = null;

    if(value == null) {
        strgcoin      = "----";
        strtodaypcoin = "----";
        strpcoin      = "----";
    } else {
        strgcoin      = document.createTextNode(value.gcoin);
        strtodaypcoin = document.createTextNode(value.todayPcoin);
        strpcoin      = document.createTextNode(value.pcoin);
    }

    var gCoin = document.getElementById('nowGCoin');
    if(gCoin != null) {
        gCoin.removeChild(gCoin.lastChild);
        gCoin.appendChild(strgcoin);
    }

    var pCoin = document.getElementById('nowPCoin');
    if(pCoin != null) {
        pCoin.removeChild(pCoin.lastChild);
        pCoin.appendChild(strpcoin);
    }

    var todayPCoin = document.getElementById('todayPCoin');
    if(todayPCoin != null) {
        todayPCoin.removeChild(todayPCoin.lastChild);
        todayPCoin.appendChild(strtodaypcoin);
    }
}

function CallbackGA2Info(value)
{
    var point = null;
    if(value) {
    	if(value.result == '000'){
			point = document.createTextNode(value.amount);
		}
    }

    if(point == null) {
		point = document.createTextNode("----");
    }
    var elem = document.getElementById('crescent');
    if(elem != null) {
        elem.removeChild(elem.lastChild);
        elem.appendChild(point);
    }
}

