document.write('<div id="junpTop"><a href="javascript:gotop();" onMouseover="window.status=\'top\';return true;" onMouseout="window.status=\'\';return true;"><img src="/images/common/gotop.gif" alt="ページTOPへ" width="13" height="13" /></a></div>');
//document.write('<div><input type="text" id="test"></div>');

var distanceY = 0;
var scroll_y = 0;

var TOP_HEIGHT =90;
var SCROLL_SPEED = 10;

setInterval("usagiNavi()",30);


function usagiNavi(){
	if(document.all){
		nowY = document.all('junpTop').style.top.replace(/px/, "");
		scroll_y = document.body.scrollTop || document.documentElement.scrollTop;
		if(!document.documentElement.clientHeight){
			windowHeight = document.body.clientHeight;
		}else{
			windowHeight = document.documentElement.clientHeight;
		}
		distanceY += ((scroll_y + windowHeight-TOP_HEIGHT) - nowY) / SCROLL_SPEED;
		document.all('junpTop').style.top = distanceY + "px";

//alert(scroll_y + "-" +document.body.clientHeight +"-"+TOP_HEIGHT+'-'+ nowY);

		if(scroll_y > 1){
			document.all('junpTop').style.display = "block";
		}else{
			document.all('junpTop').style.display = "none";
		}

	}
	else if(document.getElementById){
		nowY = document.getElementById('junpTop').style.top.replace(/px/, "") ;
		distanceY += ((window.pageYOffset + innerHeight-TOP_HEIGHT ) - nowY) / SCROLL_SPEED;
		document.getElementById('junpTop').style.top = distanceY + "px";

		if(window.pageYOffset > 1){
			document.getElementById('junpTop').style.display = "block";
		}else{
			document.getElementById('junpTop').style.display = "none";
		}

	}
}

