<!--
/******************************************************
 *	@name			basement.js
 *	@type			get
 *	@facility		汎用的Javascript
 *	@created date	2007/02/27 (revised 2008/02/27)
 *	@author			so
 *	@version		1.0
 *	@copyright (c) 2007 COCONOE INC.
 ******************************************************/

var scrollTimer;
obj = document.all ? (document.getElementById ? 3 : 2) : (document.getElementById ? 4 : (document.layers ? 1 : 0));

function prevButton()
{
	if(document.referrer.indexOf(document.domain) != -1)
	{
		var prevUrl = document.referrer;
		document.write('<p id="prev"><a href="' + prevUrl + '">前のページへ</a></p>');
	}
	else
	{
		document.write('<p id="noprev">前のページは存在しません</p>');
	}
}

function toA(idn)
{
	if(!idn) idn = "top";

	if(obj == 1 || obj == 2 || obj == 3 || obj == 4)
	{
		frameScroll(0);
	}
	else
	{
		location.hash = idn;
	}
	return false;
}

function frameScroll(toY)
{
	if(scrollTimer) clearTimeout(scrollTimer);
	if(!toY || toY < 0) toY = 0;
	nowY = 0 + getOffsetY();


	nowX = 0 + getOffsetX();
	nowY += (toY - nowY) * 0.2;
	if(Math.abs(toY - nowY) <= 0.5)
	{
		nowY = toY;
	}

	window.scroll(nowX, nowY);

	if(Math.abs(nowY - toY) < 0.5)
	{
		clearTimeout(scrollTimer);
	}
	else
	{
		scrollTimer = setTimeout("frameScroll("+toY+")", 30);
	}
}

function getOffsetX()
{
	if(obj == 2 || obj == 3) return document.documentElement.scrollLeft || document.body.scrollLeft;
	else if(obj == 1 || obj == 4) return window.pageXOffset;
}

function getOffsetY()
{
	if(obj == 2 || obj == 3) return document.documentElement.scrollTop || document.body.scrollTop;
	else if(obj == 1 || obj == 4) return window.pageYOffset;
}

window.onload = function()
{
	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;
			}
		}
		else if (ernal[i].className == 'ext uno')
		{
			ernal[i].onclick = function()
			{
				var pIndex = this.href.indexOf('://')+3;
				var drIndex = this.href.indexOf('/', pIndex);
				var domain = this.href.substr(pIndex, drIndex-pIndex);
				domain = domain.replace(/\.|-/g, '');
				
				window.open(this.href, domain);
				return false;
			}
		}
	}

	var ttp = document.getElementById('totop');
	var upto = ttp.getElementsByTagName('a');
	
	for (var j = 0; j < upto.length; j++)
	{
		upto[j].onclick = function()
		{
			toA();
			return false;
		}
	}
}

//FOROLDBROWSERS-->