
/*
ÀÎÀÚ¼³¸í
function('Å¬·¡½º¸í ¾Æ¹«°Å³ª »ó°ü¾øÀ½' , '·¹ÀÌ¾î ¾ÆÀÌµð' , 'ÃÖ»ó´Ü¿¡¼­ Äü¸Þ´ºÀÇ ³ôÀÌ °ª');
¡Ø topmargin °ªÀ» ±¸ÇÏ´Â ÀÌÀ¯´Â Ã¢À» ÀÛ°ÔÇÏ°Å³ª, ÇØ»óµµ°¡ ÀÛÀº ¸ð´ÏÅÍ¿¡¼­ º¼¶§ ¹«ÇÑ½ºÅ©·ÑÀ» ¹æÁöÇÏ±âÀ§ÇÔ
*/
ScroolTop = function(className,id,topMargin) {
	this.IE = document.all ? 1 : 0;
	this.NN = document.layer ? 1 : 0;
	this.N6 = document.getElementById ? 1 : 0;
	if(this.IE) this.layer = document.all(id);
	else if(this.NN) this.layer = document.layer[id];
	else if(this.N6) this.layer = document.getElementById(id);
	else return;
	this.className = className;
	this.top = this.oldY = parseInt(this.layer.style.top,10);
	this.topMargin = topMargin;
	setInterval(this.className + ".move()", 10);
}

ScroolTop.prototype.move = function() {
	var limitHeight = document.documentElement.scrollHeight - this.topMargin;	// ¹«ÇÑ½ºÅ©·Ñ¹æÁöÇÏ±âÀ§ÇØ limit ¸¦ µÒ(ÀüÃ¼ ³ôÀÌ - (»ó´Ü¿©¹é + Äü¸Þ´º³ôÀÌ))

	//var diffY = (this.IE) ? document.body.scrollTop+this.top : self.pageYOffset+this.top; // Ç¥ÁØ¿¡´Â document.documentElement.scrollTop
    var diffY = (this.IE) ? document.documentElement.scrollTop+this.top : self.pageYOffset+this.top;
	if(diffY != this.oldY && diffY < limitHeight) {
        var percentY = .1 * (diffY - this.oldY);
        percentY = (percentY > 0) ? Math.ceil(percentY) : Math.floor(percentY);

        this.oldY += percentY;
        this.layer.style.top = this.oldY + "px";
    }
}