
function SmoothScroll( targetID, evDone, bSoon )
{
  if( !document.getElementById ) { return true; }
  
	var step=4;  		// 初速度
	var max=20;  		// 最高速度
	var accel=1;  		// 加速度
	var interval=30;  	// インターバル
  
	var current_y = document.body.scrollTop  || document.documentElement.scrollTop;
	var element=document.getElementById(targetID);
	if (!element){return true;}

	var target_y = 0;
	for (i = element;i.offsetParent;i=i.offsetParent ){
		target_y += i.offsetTop;
	}
 
 	var count=0;
	if ( current_y > target_y ){
		step = -step;
		accel = -accel;
	}
	
	if ( bSoon ) {
		window.scrollTo((document.body.scrollTop  || document.documentElement.scrollTop),target_y);		
		return false;
	}
	
	var timerid = setInterval( function(){
			if ( step < max ) step += count * accel;
			if ( Math.abs( current_y - target_y ) < Math.abs( step ) ) {
				window.scrollTo((document.body.scrollTop  || document.documentElement.scrollTop),target_y);
				clearInterval(timerid);
				if ( evDone ) location = evDone;
				return false;
			}else{
				window.scrollBy(0,step);
				current_y += step;
				count++;
			}
		}
		,interval
	);
	
	return false;
}

function _start()
{
	SmoothScroll( location.search.substring( 1 ), null, true );
}

function _jump( target, link )
{
	SmoothScroll( target, link, false );
}
