/**
 *	@name			base.js
 *	@facility		COCON KARASUMA用 JavaScript
 *	@created date	2008/02/27
 *	@copyright (c) 2008 COCONOE inc.
 *
 *	[更新履歴]
 *	@v1.1		:	2008/05/02	:	func.jsに分けた(so)
 **/

function modAnchorTag()
{
	if (!document.getElementsByTagName) return false;
	if (!document.getElementById) return false;
	if (!document.getElementById("totop")) return false;

	var ernal = document.getElementsByTagName('a');
	
	for (var i = 0; i < ernal.length; i++)
	{
		if (ernal[i].className == 'ext')
		{
			ernal[i].onclick = function()
			{
				window.open(this.href);
				return false;
			}
		}
	}

	// internal anchor warp (floor/floormap.html)
	if (document.URL.match(/floor\/floormap\.html/))
	{
		for (var i = 0; i < ernal.length; i++)
		{
			if (ernal[i].href.match(/#([bf](\d))/))
			{
				ernal[i].onclick = function()
				{
					warp(this);
					return false;
				}
			}
		}
	}

	var ttp = document.getElementById('totop');
	var upto = ttp.getElementsByTagName('a');
	
	for (var j = 0; j < upto.length; j++)
	{
		upto[j].onclick = function()
		{
			toTop();
			return false;
		}
	}
}

addOnloadEvent(modAnchorTag);

