Ext.namespace('CC');
Ext.namespace('CC.help');

// FIXME a grid, form �s window kezel�s m�dos�t�sa �ta nem muk�dik a men�v�lt�s

CC.help.garbage = function() {
	return{
		stack : [],


		addStack : function(objParam) {
			this.stack.push(objParam);
		},


		clean : function() {
			if(this.stack.length > 2) {
				try {
					this.backEndClean(CC.b.mod[this.stack[0]]);
				} catch(e) {}
				try {
					this.frontEndClean(CC.f.mod[this.stack[0]]);
				} catch(e) {}
				this.stack.shift();
			}
		},


		frontEndClean : function(objParam) {
			//		grids : {}		formItems : []		windows: [] ezeket kell t�r�lni
			//grids container clean
			for(i in objParam.grids) {
				//destroy grids by grabbing id
				try {
					Ext.getCmp(objParam.grids[i].grid.id).destroy();
				} catch(e) {}
				//destroy every object
				try {
					objParam.grids[i] = {};
				} catch(e) {}
			}
		},


		backEndClean : function(objParam) {
			objParam.config = {};
		}

	}

} ();
