//---------------------------------------------------------------------------------------
//	Class Description
//---------------------------------------------------------------------------------------
//	FileName	: DHScrollPanel.js
//	Maker		: Daeho Yu
//	Created		: 01/04/2004
//	Summary		: Scroll Div
//
//	Modified	:
//---------------------------------------------------------------------------------------

<!-- 

var DH_SP_Timer;

// DHScrollPanel class
function DHScrollPanel(objInstance, strInstanceName, nLeft, nTop, nBrowserTop, nScrollBase, nActivateSpeed, nScrollSpeed)
{
	this.Instance		= objInstance;
	this.InstanceName	= strInstanceName;
	this.Left			= nLeft || 10;	// ¿ÞÂÊ ¿©¹é (¸Þ´º°¡ ¿ÞÂÊ¿¡¼­ 10ÇÈ¼¿) 
	this.Top			= nTop || 10;	// À§ÂÊ ¿©¹é (¸Þ´º°¡ À§¿¡¼­ 10ÇÈ¼¿)
	this.BrowserTop		= nBrowserTop || 10;	// ½ºÅ©·Ñ½Ã ºê¶ó¿ìÀú À§ÂÊ°ú ¶³¾îÁö´Â °Å¸®
	this.ScrollBase		= nScrollBase || 10;	// ½ºÅ©·Ñ ½ÃÀÛÀ§Ä¡
	this.ActivateSpeed	= nActivateSpeed || 1;
	this.ScrollSpeed	= nScrollSpeed || 1;
	
	this.Toggle			= true;
	this.ToggleInstance	= null;
}

DHScrollPanel.prototype.Create = function()
{
	this.Instance.style.left = this.Left;

	if (this.Toggle) {
		if (this.ToggleInstance != null)
			this.ToggleInstance.checked = false;
		this.Instance.style.top = document.body.scrollTop + this.ScrollBase;
		DH_SP_RefreshPanel(this.InstanceName, this.Top, this.BrowserTop, this.ActiveSpeed, this.ScrollSpeed);
	}
	else {
		if (this.ToggleInstance != null)
			this.ToggleInstance.checked = true;
		this.Instance.style.top = document.body.scrollTop + this.Top;
	}
}

DHScrollPanel.prototype.Refresh = function()
{
	this.Instance.style.left = this.Left;
}

function DH_SP_RefreshPanel(strID, nTop, nBrowserTop, nActiveSpeed, nScrollSpeed) 
{ 
	var nStartPoint, nEndPoint, nRefreshTimer; 

	nStartPoint = parseInt(eval(strID + ".style.top"), 10);
	nEndPoint = document.body.scrollTop + nBrowserTop;

	if (nEndPoint < nTop) nEndPoint = nTop; 
	
	nRefreshTimer = nActiveSpeed; 
	
	if (nStartPoint != nEndPoint) {
		nScrollAmount = Math.ceil(Math.abs(nEndPoint - nStartPoint) / 15); 
		eval(strID + ".style.top = parseInt(" + strID + ".style.top, 10) + ((nEndPoint < nStartPoint ) ? -nScrollAmount : nScrollAmount);");
		nRefreshTimer = nScrollSpeed; 
	} 

	DH_SP_Timer = setTimeout("DH_SP_RefreshPanel('" + strID + "', " + nTop + ", " + nBrowserTop + ", " + nActiveSpeed + ", " + nScrollSpeed + ");", nRefreshTimer);
} 

DHScrollPanel.prototype.ToggleN = function()
{
	if (this.Toggle) {
		this.Toggle = false;
		if (this.ToggleInstance != null)
			this.Toggle.checked = true;
		clearTimeout(DH_SP_Timer); 
		this.Instance.style.top = this.Top; 
	}
	else {
		this.Toggle = true;
		if (this.ToggleInstance != null)
			this.Toggle.checked = false;
		DH_SP_RefreshPanel(this.InstanceName, this.Top, this.BrowserTop, this.ActiveSpeed, this.ScrollSpeed);
	}
}



//--> 