// Ｇコイン、ぐっせる所有数表示関連
function getLataleData(accountId,itemid)
{
	ChangeAvatarInfo.getCoinInfo(CallbackLatalePointInfo);
	ContentLink.productRef(CallbackLataleContentPointInfo, accountId, '1551',itemid);
}

function CallbackLatalePointInfo(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 CallbackLataleContentPointInfo(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('nowLPPoint');
	if(elem != null) {
		elem.removeChild(elem.lastChild);
		elem.appendChild(point);
	}
}

var encParamLatale = null;
// ラテール用サポートページ表示
//   type = 1 : ご意見ご要望
//        = 2 : お問い合わせ
function jumpSupportLatale(gameId,type) {

	var url = "http://www.gamepot.co.jp/gic/alliance/common/atgame/login.ashx?content=latale";

	if(type == 2) {
		DWREngine.setTimeout(5000);
		DWREngine.setAsync(false);

		encParamLatale = null;
		ContentLinkGamePot.getAutoLoginParamWithLabel(CallbackEncParamLatale,gameId);
		if(encParamLatale == null) {
			alert(getMessage('latale.error.system'));
			return;
		}
		if(encParamLatale == "ER1") {
			alert(getMessage('latale.error.login'));
			return;
		}
		if(encParamLatale == "ER2") {
			alert(getMessage('latale.error.entry'));
			return;
		}

		url = url + "&encParam=" + encParamLatale;
	}

	window.open(url,'LataleSupport');
}

function CallbackEncParamLatale(value) {
	encParamLatale = value;
}


var encParamLataleLetter = null;
// ラテールお便りページ表示
function jumpLataleLetter(gameId) {

	var url = "http://www.latale.jp/gcrest/login.ashx";

	DWREngine.setTimeout(5000);
	DWREngine.setAsync(false);

	encParamLataleLetter = null;
	ContentLinkGamePot.getAutoLoginParamWithLabel(CallbackEncParamLataleLetter,gameId);
	if(encParamLataleLetter == null) {
		alert(getMessage('latale.error.system'));
		return;
	}
	if(encParamLataleLetter == "ER1") {
		alert(getMessage('latale.error.login'));
		return;
	}
	if(encParamLataleLetter == "ER2") {
		alert(getMessage('latale.error.entry'));
		return;
	}

	url = url + "?encParam=" + encParamLataleLetter;

	window.open(url,'LataleLetter');
}

function CallbackEncParamLataleLetter(value) {
	encParamLataleLetter = value;
}

