Mys.Scroller = function(el, config)
{
	this.el = Ext.get(el);
	
	Ext.apply(this, config);
};

Mys.Scroller.prototype =
{
	duration : 1,
	rate : .1,
	margin : 30,
	height : 0,
	
	scroll : function()
	{
		var eT = this.el.getTop(), vH = Ext.lib.Dom.getViewportHeight(), sY = document.documentElement.scrollTop;
		
		var differ = (sY + vH - (eT + this.el.getHeight() + this.margin)) * this.rate;
		;
		differ = differ > 0 ? Math.ceil(differ) : Math.floor(differ);
		
		if(differ)
			this.el.setTop(eT + differ);
		
		this.deferID = this.scroll.defer(this.duration, this);
	},
	
	stop : function()
	{
		clearTimeout(this.deferID);
	}
};