/* debug *
document.write( "<div id='debug' style='position:absolute; top:450; left:0; width:100; height:180; background-color:#333333; color:#ffffff;'></div>" );
var index = 0;

function debugMsg( str )
{
	debug.innerHTML += str;
	index++;
	if( index % 15 == 0 ) { debug.innerHTML = ""; index = 0;}
}
/* debug */

// scraper
var TOP_LIMIT = 300;

var oRemote = null;
var oFooter  = null;
var lastScrollY = 0;
var numRemoteBottom = 0;
var action = window.setInterval("heartBeat()",1);

function heartBeat() {
	oRemote = document.getElementById( 'Remote' );
	oFooter  = document.getElementById( 'Footer' );

	if ( oRemote != null && oFooter != null )
	{
		if (typeof(document.body) == "object")
		{
			if (document.body != null)
			{
				// ½ºÅ©·Ñ µÇ´Â Á¤µµ¸¦ ÀúÀå
				diffY = document.body.scrollTop;

				if (diffY != lastScrollY)
				{
					// ºÎµå·´°Ô ¿òÁ÷ÀÌ´Â ·ÎÁ÷
					percent = 0.08 * (diffY - lastScrollY);
					if (percent > 0) {
						percent = Math.ceil(percent);
					} else {
						percent = Math.floor(percent);
					}
					
					// Remote °¡ ÁöÁ¤ÇÑ À§Ä¡ º¸´Ù ¾Æ·¡·Î ³»·Á°¡Áö ¸øÇÏ°Ô ¼³Á¤
					remoteBottom = oRemote.style.pixelTop + parseInt( oRemote.style.height );
					prevRemoteBottom = ( remoteBottom + percent );

					if ( oFooter.offsetTop >= prevRemoteBottom )
					{						
						lastScrollY += percent;
					}
					else
					{
						percent = oFooter.offsetTop - remoteBottom;
						lastScrollY = diffY;
					}

					// Remote°¡ ÁöÁ¤ÇÑ À§Ä¡ º¸´Ù À§·Î ¿Ã¶ó°¡Áö ¸øÇÏ°Ô ¼³Á¤					
					if ( oRemote.style.pixelTop + percent < TOP_LIMIT )
					{
						percent = 0;
						lastScrollY = diffY;
						oRemote.style.pixelTop = TOP_LIMIT;
					}

					oRemote.style.pixelTop += percent;
				}

			} // end if (document.body != null)
		} // end if (typeof(document.body) == "object")
	} // end if ( oRemote != null )
} // end function
