/**********************************************************/
/**                  jsRingMenu ver.1.0                  **/
/**         (C) 2008 LLLuna All Rights Reserved.         **/
/**      月夜丘: < http://llluna.s1.hayasoft.com/ >      **/
/**                                                      **/
/**  ・動作確認環境                                      **/
/**      ・Windows Internet Explorer 7                   **/
/**      ・Mozilla Firefox 2.0.0.x                       **/
/**      ・Opera Browser 9.2x                            **/
/**      ・Safari 3.0.x                                  **/
/**      ※上記ブラウザはいずれもWindows版               **/
/**  ・最新の更新内容(2008年1月1日)                      **/
/**      ・SiteMenuをベースに作成。                      **/
/**********************************************************/


function jsRingMenu()
{
/**********************************************************/
/**  設定                                                **/
/**********************************************************/

	//HTMLのlink要素を使ふか（眞僞値）
	this.useLinkElements = false;

	// メニューの項目を指定。パイプ文字「|」で區切り、「項目名|アイコン|參照先URI」と記述。
	// useLinkElementsがtrueの場合は、「項目名|アイコン|rel屬性値」と記述。
	// この場合、項目名に $title$ を記述するとlink要素のtitle屬性値に置換される。
	this.items = [
		"ご案内|/img/ringmenu/about.png|/about.html",
		"更新履歴|/img/ringmenu/history.png|/history/",
		"プロフィール|/img/ringmenu/profile.png|/profile.html",
		"ツクール|/img/ringmenu/tkool.png|/tkool/",
		"スクリプト|/img/ringmenu/script.png|/script/",
		"掲示板|/img/ringmenu/bbs.png|/bbs/",
		"リンク集|/img/ringmenu/link.png|/link.html",
		"The Silver Moon|/img/ringmenu/blog.png|http://llluna.blog57.fc2.com/",
		"ご連絡|/img/ringmenu/mail.png|/contact.html"
	];
/*
	this.items = [
		"前のページ $title$|linknavi/prev.png|prev",
		"次のページ $title$|linknavi/next.png|next",
		"目次ページ $title$|linknavi/contents.png|next",
		"索引ページ $title$|linknavi/index.png|index",
		"先頭ページ $title$|linknavi/start.png|start",
		"ヘルプページ $title$|linknavi|help.png|help"
	];
*/

	// この外部スクリプトファイル名を記述。アイコン及び參照先に指定された相對URIの基準とする。
	// 空の場合、またファイル名に誤りがある場合はスクリプトが讀み込まれるHTMLファイルを基準とする。
	// useLinkElementsがtrueの場合、參照先はHTMLファイルを基準とし、アイコンは上記に從ふ。
	this.jsFileName = "main.js";
	

	// リングメニューの半径（ピクセル値）
	// 實際にはアイコンのサイズ分これより大きくなる。
	this.radius = 115;

	// リングメニューをフェードさせるか。（眞僞値）
	this.useFadeMenu = true;

	// マウスホイールによるメニューの廻轉量（度數。0なら無效）
	this.rollRate = 10;
	
	// AlphaImageLoaderを使用してIE6で半透過PNGが扱へる樣にする（眞僞値）
	this.useAlphaImageLoader = true;
	
	// その際に使用する透明なダミー畫像
	this.dummyImg = "/img/ringmenu/transparent.png";

/**********************************************************/
/**  設定終了（以下不用意に弄らない事）                  **/
/**********************************************************/
	try
	{
		this.baseDir = "";
		if(this.jsFileName != "")
		{
			var scripts = document.getElementsByTagName("script");
			var pattern = new RegExp('^(.*/)?'+this.jsFileName+'$', 'g');
			for(var i=0; i < scripts.length; i++)
			{
				var filepath = scripts.item(i).getAttribute("src");
				if(filepath.match(pattern))
				{
					this.baseDir = filepath.substring(0, filepath.lastIndexOf("/")+1);
				}
			}
		}

		this.menu = document.createElement("ul");
		this.menu.className = "jsRingMenu";
		this.menu.style.position = "absolute";
		this.menu.style.marginTop = this.menu.style.marginRight = this.menu.style.marginBottom = this.menu.style.marginLeft = 0;
		this.menu.style.paddingTop = this.menu.style.paddingRight = this.menu.style.paddingBottom = this.menu.style.paddingLeft = 0;
		this.menu.style.listStyleType = this.menu.style.listStyleImage = "none";
		this.menu.style.background = "transparent url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVR42mNkAAIAAAoAAv/lxKUAAAAASUVORK5CYII=)";
		this.menu.style.top = this.menu.style.left = 0;
		this.menu.style.visibility = "hidden";
		this.menu.style.zIndex = 1000000;
		this.imgs = new Array();
		var linkitems = new Array();
		this.pattern = new RegExp('^(/|(https?|ftp|urn|data):)', 'g');
		for(n=0; n < this.items.length; n++)
		{
			this.items[n] = this.items[n].split("|");
			if(this.useLinkElements)
			{
				linkitems[this.items[n][2]] = this.items[n];
				this.imgs[this.items[n][2]] = new Image();
				if(this.items[n][1].match(this.pattern)) this.imgs[this.items[n][2]].src = this.items[n][1];
				else this.imgs[this.items[n][2]].src = this.baseDir + this.items[n][1];
			}
			else
			{
				this.imgs[n] = new Image();
				if(this.items[n][1].match(this.pattern)) this.imgs[n].src = this.items[n][1];
				else this.imgs[n].src = this.baseDir + this.items[n][1];
			}
		}
		if(this.useLinkElements) this.items = linkitems;
		if(this.menu.style.opacity == undefined && this.menu.style.filter == undefined)
		{
			this.useFadeMenu = false;
		}
		this.transimg = new Image();
		if(this.dummyImg.match(this.pattern)) this.transimg.src = this.dummyImg;
		else this.transimg.src = this.baseDir + this.dummyImg;
		this.fadingTime = 10;
		this.opacity = 0;
		this.version = "1.0";
		return this;
	}
	catch(e)
	{
		return;
	}
}

jsRingMenu.prototype =
{
	launch : function()
	{
		try
		{
			for(var i in jRM.imgs)
			{
				jRM.menu.style.width = jRM.radius * 2 + jRM.imgs[i].width + 12 + "px";
				jRM.menu.style.height = jRM.radius * 2 + jRM.imgs[i].height + 12 + "px";
				break;
			}
			jRM.lists = new Array();
			if(jRM.useLinkElements)
			{
				var links = document.getElementsByTagName("link");
				var i = 0;
				for(var n=0; n < links.length; n++)
				{
					var rel = links.item(n).getAttribute("rel");
					var title = links.item(n).getAttribute("title") || "";
					var href = links.item(n).getAttribute("href");
					var hreflang = links.item(n).getAttribute("hreflang");
					if(rel && jRM.items[rel] && href)
					{
						jRM.lists[i] = document.createElement("li");
						var anchor = document.createElement("a");
						var icon = document.createElement("img");
						if(jRM.useAlphaImageLoader && icon.style.filter != undefined && !window.XMLHttpRequest)
						{
							icon.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=image, src='"+jRM.imgs[rel].src+"')";
							icon.setAttribute("src", jRM.transimg.src);
						}
						else icon.setAttribute("src", jRM.imgs[rel].src);
						icon.setAttribute("alt", jRM.items[rel][0].replace("$title$", title));
						icon.width = jRM.imgs[rel].width;
						icon.height = jRM.imgs[rel].height;
						icon.style.position = "absolute";
						icon.style.zIndex = 1;
						anchor.setAttribute("href", href);
						anchor.setAttribute("title", jRM.items[rel][0].replace("$title$", title));
						if(hreflang) anchor.setAttribute("hreflang", hreflang);
						anchor.appendChild(icon);
						jRM.lists[i].appendChild(anchor);
						jRM.menu.appendChild(jRM.lists[i]);
						i++;
					}
				}
			}
			else
			{
				for(var n=0; n < jRM.items.length; n++)
				{
					jRM.lists[n] = document.createElement("li");
					var anchor = document.createElement("a");
					var icon = document.createElement("img");
					if(jRM.useAlphaImageLoader && icon.style.filter != undefined && !window.XMLHttpRequest)
					{
						icon.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=image, src='"+jRM.imgs[n].src+"')";
						icon.setAttribute("src", jRM.transimg.src);
					}
					else icon.setAttribute("src", jRM.imgs[n].src);
					icon.setAttribute("alt", jRM.items[n][0]);
					icon.style.position = "absolute";
					icon.style.zIndex = 1;
					if(jRM.items[n][2].match(jRM.pattern)) anchor.setAttribute("href", jRM.items[n][2]);
					else anchor.setAttribute("href", jRM.baseDir + jRM.items[n][2]);
					anchor.setAttribute("title", jRM.items[n][0]);
					anchor.appendChild(icon);
					jRM.lists[n].appendChild(anchor);
					jRM.menu.appendChild(jRM.lists[n]);
				}
			}
			if(jRM.lists.length == 0) return;
			jRM.space = 2 / jRM.lists.length * Math.PI;
			document.body.appendChild(jRM.menu);
			var styleTest = jRM.menu.currentStyle || document.defaultView.getComputedStyle(jRM.menu, '');
			if(styleTest.position != "absolute")
			{
				document.body.removeChild(jRM.menu);
				return;
			}

			//jRM.addEvent(document.documentElement, "dblclick", jRM.show);
			jRM.addEvent(document.documentElement, "click", jRM.showhide);
			jRM.addEvent(window, "resize", jRM.adjust);
			jRM.addEvent(window, "scroll", jRM.adjust);
			if(jRM.rollRate)
			{
				jRM.addEvent(jRM.menu, "mousewheel", jRM.wheel);
				jRM.addEvent(jRM.menu, "DOMMouseScroll", jRM.wheel);
			}
			return;
		}
		catch(e)
		{
			return;
		}
	},
	adjust : function()
	{
		if(jRM.menu.style.visibility == "visible")
		{
			jRM.getPageSize();
			var center_x = jRM.menu.clientWidth / 2;
			var center_y = jRM.menu.clientHeight / 2;
			var menu_x = jRM.scrollX + jRM.clientX - jRM.menu.clientWidth/2;
			var menu_y = jRM.scrollY + jRM.clientY - jRM.menu.clientHeight/2;

			if(jRM.clientX + jRM.menu.clientWidth/2 > jRM.iWidth) menu_x = jRM.scrollX + jRM.iWidth - jRM.menu.clientWidth;
			else if(jRM.clientX - jRM.menu.clientWidth/2 < 0) menu_x = jRM.scrollX;
			if(jRM.clientY + jRM.menu.clientHeight/2 > jRM.iHeight) menu_y = jRM.scrollY + jRM.iHeight - jRM.menu.clientHeight;
			else if(jRM.clientY - jRM.menu.clientHeight/2 < 0) menu_y = jRM.scrollY;

			jRM.menu.style.left = menu_x + "px";
			jRM.menu.style.top = menu_y + "px";
			var firstPos = jRM.lists.length == 2 ? 1 : 0.5;
			for(var i=0; i < jRM.lists.length; i++)
			{
				var icon = jRM.lists[i].firstChild.firstChild;
				base_x = (jRM.useFadeMenu? jRM.opacity : 1) * jRM.radius * Math.cos(jRM.space * i + firstPos * Math.PI + jRM.wheelAdjust * (jRM.rollRate/180) * Math.PI);
				base_y = (jRM.useFadeMenu? jRM.opacity : 1) * jRM.radius * Math.sin(jRM.space * i + firstPos * Math.PI + jRM.wheelAdjust * (jRM.rollRate/180) * Math.PI);
				icon.style.left = center_x + base_x - jRM.imgs[i].width/2 + "px";
				icon.style.top = center_y - base_y - jRM.imgs[i].height/2 + "px";
			}
		}
	},
	showhide : function(e)
	{
		if(e && e.altKey) jRM.show(e);
		else jRM.hide();
	},
	show : function(e)
	{
		jRM.getPageSize();
		if(jRM.menu.style.visibility == "hidden" || !jRM.useFadeMenu)
		{
			jRM.clientX = e.clientX;
			jRM.clientY = e.clientY;
			jRM.wheelAdjust = 0;
			if(jRM.useFadeMenu) jRM.fadein();
			jRM.menu.style.visibility = "visible";
			jRM.adjust();
		}
		else if(jRM.opacity == 1)
		{
			jRM.moveX = (e.clientX - jRM.clientX) / 10;
			jRM.moveY = (e.clientY - jRM.clientY) / 10;
			jRM.moveCount = 0;
			jRM.moveRing();
		}
	},
	moveRing : function()
	{
		clearTimeout(jRM.fadingTime);
		jRM.clientX += jRM.moveX;
		jRM.clientY += jRM.moveY;
		jRM.adjust();
		jRM.moveCount++;
		if(jRM.moveCount < 10) jRM.fadingTime = setTimeout("jRM.moveRing()", 10);
	},
	hide : function()
	{
		if(jRM.useFadeMenu) jRM.fadeout();
		else jRM.resetPosition();
	},
	fadein : function()
	{
		clearTimeout(jRM.fadingTime);
		if(jRM.opacity >= 1)
		{
			if(jRM.menu.style.filter != undefined) jRM.menu.style.filter = "";
			return;
		}
		jRM.opacity += 0.1;
		if(jRM.opacity > 1) jRM.opacity = 1;
		jRM.setOpacity(jRM.opacity);
		jRM.adjust();
		jRM.fadingTime = setTimeout("jRM.fadein()", 10);
	},
	fadeout : function()
	{
		clearTimeout(jRM.fadingTime);
		if(jRM.opacity <= 0)
		{
			jRM.resetPosition();
			if(jRM.menu.style.filter != undefined) jRM.menu.style.filter = "";
			return;
		}
		jRM.opacity -= 0.1;
		if(jRM.opacity < 0) jRM.opacity = 0;
		jRM.setOpacity(jRM.opacity);
		jRM.adjust();
		jRM.fadingTime = setTimeout("jRM.fadeout()", 10);
	},
	wheel : function(e)
	{
		if(e.detail < 0) jRM.wheelAdjust++;
		else if(e.detail > 0) jRM.wheelAdjust--;
		else if(e.wheelDelta > 0) jRM.wheelAdjust++;
		else if(e.wheelDelta < 0) jRM.wheelAdjust--;

		jRM.adjust();
		e.preventDefault();
		e.stopPropagation();
	},
	resetPosition : function()
	{
		jRM.menu.style.visibility = "hidden";
		jRM.menu.style.left = jRM.menu.style.top = 0;
	},
	setOpacity : function(num)
	{
		if(jRM.menu.style.opacity != undefined) jRM.menu.style.opacity = num;
		else if(jRM.menu.style.filter != undefined) jRM.menu.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=" + (num*100) + ")";
	},
	addEvent : function(obj, type, func)
	{
		try
		{
			obj.addEventListener(type, func, false);
			return;
		}
		catch(x)
		{
			try
			{
				obj.attachEvent("on" + type, function(){func({
					altKey : window.event.altKey,
					pageX : document.body.scrollLeft + document.documentElement.scrollLeft + window.event.clientX,
					pageY : document.body.scrollTop + document.documentElement.scrollTop + window.event.clientY,
					clientX : window.event.clientX,
					clientY : window.event.clientY,
					preventDefault : function(){window.event.returnValue = false},
					stopPropagation : function(){window.event.cancelBubble = true},
					keyCode : window.event.keyCode,
					wheelDelta : window.event.wheelDelta
				})});
				return;
			}
			catch(e)
			{
				return;
			}
		}
	},
	getPageSize : function()
	{
		if(self.innerHeight)
		{
			jRM.iWidth = document.documentElement.clientWidth ?
				document.documentElement.clientWidth : self.innerWidth;
			jRM.iHeight = self.innerHeight;
		}
		else if(document.documentElement && document.documentElement.clientHeight)
		{
			jRM.iWidth = document.documentElement.clientWidth;
			jRM.iHeight = document.documentElement.clientHeight;
		}
		else if(document.body)
		{
			jRM.iWidth = document.body.clientWidth;
			jRM.iHeight = document.body.clientHeight;
		}
		var pSizeX, pSizeY;
		if(window.scrollMaxY)
		{
			pSizeX = jRM.iWidth + window.scrollMaxX;
			pSizeY = jRM.iHeight + window.scrollMaxY;
		}
		else if(document.body.scrollHeight > document.body.offsetHeight)
		{
			pSizeX = document.body.scrollWidth;
			pSizeY = document.body.scrollHeight;
		}
		else
		{
			pSizeX = document.body.offsetWidth;
			pSizeY = document.body.offsetHeight;
		}
		jRM.scrollY = document.body.scrollTop || document.documentElement.scrollTop;
		jRM.scrollX = document.body.scrollLeft || document.documentElement.scrollLeft;
		jRM.pageSizeX = pSizeX < jRM.iWidth ? jRM.iWidth : pSizeX;
		jRM.pageSizeY = pSizeY < jRM.iHeight ? jRM.iHeight : pSizeY;
		return;
	}
}
jRM = new jsRingMenu();
jRM.addEvent(window, "load", jRM.launch);

/**********************************************************/
/**                 ImagePopup ver.2.3.0                 **/
/**      (C) 2006-2007 LLLuna All Rights Reserved.       **/
/**                                                      **/
/**  ・動作確認環境                                      **/
/**      ・Windows Internet Explorer 7                   **/
/**      ・Mozilla Firefox 2.0.0.x                       **/
/**      ・Opera Browser 9.2x                            **/
/**      ・Safari 3.0.x                                  **/
/**      ※上記ブラウザはいずれもWindows版               **/
/**  ・最新の更新内容(2007年 8月 6日)                    **/
/**      ・ページ・表示領域のサイズ取得方法を変更。      **/
/**********************************************************/


function imagePopup()
{
	this.loadMsg = "Loading…";
		//読み込み中メッセージ
	this.errorMsg = "Failed to load image…";
		//読み込みエラーメッセージ
	this.backClass = "image-back";
		//背景のclass
	this.popupClass = "image-popup";
		//ポップアップのclass
	this.loadingClass = "image-loading";
		//ロードメッセージのclass
	this.backEnable = true;
		//グレーアウトするかしないか
	this.backOpacity = 0.75;
		//グレーアウト用div要素の不透明度(0～1の実数)
}
imagePopup.prototype =
{
	init : function()
	{
		try
		{
			ip.addEvent(document.documentElement, "click", ip.check);
			ip.addEvent(document.documentElement, "keydown", ip.key);
			ip.addEvent(window, "resize", ip.resize);
			if(ip.backEnable && document.body.style.opacity == undefined && document.body.style.filter == undefined)
			{
				ip.backEnable = false;
			}
		}
		catch(e)
		{
			return;
		}
	},
	check : function(e)
	{
		if(e.target.parentNode.tagName == "A")
		{
			e.anchor = e.target.parentNode;
		}
		else
		{
			e.anchor = e.target;
		}
		if(e.anchor.tagName == "A" && e.anchor.getAttribute("href").match(/\.(jpe?g|png|gif)$/gi) != null)
		{
			ip.loadImg(e);
			e.preventDefault();
			e.stopPropagation();
		}
		else if(ip.showing)
		{
			ip.hide();
			e.preventDefault();
			e.stopPropagation();
		}
	},
	loadImg : function(e)
	{
		if(ip.showing) ip.hide();
		ip.getPageSize();
		if(ip.backEnable)
		{
			ip.back = document.createElement("div");
			ip.back.className = ip.backClass;
			ip.back.style.background = "black";
			ip.back.style.position = "absolute";
			ip.back.style.top = 0;
			ip.back.style.left = 0;
			ip.back.style.width = ip.pageSizeX + "px";
			ip.back.style.height = ip.pageSizeY + "px";
			ip.back.style.zIndex = 9999999;
			if(ip.back.style.opacity != undefined)
			{
				ip.back.style.opacity = ip.backOpacity;
			}
			else if(ip.back.style.filter != undefined)
			{
				ip.back.style.filter = "Alpha(opacity=" + (ip.backOpacity * 100) + ")";
			}
			ip.backShowing = true;
			document.body.appendChild(ip.back);
		}
		ip.loading = document.createElement("p");
		ip.loading.appendChild(document.createTextNode(ip.loadMsg));
		ip.loading.className = ip.loadingClass;
		ip.loading.style.position = "absolute";
		ip.loading.style.left = ip.scrollX + "px";
		ip.loading.style.width = ip.iWidth + "px";
		ip.loading.style.zIndex = 10000000;
		ip.popup = document.createElement("p");
		ip.popup.className = ip.popupClass;
		ip.popup.style.position = "absolute";
		if(ip.popup.style.position != "absolute") return;
		ip.popup.style.top = 0;
		ip.popup.style.left = 0;
		ip.popup.style.zIndex = 10000000;
		ip.popup.style.visibility = "hidden";
		ip.popupImg = document.createElement("img");
		ip.addEvent(ip.popupImg, "load", ip.show);
		ip.addEvent(ip.popupImg, "error", ip.error);
		ip.popupImg.setAttribute("src", e.anchor.getAttribute("href"));
		ip.popupImg.setAttribute("alt", "");
		ip.popupImg.setAttribute("title", "クリック又はXキー押下で閉じます。");
		ip.popup.appendChild(ip.popupImg);
		document.body.appendChild(ip.loading);
		ip.loading.style.top = ip.scrollY + ((ip.iHeight - ip.loading.clientHeight) / 2) + "px";
		document.body.appendChild(ip.popup);
		ip.showing = true;
	},
	show : function()
	{
		ip.getPageSize();
		ip.iHeight = (ip.iHeight - ip.popupImg.height) / 2;
		ip.iWidth = (ip.iWidth - ip.popupImg.width) / 2;
		if(ip.iHeight < 0) ip.iHeight = 0;
		if(ip.iWidth < 0) ip.iWidth = 0;
		ip.popup.style.width = ip.popupImg.width + "px";
		ip.popup.style.height = ip.popupImg.height + "px";
		ip.popup.style.top = ip.scrollY + ip.iHeight + "px";
		ip.popup.style.left = ip.scrollX + ip.iWidth + "px";
		ip.loading.style.visibility = "hidden";
		ip.popup.style.visibility = "visible";
		if(ip.backEnable)
		{
			ip.getPageSize();
			ip.back.style.width = ip.pageSizeX + "px";
			ip.back.style.height = ip.pageSizeY + "px";
		}
	},
	hide : function()
	{
		document.body.removeChild(ip.back);
		document.body.removeChild(ip.loading);
		document.body.removeChild(ip.popup);
		ip.backShowing = false;
		ip.showing = false;
	},
	error : function()
	{
		while(ip.loading.firstChild)
		{
			ip.loading.removeChild(ip.loading.firstChild);
		}
		ip.loading.appendChild(document.createTextNode(ip.errorMsg));
	},
	resize : function()
	{
		if(ip.backEnable && ip.backShowing)
		{
			ip.getPageSize();
			ip.back.style.width = ip.pageSizeX + "px";
			ip.back.style.height = ip.pageSizeY + "px";
		}
		if(ip.showing)
		{
			ip.getPageSize();
			ip.loading.style.top = ip.scrollY + ((ip.iHeight - ip.loading.clientHeight) / 2) + "px";
			ip.loading.style.left = ip.scrollX + "px";
			ip.loading.style.width = ip.iWidth + "px";
			if(ip.popup.style.visibility == "visible")
			{
				ip.iHeight = (ip.iHeight - ip.popupImg.height) / 2;
				ip.iWidth = (ip.iWidth - ip.popupImg.width) / 2;
				if(ip.iHeight < 0) ip.iHeight = 0;
				if(ip.iWidth < 0) ip.iWidth = 0;
				ip.popup.style.width = ip.popupImg.width + "px";
				ip.popup.style.height = ip.popupImg.height + "px";
				ip.popup.style.top = ip.scrollY + ip.iHeight + "px";
				ip.popup.style.left = ip.scrollX + ip.iWidth + "px";
			}
		}
	},
	getPageSize : function()
	{
		if(self.innerHeight)
		{
			ip.iWidth = document.documentElement.clientWidth ?
				document.documentElement.clientWidth : self.innerWidth;
			ip.iHeight = self.innerHeight;
		}
		else if(document.documentElement && document.documentElement.clientHeight)
		{
			ip.iWidth = document.documentElement.clientWidth;
			ip.iHeight = document.documentElement.clientHeight;
		}
		else if(document.body)
		{
			ip.iWidth = document.body.clientWidth;
			ip.iHeight = document.body.clientHeight;
		}
		var pSizeX, pSizeY;
		if(window.scrollMaxY)
		{
			pSizeX = ip.iWidth + window.scrollMaxX;
			pSizeY = ip.iHeight + window.scrollMaxY;
		}
		else if(document.body.scrollHeight > document.body.offsetHeight)
		{
			pSizeX = document.body.scrollWidth;
			pSizeY = document.body.scrollHeight;
		}
		else
		{
			pSizeX = document.body.offsetWidth;
			pSizeY = document.body.offsetHeight;
		}
		ip.scrollY = document.body.scrollTop || document.documentElement.scrollTop;
		ip.scrollX = document.body.scrollLeft || document.documentElement.scrollLeft;
		ip.pageSizeX = pSizeX < ip.iWidth ? ip.iWidth : pSizeX;
		ip.pageSizeY = pSizeY < ip.iHeight ? ip.iHeight : pSizeY;
		return;
	},
	key : function(e)
	{
		if(e.keyCode == 88 && ip.showing) //K
		{
			ip.hide();
		}
	},
	addEvent : function(obj, type, func)
	{
		try
		{
			obj.addEventListener(type, func, false);
		}
		catch(x)
		{
			obj.attachEvent("on" + type, function(){func({
				clientX : window.event.clientX,
				clientY : window.event.clientY,
				ie : true,
				pageX : document.body.scrollLeft + document.documentElement.scrollLeft + window.event.clientX,
				pageY : document.body.scrollTop + document.documentElement.scrollTop + window.event.clientY,
				target : window.event.srcElement,
				keyCode : window.event.keyCode,
				preventDefault : function(){window.event.returnValue = false},
				stopPropagation : function(){window.event.cancelBubble = true}
			})});
		}
	}
}
var ip = new imagePopup();
ip.addEvent(window, "load", ip.init);

function removeFrames()
{
	if(top && top != window)
	{
		var notice = document.createElement("p");
		notice.id = "NOTICE_FRAMES";
		notice.className = "notice-frames";
		var button = document.createElement("input");
		button.className = "remove-frames";
		button.type = "button";
		button.value = "フレームを解除する";
		button.onclick = function(){ top.location.href = location.href; };
		var close  = document.createElement("input");
		close.className = "hide-notice";
		close.title = "閉ぢる";
		close.type = "button";
		close.value = "×";
		close.onclick = function(){ document.body.removeChild(document.getElementById("NOTICE_FRAMES")); };
		notice.appendChild(document.createTextNode("他サイトのフレームに讀み込まれてゐます！"));
		notice.appendChild(button);
		notice.appendChild(close);
		document.body.appendChild(notice);
	}
}
ip.addEvent(window, "load", removeFrames);