/**************************************************************
1. ½ºÅ©·Ñ
2. ÀÛ¼ºÀÚ : 2007.11.15 Append by KMS
3. »ç¿ë¹ý
LeftPhotoScroll=new ktpageScroll();	
//ÇÔ¼ö ¼±¾ð
LeftPhotoScroll.name="LeftPhotoScroll";		
//ÀÌ¸§ ¼±¾ð
LeftPhotoScroll.AddLayer('Bin_Scroll','photoscroll');
//»ç¿ëÇÒ ·¹ÀÌ¾î ÀÔ·Â('ÃÊ±âÀ§Ä¡ ·¹ÀÌ¾î','½ºÅ©·ÑµÉ ·¹ÀÌ¾î')
LeftPhotoScroll.InitScrollPhoto(_hkADHT,_hkBTTM);
//½ºÅ©·Ñ ½ÃÀÛ('½ºÅ©·Ñ ·¹ÀÌ¾î ³ôÀÌ','ÇÏ´Ü °æ°è¿µ¿ª');
**************************************************************/
function ktpageScroll()
{
	//¿ÞÂÊ µû¶ó´Ù´Ï´Â ¸Þ´º
	this._hkGAP 	=10;        // À§ÂÊ ¿©¹é
	this._hkINIT 	=0;   		// ½ÃÀÛÀ§Ä¡(¸Þ´º³ôÀÌ + ÃÖ»ó´Ü¿¡¼­ ¸Þ´º±îÁö°Å¸®)
	this._hkBTTM 	=0;			// ÇÏ´Ü °æ°è ³ôÀÌ
	this._hkADHT	=0;			// ½ºÅ©·Ñ ·¹ÀÌ¾î ³ôÀÌ
	this._hkMaxSCHT	=0;			// ÀüÃ¼ ½ºÅ©·Ñ ¿µ¿ª

	this._hkRefreshVal = 120;	// ½ºÅ©·Ñ Å¸ÀÓ
	this._hkScrollSpeed = 2;	// ½ºÅ©·Ñ ½ºÇÇµå
	this._hkTimer;

	this._FLayer;
	this._SLayer;
	this.name="ktpageScroll";
	
	this.AddLayer = function(FLayer,SLayer){
		this._FLayer = document.getElementById(FLayer);
		this._SLayer = document.getElementById(SLayer);
	};
	
	this.RefreshScrollPhoto = function() {
		var _hkStartPoint, _hkEndPoint, _hkRefreshTime,_hkScrollAmount;

		_hkStartPoint = parseInt(this._SLayer.style.top, 10);
		_hkEndPoint = document.body.scrollTop + this._hkGAP;

		if(_hkEndPoint < this._hkINIT) _hkEndPoint = this._hkINIT;
		if(_hkEndPoint > (this._hkMaxSCHT-this._hkADHT-this._hkBTTM)) _hkEndPoint = this._hkMaxSCHT-this._hkADHT-this._hkBTTM;

		_hkRefreshTime = this._hkRefreshVal;
		if(_hkStartPoint != _hkEndPoint && _hkEndPoint <= (this._hkMaxSCHT - this._hkADHT - this._hkBTTM) && _hkEndPoint >= this._hkINIT) {
			this._hkScrollAmount = Math.ceil(Math.abs(_hkEndPoint - _hkStartPoint) / 15);
			this._SLayer.style.top = _hkStartPoint + ((_hkEndPoint<_hkStartPoint) ? -this._hkScrollAmount : this._hkScrollAmount);
			_hkRefreshTime = this._hkScrollSpeed;
		}
		this._hkTimer = setTimeout(this.name+".RefreshScrollPhoto()",_hkRefreshTime);
	};
	
	this.InitScrollPhoto = function(_hkADHT,_hkBTTM){
		this._hkADHT=_hkADHT;
		this._hkBTTM=_hkBTTM;
		this._hkINIT=this._FLayer.offsetTop+this._hkGAP;
		this._SLayer.style.top = this._hkINIT+"px";
		this._hkMaxSCHT=document.body.scrollHeight;
		this.RefreshScrollPhoto();
	};
}
