/*-----------*/
/*--mycucoa--*/
/*-----------*/
//url
var url_customer = "/api/customer.php";
var url_cart = "/api/cart.php";

j$ = jQuery.noConflict();
//クッキー取得
//mycuoca
j$(function (){
	ULID = j$.cookie('ULID');
	UPID = j$.cookie('UPID');
	if(ULID && UPID){
		var ntime = (new Date()).getTime();
		j$.getJSON(url_customer,{type:'json',cust_id:ULID,passwd:UPID,ntime:ntime},callbackGetCustomerData);
	}
	else{
		j$("#mycuoca-name2").html("ようこそ、ゲストさん");
		//j$("#mycuoca-point").html('クオカポイント<span class="attention">0pt</span>');
		j$("#login").html('<a href="https://mycuoca.cuoca.com/index.html?mode=login">ログイン</a>');
		j$("#mycuoca-body").append('<div id="biginner-image"><a href="http://www.cuoca.com/library/about/welcome/"><img src="/library/common/parts/smartcart/mycuoca_biginner.gif"></a></div>');
	}
});
//
//mycuoca表示
function callbackGetCustomerData(data, status) {
	//j$.dump(data,status);
	if(data.result == "OK"){
		j$("#mycuoca-name2").html("ようこそ、"+data.customer.last_name + data.customer.first_name+"さん");
		j$("#mycuoca-point").html('クオカポイント<span class="attention">' + data.customer.point + 'pt</span>');
		j$("#mycuoca-body").append('<ul></ul>');
		j$("#mycuoca-body ul").append('<li><a href="https://mycuoca.cuoca.com/index.html">mycuocaへ</a></li>');
		j$("#mycuoca-body ul").append('<li><a href="https://mycuoca.cuoca.com/myhistory.php">ご注文状況・履歴</a></li>');
		j$("#mycuoca-body ul").append('<li><a href="http://www.cuoca.com/cart/cart.php">カートの中を見る</a></li>');
		j$("#login").html('<a href="http://mycuoca.cuoca.com/login.php?mode=logout&ref=/index.html">ログアウト</a>');
	}
	else{
		j$("#mycuoca-name2").html("ようこそ、ゲストさん");
		//j$("#mycuoca-point").html('クオカポイント<span class="attention">0pt</span>');
		j$("#login").html('<a href="https://mycuoca.cuoca.com/index.html?mode=login">ログイン</a>');
		j$("#mycuoca-body").append('<div id="biginner-image"><a href="http://www.cuoca.com/library/about/welcome/"><img src="/library/common/parts/smartcart/mycuoca_biginner.gif"></a></div>');
	}
}
