
function eposSpjCookie() {
    this.initialize.apply(this, arguments);
}
eposSpjCookie.prototype = {
	initialize: function() {
		// const
	},
	
	checkCookie: function() {

	},
	
	// Cookieに値を設定
	setCookie: function(id, value) {
		var Expires = "expires=" + this.getExpDate(30,0,0);
		var param = id + "=" + escape(value);
		
		document.cookie = param + "; "+ Expires + "; path=/";
		//alert(param + "; "+ Expires);
	},
	
	// Cookieから値を設定
	getCookie: function(id) {
		var cookieLength = document.cookie.length;
		
		if (cookieLength == 0) {
			return;
		}
		
		var cookieList = document.cookie.split("; ");
		var c = cookieList.length;
		
		for (var i = 0; i < c; i++) {
			var kv = cookieList[i].split("=");
			//alert(kv[0] + " " + id);
			if (kv[0] == id) {
				//alert(unescape(kv[1]));
				return unescape(kv[1]);
			}
		}
	},
	
	// 削除
	deleteCookie: function() {
		var Expires = this.getExpDate(-1,0,0);
		var cookieLength = document.cookie.length;
		
		if (cookieLength == 0) {
			return;
		}
		
		var cookieList = document.cookie.split("; ");
		var c = cookieList.length;
		
		for (var i = 0; i < c; i++) {
			var kv = cookieList[i].split("=");
			// cookieから削除する対象を指定する 2010.8.12 M&C sakurai
			if (kv[0] == "top_flg" || kv[0] == "change_link" || kv[0] == "card_design130") {
				document.cookie = kv[0] + "= ; "+ "expires=" + Expires + "; path=/";
			}
		}
	},
	
	// 期限用日付取得
	getExpDate: function(days, hours, minutes) {
		var expDate = new Date();
		if (typeof days == "number" && typeof hours == "number" && typeof minutes == "number") {
			expDate.setDate(expDate.getDate() + parseInt(days));
			expDate.setHours(expDate.getHours() + parseInt(hours));
			expDate.setMinutes(expDate.getMinutes() + parseInt(minutes));
			return expDate.toGMTString();
		}
	}
};

var eposSpMyjCookie = new eposSpjCookie(); // クッキー操作クラス

