var ie = document.all;
var dom = document.getElementById;
var ns4 = document.layers;
var unit = document.layers ? "" : "px";
var direction = "up";
var stop_top = 5;	/* ホバーウィンドウの上側停止位置*/
var bouncelimit = 32;
var calunits = document.layers ? "" : "px";

function init()
{
	if (!dom && !ie && !ns4)
	{
		return;
	}
	crossobj = (dom) ? document.getElementById("hover").style : ie ? document.all.dropin : document.dropin;
	scroll_top = (ie) ? truebody().scrollTop : window.pageYOffset
	crossobj.top = scroll_top - 400 + unit;
	crossobj.visibility = (dom || ie) ? "visible" : "show";
	dropstart = setInterval("dropin()", 50)
}

function dropin()
{
	scroll_top = (ie) ? truebody().scrollTop : window.pageYOffset;
	if (parseInt(crossobj.top) < stop_top + scroll_top)
	{
		crossobj.top = parseInt(crossobj.top) + 40 + unit;
	}
	else
	{
		clearInterval(dropstart);
		bouncestart = setInterval("bouncein()", 50);
	}
}

function bouncein()
{
	crossobj.top = parseInt(crossobj.top) - bouncelimit + calunits
	if (bouncelimit < 0)
	{
		bouncelimit += 8;
	}
	bouncelimit = bouncelimit * -1;
	if (bouncelimit == 0)
	{
		clearInterval(bouncestart);
	}
}

function closehover()
{
	if (window.bouncestart)
	{
		clearInterval(bouncestart);
	}
	crossobj.visibility="hidden"
	//ワンタイムを使用する時
	/* event.returnValue = false; */
}

function truebody()
{
	return (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body;
}

window.onload=setTimeout('init()',1000);
