function getID()
{
	return "ID"+new Date().getTime();
}
var g_reg_objects	=	new Array();
function regObject(id,obj)
{
	g_reg_objects[id]	=	obj;
}
function getObject(id)
{
	return g_reg_objects[id];
}



function ftScrollElement()
{
	this.m_id					=	getID();
	this.m_obj_id			=	false;
	this.m_start_pos		=	-1;
	this.m_last_dest		=	-1;
	this.m_inter				=	-1;
	this.m_top_dest		=	0;
	this.m_pos					=	0;
	this.m_move_delay	=	5;
	this.m_last_time		=	new Date().getTime();
	
	this.update		=	ftScrollElement_update;
	this.init			=	ftScrollElement_init;
	
	regObject(this.cid,this);
}

function ftScrollElement_init()
{
	var obj			=	document.getElementById(this.m_obj_id);
	if(!obj)
		return false;
	this.m_pos	=	obj.offsetTop;
	
	setInterval("getObject(" + this.cid + ").update();",10);
	return true;
}

function ftScrollElement_update()
{
	var obj			=	document.getElementById(this.m_obj_id);
	var div_time	=	new Date().getTime() - this.m_last_time;
	this.m_last_time	=	new Date().getTime();
	if(!obj)
		return;

	scrollPos	=	window.pageYOffset;
	if(!scrollPos)
		scrollPos	=	document.body.scrollTop;

	if(scrollPos!=this.m_last_dest)
	{
		this.m_last_dest		=	scrollPos;
		this.m_inter				=	0;
		this.m_start_pos		=	this.m_pos;
	}
	
	if(this.m_inter<=1)
	{
		this.m_inter			+=	(div_time / 1000 * this.m_move_delay);
		if(this.m_inter>1)
			this.m_inter	=	1;
		this.m_pos				=	this.m_start_pos + (this.m_last_dest - this.m_start_pos) * Math.pow(this.m_inter,1.3)+this.m_top_dest;
		
		obj.style.top		=	this.m_pos + "px";
	}
}
