
	// グローバル変数（定数）を宣言 ※ここは設定不要です

		var SCROLL_BAR_NAME ;

		var SCROLL_BAR ;

		var SCROLL_BAR_BK ;

		var MAIN_CONTENTS ;

		var MAIN_CONTENTS_WAKU ;

		var SCROLL_BAR_IMAGE_NAME ;

		var SCROLL_BAR_IMAGE_ON ;

		var SCROLL_BAR_IMAGE_OFF ;

		var MOVE_SIZE ;

		var SCROLL_AVAIL_Y

		var LAYER_MIN_Y ;

		var LAYER_MAX_Y ;

		var OVER_FLOW_SIZE ;



	// 普通のグローバル変数を宣言しとく　※ ここも設定不要です

		var action = null ;

		var selectedLayer ;

		var offsetX, offsetY ;



	// レイヤーをドラッグする関数※ ここも設定不要です

	function enterselectedLayerer( x,y )
	{
		var l,t,w,h ;

		l = getLayerPosition( SCROLL_BAR_BK, 'left' ) + getLayerPosition( SCROLL_BAR, 'left' ) ;
		t = getLayerPosition( SCROLL_BAR_BK, 'top' ) + getLayerPosition( SCROLL_BAR, 'top' ) ;
		w = getLayerSize( SCROLL_BAR, 'width' ) ;
		h = getLayerSize( SCROLL_BAR, 'height' ) ;

		if( x > l && x < l+w &&
		    y > t && y < t+h )
		{
			offsetX = x - l ;
			offsetY = y - t ;
			return true ;
		}
		else
		{
			return false ;
		}
	}

	function grabLayer( evt )
	{
		if ( NN4 )
		{
			if ( enterselectedLayerer( evt.pageX,evt.pageY ) )
			{
				selectedLayer = true ;

				getDivImage( SCROLL_BAR, SCROLL_BAR_IMAGE_NAME ).src = SCROLL_BAR_IMAGE_ON ;
			}

			return false ;
		}

		if ( NN6 )
		{
			var tmp = evt.target.parentNode ;

			while ( tmp.id != SCROLL_BAR_NAME )
			{
				tmp =  tmp.parentNode ;


				if( tmp == null )
				{
					return true ;
				}
			}

			selectedLayer = true ;

			offsetX = evt.clientX - tmp.offsetLeft ;
			offsetY = evt.clientY - tmp.offsetTop ;

			getDivImage( SCROLL_BAR, SCROLL_BAR_IMAGE_NAME ).src = SCROLL_BAR_IMAGE_ON ;

			return false ;
		}

		if ( IE4 || IE5 )
		{
			var tmp = event.srcElement ;

			while ( tmp.id != SCROLL_BAR_NAME )
			{
				tmp = tmp.parentElement ;

				if( tmp == null )
				{

					return true ;
				}
			}

			selectedLayer = true ;

			offsetX = event.clientX - tmp.offsetLeft ;
			offsetY = event.clientY - tmp.offsetTop ;

			getDivImage( SCROLL_BAR, SCROLL_BAR_IMAGE_NAME ).src = SCROLL_BAR_IMAGE_ON ;

			return false ;
		}
	}

	function dragLayer( evt )
	{
		if ( selectedLayer )
		{
			var nextX, nextY ;

			if ( NN4 || NN6 )
			{
				nextX = 0 ; // evt.pageX - offsetX ;
				nextY = evt.pageY - offsetY - getLayerPosition( SCROLL_BAR_BK, 'top' ) 
				nextY -= ( NN6 ) ? getPageOffset( 'top' ) : 0 ;
			}

			if ( IE4 || IE5 )
			{
				nextX = 0 ; // getEventX( evt ) - offsetX ;
				nextY = getEventY( evt ) - offsetY - getPageOffset( 'top' ) ;
			}

			if ( LAYER_MIN_Y >= nextY )
			{
				nextY = LAYER_MIN_Y ;
			}

			if ( nextY >= LAYER_MAX_Y )
			{
				nextY = LAYER_MAX_Y ;
			}

			moveScrollBarTo( nextX, nextY ) ;

			return false ;
		}
	}

	function moveScrollBarTo( nextX, nextY )
	{
		// スクロールバー（ドラッグ部分）のＹ座標
		var nowY = getLayerPosition( SCROLL_BAR, 'top' ) ;

		// スクロール領域と、現在のＹ座標の比率を格納
		//（四捨五入できるように100を乗算しておく）
		var percent =  Math.round( nowY / SCROLL_AVAIL_Y * 100 ) / 100 ;

		// 最後に実際に動かす
		shiftLayerTo( MAIN_CONTENTS, null, OVER_FLOW_SIZE*percent ) ;
		shiftLayerTo( SCROLL_BAR, nextX, nextY ) ;
	}

	function releaseLayer( )
	{
		selectedLayer = null ;
		getDivImage( SCROLL_BAR, SCROLL_BAR_IMAGE_NAME ).src = SCROLL_BAR_IMAGE_OFF ;
	}


	// --------------------------------------------------------
	// 関数の初期化
	// ※ 設定箇所あり（２箇所）
	// --------------------------------------------------------
	function init( )
	{
		// ■設定個所 ---------------------------------------------

			// スクロールバーでドラッグする部分のレイヤー名
			SCROLL_BAR_NAME = 'scrollBar' ;

			// スクロールバーの背景となるレイヤー名
			SCROLL_BAR_BK   = refLayer( 'scrollBarBK' ) ;

			// 実際の情報を格納するレイヤー名
			MAIN_CONTENTS      = refLayer( 'contents' ) ;

			// 実際の情報をoverflowする部分のレイヤー名
			MAIN_CONTENTS_WAKU = refLayer( 'waku' ) ;

			// スクロールバーでドラッグする部分のイメージ名
			SCROLL_BAR_IMAGE_NAME = 'scrollImage' ;

			// スクロールバーでドラッグする部分のパス（ドラッグ時）
			SCROLL_BAR_IMAGE_ON  = 'img/nabi_bar_on.gif' ;

			// スクロールバーでドラッグする部分のパス（通常時）
			SCROLL_BAR_IMAGE_OFF = 'img/nabi_bar.gif' ;

		// ■設定個所 ここまで ------------------------------------


		SCROLL_BAR = refLayer( SCROLL_BAR_NAME ) ;

		// IE4,5 用にレイヤーを初期化
		initLayer( SCROLL_BAR ) ;
		initLayer( SCROLL_BAR_BK ) ;
		initLayer( MAIN_CONTENTS ) ;
		initLayer( MAIN_CONTENTS_WAKU ) ;


		// ■設定個所 ---------------------------------------------

			// NN6 用に位置を初期座標を指定する

			//コンテンツ掲載部分の背景、x:50px;, y:50px;
			shiftLayerTo( MAIN_CONTENTS_WAKU, 5, 429 ) ;

			//コンテンツ掲載部分、(背景の座標からみて）x:0px;, y:0px;
			shiftLayerTo( MAIN_CONTENTS, 0, 0 ) ;

			//スクロールバーの背景、x:350px;, y:50px;
			shiftLayerTo( SCROLL_BAR_BK, 227, 429 ) ;

			//スクロールバー、(背景の座標からみて）x:0px;, y:0px;
			shiftLayerTo( SCROLL_BAR, 0, 0 ) ;

		// ■設定個所 ここまで ------------------------------------


		// スクロールできる幅を格納
		SCROLL_AVAIL_Y = getLayerSize( SCROLL_BAR_BK, 'height' ) - getLayerSize( SCROLL_BAR, 'height' ) ;

		// スクロールバーの背景のＹ座標よりも上に行かないよう下限値を格納
		LAYER_MIN_Y = 0 ;

		// スクロールバーの背景のＹ座標＋高さよりも上に行かないよう上限値を格納
		LAYER_MAX_Y = getLayerSize( SCROLL_BAR_BK, 'height' ) - getLayerSize( SCROLL_BAR, 'height' ) ;

		// メインとなるコンテンツ部分と、
		// それを隠しているレイヤーとの差分を格納
		OVER_FLOW_SIZE = getLayerSize( MAIN_CONTENTS_WAKU, 'height' ) - getLayerSize( MAIN_CONTENTS, 'height' ) ;

		new Image( ).src = SCROLL_BAR_IMAGE_ON ;

		if( NN4 || NN6 )
		{
			setNSEventCapture( ) ;
		}

		SCROLL_BAR.onmousedown = grabLayer ;
		SCROLL_BAR.onmousemove = dragLayer ;
		SCROLL_BAR.onmouseup   = releaseLayer ;
		SCROLL_BAR.onmouseout  = releaseLayer ;

	}

	function setNSEventCapture( )
	{
		var obj = ( NN6 ) ? document : SCROLL_BAR ;
		obj.captureEvents( Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP ) ;
	}

	function resizeHandler( )
	{
		if ( NN4 )
		{
			location.reload( ) ;
			return false ;
		}
	}

	window.onload   = init ;
	window.onresize = resizeHandler ;

//



//	::::::::::::::: 簡易・ブラウザチェック :::::::::::::::

var usrAgent    = navigator.userAgent.toUpperCase( ) ;

var WIN	= ( usrAgent.indexOf("WIN") != -1 ) ? true : false ;
var MAC	= ( usrAgent.indexOf("MAC") != -1 ) ? true : false ;

var NN4	= ( document.layers ? true : false ) ;
var NN6	= ( document.getElementById && !document.all ? true : false ) ;
var IE4	= ( document.all && !document.getElementById ? true : false ) ;
var IE5	= ( document.all && document.getElementById ? true : false ) ;









//	::::::::: レイヤー内のイメージを参照する関数 :::::::::

function getDivImage( layerObj,imgName )
{
	if ( NN4 )
	{
		return layerObj.document.images[ imgName ] ;
	}
	else
	{
		return document.images[ imgName ] ;
	}
}





//	::::::::::::::: レイヤーを参照する関数 :::::::::::::::

function refLayer( layerName )
{
	if ( NN4 )
	{
		return getNetscape4LayerFormat( layerName ) ;
	}
	else if ( IE4 )
	{
		return document.all[ layerName ] ;
	}
	else
	{
		return document.getElementById( layerName ) ;
	}
}

function getNetscape4LayerFormat( target )
{
	var SEARCH_LEVEL = 2 ;
	var ERROR_MSG    = "レイヤーを" +SEARCH_LEVEL+ "階層まで検索した結果\n" +
	                   "【 " +target+ " 】は見つかりませんでした" ;

	var inc       = new Array( SEARCH_LEVEL ) ;
	var parentLay = new String( 'document.layers' ) ;
	var dynaFunc  = new String( '' ) ;
	var lyrFormat = null ;

	for( var i=0; i<inc.length; i++ )
	{
		if( i != 0 ) parentLay += "[ inc["+( i-1 )+"] ].document.layers" ;

		dynaFunc += "for( inc[" +i+ "] in " +parentLay+ " ) { if( inc[ " +i+ " ] != 'length' && lyrFormat == null ) { " +
			            "if( inc[ " +i+ "] == target ) { lyrFormat = " +parentLay+ "[inc[ " +i+ " ]] ; break ; } " ;
	}

	for( var i=0; i<inc.length; i++ ) dynaFunc += "}}" ;

	eval( dynaFunc ) ;

	if ( !lyrFormat )
	{
		alert( ERROR_MSG ) ;
		return ;
	}

	return lyrFormat ;
}





//	::::::::::::::: レイヤーを初期化する関数 :::::::::::::

function initLayer( layerObj )
{
	if ( NN6 )
	{
		layerObj.style.width = layerObj.offsetWidth ;
		layerObj.style.height = layerObj.offsetHeight ;
	}
	else if( IE4 || IE5 )
	{
		layerObj.style.pixelLeft   = layerObj.offsetLeft ;
		layerObj.style.pixelTop    = layerObj.offsetTop ;
		layerObj.style.pixelWidth  = layerObj.offsetWidth ;
		layerObj.style.pixelHeight = layerObj.offsetHeight ;
	}
}





//	::::::::::::::: レイヤーの階層を変える :::::::::::::::

function setZindex( layerObj, zOrder )
{
	if ( NN4 )
	{
		layerObj.zIndex = zOrder ;
	}
	else
	{
		layerObj.style.zIndex = zOrder ;
	}
}

//	:::::::::::::::: レイヤーの階層を取得 ::::::::::::::::

function getZindex( layerObj )
{
	if ( NN4 )
	{
		return layerObj.zIndex;
	}
	else
	{
		return layerObj.style.zIndex ;
	}
}





//	::::::::::::::: レイヤーの表示・非表示 :::::::::::::::

function getLayerVisibility( layerObj )
{
	if ( NN4 )
	{
		return ( layerObj.visibility == "show" ) ;
	}
	else
	{
		return ( layerObj.style.visibility == "visible" ) ;
	}
}

function hideLayer( layerObj )
{
	if ( NN4 )
	{
		layerObj.visibility = "hide" ;
	}
	else
	{
		layerObj.style.visibility = "hidden" ;
	}
}

function showLayer( layerObj )
{
	if ( NN4 )
	{
		layerObj.visibility = "show" ;
	}
	else
	{
		layerObj.style.visibility = "visible" ;
	}
}





//	:::::::::::::::::: レイヤーを動かす ::::::::::::::::::

function shiftLayerTo( layerObj, x, y )
{
	if ( NN4 )
	{
		layerObj.moveTo( x, y ) ;
	}
	else if ( NN6 )
	{
		layerObj.style.left = x ;
		layerObj.style.top  = y ;
	}
	else
	{
		layerObj.style.pixelLeft = x ;
		layerObj.style.pixelTop  = y ;
	}
}

function shiftLayerBy( layerObj, x, y )
{
	if ( NN4 )
	{
		layerObj.moveBy( x, y ) ;
	}
	else if ( NN6 )
	{
		layerObj.style.left = getLayerPosition( layerObj, 'left' ) + x ;
		layerObj.style.top  = getLayerPosition( layerObj, 'top' ) + y ;
	}
	else if ( IE4 || (MAC && IE5) )
	{
		layerObj.style.pixelLeft += x ;
		layerObj.style.pixelTop  += y ;
	}
	else
	{
		layerObj.style.pixelLeft = layerObj.offsetLeft + x ;
		layerObj.style.pixelTop  = layerObj.offsetTop  + y ;
	}
}





//	::::::::::::::: レイヤーの大きさを変更 :::::::::::::::

function resizeLayerTo( layerObj, width, height )
{
	if ( NN4 )
	{
		layerObj.resizeTo( width, height ) ;
	}
	else if ( NN6 )
	{
		layerObj.style.width = width ;
		layerObj.style.height = height ;
	}
	else
	{
		layerObj.style.pixelWidth  = width ;
		layerObj.style.pixelHeight = height ;
	}
}





//	::::::::::::::::: レイヤーの値を取得 :::::::::::::::::

function getLayerSize( layerObj, value )
{
	if( value == "width" )
	{
		if ( NN4 )
		{
			return layerObj.document.width ;
		}
		else if ( NN6 )
		{
			return parseInt( layerObj.style.width ) ;
		}
		else if ( IE4 )
		{
			return layerObj.style.pixelWidth ;
		}
		else
		{
			return layerObj.offsetWidth ;
		}
	}
	if( value == "height" )
	{
		if ( NN4 )
		{
			return layerObj.document.height ;
		}
		else if ( NN6 )
		{
			return parseInt( layerObj.style.height ) ;
		}
		else if ( IE4 )
		{
			return layerObj.style.pixelHeight ;
		}
		else
		{
			return layerObj.offsetHeight ;
		}
	}
}





//	::::::::::::::: クリッピングの値を取得 :::::::::::::::

function getClipValue( layerObj, value )
{
	if( IE4 || IE5 || NN6 )
	{
		var cp = layerObj.style.clip.split(" ") ;
		cp[0] = cp[0].slice(5) ;

		switch ( value )
		{
			case "top" :
				return parseInt( cp[0] ) ;
			case "right" :
				return parseInt( cp[1] ) ;
			case "bottom" :
				return parseInt( cp[2] ) ;
			case "left" :
				return parseInt( cp[3] ) ;
		}
	}
	else
	{
		switch ( value )
		{
			case "top" :
				return ( layerObj.clip.top ) ;
			case "right" :
				return ( layerObj.clip.right ) ;
			case "bottom" :
				return ( layerObj.clip.bottom ) ;
			case "left" :
				return ( layerObj.clip.left ) ;
		}
	}
}





//	:::::::::::::::::::: クリッピング ::::::::::::::::::::

function clipLayerTo( layerObj, t, r, b, l )
{
	if ( NN4 )
	{
		layerObj.clip.top    = t ;
		layerObj.clip.right  = r ;
		layerObj.clip.bottom = b ;
		layerObj.clip.left   = l ;
	}
	else
	{
		layerObj.style.clip = "rect("+t+" "+r+" "+b+" "+l+")" ;
	}
}

function clipLayerBy( layerObj, t, r, b, l )
{
	var nextClipValue_top    = getClipValue( layerObj,'top'   ) + t ;
	var nextClipValue_right  = getClipValue( layerObj,'right' ) + r ;
	var nextClipValue_bottom = getClipValue( layerObj,'bottom') + b ;
	var nextClipValue_left   = getClipValue( layerObj,'left'  ) + l ;

	if ( NN4 )
	{
		layerObj.clip.top    = nextClipValue_top ;
		layerObj.clip.right  = nextClipValue_right ;
		layerObj.clip.bottom = nextClipValue_bottom ;
		layerObj.clip.left   = nextClipValue_left ;
	}
	else
	{
		layerObj.style.clip = "rect("+ nextClipValue_top    + "px "
										+ nextClipValue_right  + "px "
										+ nextClipValue_bottom + "px "
										+ nextClipValue_left   + "px)" ;
	}
}





function wipeLayerBy( layerObj, endPoint, direction, wipeType, step )
{
	var speed = 1 ;
	var t = r = b = l = 0 ;

	step += 1 ;

	if ( wipeType == "wipeIn" )
	{
		if ( direction == "fromLeft" )
		{
			if ( ( getClipValue(layerObj,'right') + step ) < endPoint )
			{
				r = step ;
			}
			else if ( getClipValue(layerObj,'right') < endPoint )
			{
				r = endPoint - getClipValue(layerObj,'right') ;
			}
		}
		if ( direction == "fromRight" )
		{
			if ( ( getClipValue(layerObj,'left') - step ) > endPoint )
			{
				l = -step ;
			}
			else if ( getClipValue(layerObj,'left') > endPoint )
			{
				l = endPoint - getClipValue(layerObj,'left') ;
			}
		}
		if ( direction == "fromTop" )
		{
			if ( ( getClipValue(layerObj,'bottom') + step ) < endPoint )
			{
				b = step ;
			}
			else if ( getClipValue(layerObj,'bottom') < endPoint )
			{
				b = endPoint - getClipValue(layerObj,'bottom') ;
			}
		}
		if ( direction == "fromBottom" )
		{
			if ( ( getClipValue(layerObj,'top') - step ) > endPoint )
			{
				t = -step ;
			}
			else if ( getClipValue(layerObj,'top') > endPoint )
			{
				t = endPoint - getClipValue(layerObj,'top') ;
			}
		}
		if ( direction == "fromCenterX" )
		{
			if ( ( getClipValue(layerObj,'left') - step ) > endPoint )
			{
				r = step ;
				l = -step ;
			}
			else if ( getClipValue(layerObj,'left') > endPoint )
			{
				r = ( endPoint - getClipValue(layerObj,'left') ) * -1 ;
				l = endPoint - getClipValue(layerObj,'left') ;
			}
		}
		if ( direction == "fromCenterY" )
		{
			if ( ( getClipValue(layerObj,'top') - step ) > endPoint )
			{
				t = -step ;
				b = step ;
			}
			else if ( getClipValue(layerObj,'top') > endPoint )
			{
				t = endPoint - getClipValue(layerObj,'top') ;
				b = ( endPoint - getClipValue(layerObj,'top') ) * -1 ;
			}
		}
	}

	if ( wipeType == "wipeOut" )
	{
		if ( direction == "fromLeft" )
		{
			if ( ( getClipValue(layerObj,'left') + step ) < endPoint )
			{
				l = step ;
			}
			else if ( getClipValue(layerObj,'left') < endPoint )
			{
				l = endPoint - getClipValue(layerObj,'left') ;
			}
		}
		if ( direction == "fromRight" )
		{
			if ( ( getClipValue(layerObj,'right') - step ) > endPoint )
			{
				r = -step ;
			}
			else if ( getClipValue(layerObj,'right') > endPoint )
			{
				r = endPoint - getClipValue(layerObj,'right') ;
			}
		}
		if ( direction == "fromTop" )
		{
			if ( ( getClipValue(layerObj,'top') + step ) < endPoint )
			{
				t = step ;
			}
			else if ( getClipValue(layerObj,'top') < endPoint )
			{
				t = endPoint - getClipValue(layerObj,'top') ;
			}
		}
		if ( direction == "fromBottom" )
		{
			if ( ( getClipValue(layerObj,'bottom') - step ) > endPoint )
			{
				b = -step ;
			}
			else if ( getClipValue(layerObj,'bottom') > endPoint )
			{
				b = endPoint - getClipValue(layerObj,'bottom') ;
			}
		}
		if ( direction == "fromCenterX" )
		{
			if ( ( getClipValue(layerObj,'right') - step ) > endPoint )
			{
				r = -step ;
				l = step ;
			}
			else if ( getClipValue(layerObj,'right') > endPoint )
			{
				r = endPoint - getClipValue(layerObj,'right') ;
				l = ( endPoint - getClipValue(layerObj,'right') ) * -1 ;
			}
		}
		if ( direction == "fromCenterY" )
		{
			if ( ( getClipValue(layerObj,'bottom') - step ) > endPoint )
			{
				t = step ;
				b = -step ;
			}
			else if ( getClipValue(layerObj,'bottom') > endPoint )
			{
				t = ( endPoint - getClipValue(layerObj,'bottom') ) * -1 ;
				b = endPoint - getClipValue(layerObj,'bottom') ;
			}
		}
	}

	clipLayerBy( layerObj, t, r, b, l ) ;

	if ( ( t || r || b || l ) == 0 )
	{
		clearTimeout( ClipAction ) ;
		return false ;
	}
	else
	{
		ClipAction = setTimeout( "wipeLayerBy('"+layerObj+"',"+endPoint+",'"+direction+"','"+wipeType+"',"+step+")", speed) ;
	}
}





//	::::::::::::::::: レイヤーの座標を取得 :::::::::::::::::

function getLayerPosition( layerObj, value )
{
	if( value == "top" )
	{
		if ( NN4 )
		{
			return layerObj.top ;
		}
		else if ( NN6 )
		{
			return parseInt( layerObj.style.top ) ;
		}
		else if ( IE4 )
		{
			return layerObj.style.pixelTop ;
		}
		else
		{
			return layerObj.offsetTop ;
		}
	}
	if( value == "right" )
	{
		if ( NN4 )
		{
			return layerObj.left + getLayerSize( layerObj, "width" ) ;
		}
		else if ( NN6 )
		{
			return parseInt( layerObj.style.left + getLayerSize( layerObj, "width" )  ) ;
		}
		else if ( IE4 )
		{
			return layerObj.style.pixelLeft + getLayerSize( layerObj, "width" ) ;
		}
		else
		{
			return layerObj.offsetLeft + getLayerSize( layerObj, "width" ) ;
		}
	}
	if( value == "bottom" )
	{
		if ( NN4 )
		{
			return layerObj.top + getLayerSize( layerObj, "height" ) ;
		}
		else if ( NN6 )
		{
			return parseInt( layerObj.style.top + getLayerSize( layerObj, "height" ) ) ;
		}
		else if ( IE4 )
		{
			return layerObj.style.pixelTop + getLayerSize( layerObj, "height" ) ;
		}
		else
		{
			return layerObj.offsetTop + getLayerSize( layerObj, "height" ) ;
		}
	}
	if( value == "left" )
	{
		if ( NN4 )
		{
			return layerObj.left ;
		}
		else if ( NN6 )
		{
			return parseInt( layerObj.style.left ) ;
		}
		else if ( IE4 )
		{
			return layerObj.style.pixelLeft ;
		}
		else
		{
			return layerObj.offsetLeft ;
		}
	}
}





//	:::::::::::::: イベント発生座標を取得 ::::::::::::::

function getEventX( evt )
{
	if ( NN4 )
	{
		return evt.x ;
	}
	else if ( NN6 )
	{
		return ( window.scrollX + evt.clientX ) ;
	}
	else if ( IE4 || IE5 )
	{
		return ( document.body.scrollLeft + event.clientX ) ;
	}
}

function getEventY( evt )
{
	if ( NN4 )
	{
		return evt.y ;
	}
	else if ( NN6 )
	{
		return ( window.scrollY + evt.clientY ) ;
	}
	else if ( IE4 || IE5 )
	{
		return ( document.body.scrollTop + event.clientY ) ;
	}
}





//	::::::::::::: レイヤーの中央座標を取得 :::::::::::::

function getCenterSize( layerObj, which )
{
	return ( getWinSize( which ) - getLayerSize( layerObj, which ) ) / 2 ;
}





//	:::::::::::::: レイヤーの内容を書き換える関数 ::::::::::::::

function replaceContent( layerObj, txt )
{
	if ( NN4 )
	{
		layerObj.document.open( "text/html" ) ;
		layerObj.document.write( txt ) ;
		layerObj.document.close( ) ;
	}
	else
	{
		layerObj.innerHTML = txt ;
	}
}





//	:::::::::::::: ページのオフセットを取得 ::::::::::::::

function getPageOffset( which )
{
	if ( which == "left" )
	{
		if ( NN4 )
		{
			return self.pageXOffset ;
		}
		else if ( NN6 )
		{
			return window.scrollX ;
		}
		else
		{
			return document.body.scrollLeft ;
		}
	}
	if ( which == "top" )
	{
		if ( NN4 )
		{
			return self.pageYOffset ;
		}
		else if ( NN6 )
		{
			return window.scrollY ;
		}
		else
		{
			return document.body.scrollTop ;
		}
	}
}





//	:::::::::::::::: windowの大きさを取得 ::::::::::::::::

function getWinSize( which )
{
	if ( which == "width" )
	{
		if ( NN4 || NN6 )
		{
			return window.innerWidth ;
		}
		else
		{
			return document.body.clientWidth ;
		}
	}
	if ( which == "height" )
	{
		if ( NN4 || NN6 )
		{
			return window.innerHeight ;
		}
		else
		{
			return document.body.clientHeight ;
		}
	}
}





//	:::::::::::::::::: 画面のスクロール ::::::::::::::::::

function doPageScroll( st_X,max_X,st_Y,max_Y )
{
	var diffX,diffY,stepX,stepY,moveX,moveY ;

	diffX = .1 * ( max_X - st_X ) ;
	if( diffX > 0 )
		stepX = Math.ceil( diffX ) ;
	else
		stepX = Math.floor( diffX ) ;

	diffY = .1 * ( max_Y - st_Y ) ;
	if( diffY > 0 )
		stepY = Math.ceil( diffY ) ;
	else
		stepY = Math.floor( diffY ) ;

	moveX = st_X + stepX ;
	moveY = st_Y + stepY ;
	
// window.status = "X is : " +moveX+ " Y is : " +moveY ;

	if ( stepX > 0 && moveX <= max_X || stepY > 0 && moveY <= max_Y ||
		 stepX < 0 && moveX >= max_X || stepY < 0 && moveY >= max_Y )
	{
		scroll( moveX,moveY )

		st_X += stepX ;
		st_Y += stepY ;

		setTimeout( "doPageScroll( " +st_X+ "," +max_X+ "," +st_Y+ "," +max_Y+ " )",1 ) ;
	}
	else return true ;
}

function pageScrollTo( max_X,max_Y )
{
	var st_X,st_Y ;

	st_X = getPageOffset( "left" ) ;
	st_Y = getPageOffset( "top" ) ;

	doPageScroll( st_X,max_X,st_Y,max_Y ) ;
}

