Ext.ns('Nexts.plugins');

Nexts.plugins.FitToParent = function(parent) {
	return {
		init: function(c) {
			c.on('render', function(c) {
				parent = Ext.get(parent || c.el.dom.parentNode);
			});
			c.monitorResize = true;
			c.doLayout = c.doLayout.createInterceptor(function(){
				var pos = this.getPosition(), size = parent.getViewSize();
				this.setSize(size.width - pos[0], size.height - pos[1]);
			}, c);
		}
	}
}
