// 芋E取㊣A﹌ ﹉u╱Ｙ ﹉u﹞A
var POPUP_REGISTRY = null;			// 伊i﹞I伊E 芋E取㊣ ﹉╞A卹 易e０〝
function Popup_RegisterPopup(popupObject)
{
	if (POPUP_REGISTRY == null)
		POPUP_REGISTRY = new Array();
	if (popupObject != null)
		POPUP_REGISTRY[POPUP_REGISTRY.length] = popupObject;
}
function Popup_ShowPopup()
{
	if (POPUP_REGISTRY != null)
	{
		for (var i = 0; i < POPUP_REGISTRY.length; i++)
		{
			if (POPUP_REGISTRY[i] != null)
				POPUP_REGISTRY[i].show();
		}
	}
}
function PopupObject(name, url, width, height)
{
	this.name	= (name == null)? "popup": name;
	this.url	= (url == null)? "about:blank": url;
	this.width	= (width == null)? 400: width;
	this.height	= (height == null)? 412: height;
	this.top	= null;
	this.left	= null;
	this.scroll	= null;
	this.resize	= null;
	this.showFrom	= null;
	this.showTo		= null;

	this.open = PopupObject_Open;
	this.show = PopupObject_Show;
}
function PopupObject2(name, url, width, height)
{
	this.name	= (name == null)? "popup": name;
	this.url	= (url == null)? "about:blank": url;
	this.width	= (width == null)? 400: width;
	this.height	= (height == null)? 412: height;
	this.top	= null;
	this.left	= null;
	this.scroll	= null;
	this.resize	= null;
	this.showFrom	= null;
	this.showTo		= null;

	this.open = PopupObject_Open;
	this.show = PopupObject_Show;
}
function PopupObject_Open()
{
	var feature = "width=" + this.width;
	feature += ",height=" + this.height;
	if (this.top != null)
		feature += ",top=" + this.top;
	if (this.left != null)
		feature += ",left=" + this.left;
	if (this.scroll != null)
		feature += ",scrollbars=" + this.scroll;
	if (this.resize != null)
		feature += ",resizable=" + this.resize;
	return window.open(this.url, this.name, feature);
}
function PopupObject_Show()
{
	// ﹉O卦A ▽a﹉﹟AI 卹昆A５伊C取u╞U╱e
	if (this.showFrom != null && this.showTo != null)
	{
		var now = new Date();
		if (this.showFrom.valueOf() > now.valueOf() || this.showTo.valueOf() < now.valueOf())
			return false;
	}

	// AiA﹉﹉╳ 卹昆A５伊C取u╞U╱e
	if (GetCookie(this.name) == 'nothanks')
		return false;

	return this.open();
}

// AiA﹉ ﹉u﹞A
var COOKIE = null;					// 足芍卹Ｙ伊E AiA﹉ 易e０〝
function GetCookie(cookie_name)
{
	if (COOKIE == null)
	{
		COOKIE = new Array();
		var s = String(document.cookie);
		var a = s.split(/\s*;\s*/);
		for (i = 0; i < a.length; i++)
		{
			var b = a[i].split(/\s*=\s*/);
			if (b[1] != null && b[1] != "")
				COOKIE[b[0]] = unescape(b[1]);
		}
	}
	return COOKIE[cookie_name];
}
function Popup_SetCookie(name, value, expire_time)
{
	if (expire_time == null)
		expire_time = 24;		// 1AI
	var today = new Date();
	today.setHours(today.getHours() + expire_time);
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + today.toGMTString() + ";";
}

