Ext.namespace('NGMP.panel');

NGMP.panel.ManagedIFrame=function(){
    var D=Array.prototype.slice.call(arguments,0),E=Ext.get(D[0]),C=D[0];
    if(E&&E.dom&&E.dom.tagName=="IFRAME"){
        C=D[1]||{
        };
        
    } else{
        C=D[0]||D[1]||{
            
        };
        E=C.autoCreate?Ext.get(Ext.DomHelper.append(
			C.autoCreate.parent||document.body,
			Ext.apply({
		   		tag:"iframe",
				src:(Ext.isIE&&Ext.isSecure)?Ext.SSL_SECURE_URL:""
        },
        C.autoCreate))):null;
    }
    if(!E||E.dom.tagName!="IFRAME"){
        return E;
    }
    !!E.dom.name.length||(E.dom.name=E.dom.id);
    this.addEvents({
        domready:true,
		documentloaded:true,
		exception:true,
		message:true
    });
    if(C.listeners){
        this.listeners=C.listeners;
        NGMP.panel.ManagedIFrame.superclass.constructor.call(this);
    }
    Ext.apply(E,this);
    E.addClass("x-managed-iframe");
    if(C.style){
        E.applyStyles(C.style);
    }
    var A=Ext.util.CSS,G=[];
    A.getRule(".x-managed-iframe")||(G.push(".x-managed-iframe {height:100%;width:100%;overflow:auto;}"));
    A.getRule(".x-frame-shim")||(G.push(".x-frame-shim {z-index:18000!important;position:absolute;top:0;"+
		"left:0;background-color:transparent;width:100%;height:100%;zoom:1;}"));
    A.getRule(".x-managed-iframe-mask")||(G.push(".x-managed-iframe-mask {width:100%;height:100%;position:relative;}"));
    if(!!G.length){
        A.createStyleSheet(G.join(" "));
    }
    E._maskEl=E.parent(".x-managed-iframe-mask")||E.parent().addClass("x-managed-iframe-mask");
    Ext.apply(E._maskEl,{
        applyShim:function(H){
            if(this._mask){
                this._mask.remove();
            }
            this._mask=Ext.DomHelper.append(this.dom,{
                cls:H||"x-frame-shim"
            }
            ,true);
            this.addClass("x-masked");
            this._mask.setDisplayed(true);
        },
        removeShim:function(){
            this.unmask();
        }
        
    });
    Ext.apply(E,{
        disableMessaging:C.disableMessaging===true,
		applyShim:E._maskEl.applyShim.createDelegate(E._maskEl),
		removeShim:E._maskEl.removeShim.createDelegate(E._maskEl),
		loadMask:Ext.apply({
            msg: LANG_loading+'..',
			msgCls:"x-mask-loading",
			maskEl:E._maskEl,
			hideOnReady:true,disabled:!C.loadMask
        },
        C.loadMask),_eventName:Ext.isIE?"onreadystatechange":"onload",
		_windowContext:null,
		eventsFollowFrameLinks:typeof C.eventsFollowFrameLinks=="undefined"?true:C.eventsFollowFrameLinks
    });
    E.dom[E._eventName]=E.loadHandler.createDelegate(E);
    if(document.addEventListener){
        Ext.EventManager.on(window,"DOMFrameContentLoaded",E.dom[E._eventName]);
    }
    var B=E.updateManager=new Ext.UpdateManager(E,true);
    B.showLoadIndicator=C.showLoadIndicator||false;
    if(C.src){
        E.setSrc(C.src);
    } else{
        var F=C.html||C.content||false;
        if(F){
            E.update.defer(10,E,[F]);
        }
	}
    return NGMP.panel.ManagedIFrame.Manager.register(E);
};

Ext.extend(NGMP.panel.ManagedIFrame,Ext.util.Observable,{
    src:null,setSrc:function(A,C,E){
        var B=Ext.isIE&&Ext.isSecure?Ext.SSL_SECURE_URL:"";
        var D=A||this.src||B;
        if(Ext.isOpera){
            this.dom.src=B;
        }
        this._windowContext=null;
        this._hooked=this._domReady=this._domFired=false;
        this._callBack=E||false;
        this.showMask();
        (function(){
            var G=typeof D=="function"?D()||"":D;
            try{
                this._frameAction=true;
                this.dom.src=G;
                this.frameInit=true;
                this.checkDOM();
            }
            catch(F){
                this.fireEvent("exception",this,F);
            }
            
        }
        ).defer(10,this);
        if(C!==true){
            this.src=D;
        }
        return this;
    },
    reset:function(A,B){
        this.setSrc(A||(Ext.isIE&&Ext.isSecure?Ext.SSL_SECURE_URL:""),true,B);
    },
    	scriptRE:/(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/gi,
		update:function(B,A,D){
        	A=A||this.getUpdateManager().loadScripts||false;
        	B=Ext.DomHelper.markup(B||"");
        	B=A===true?B:B.replace(this.scriptRE,"");
        var C = this.getDocument();
        if(C){
            this._frameAction=!!B.length;
            this._windowContext=this.src=null;
            this._callBack=D||false;
            this._hooked=this._domReady=this._domFired=false;
            this.showMask();
            C.open();
            C.write(B);
            C.close();
            this.frameInit=true;
            if(this._frameAction){
                this.checkDOM();
            }
            else{
                this.hideMask(true);
                if(this._callBack){
                    this._callBack();
                }
                
            }
            
        }
        else{
            this.hideMask(true);
            if(this._callBack){
                this._callBack();
            }
            
        }
        return this;
    },disableMessaging:true,_XFrameMessaging:function(){
        var A={
            "$":[]
        };
        var B=function(D,C){
            return D===null||D===undefined||(!C?D==="":false);
        };
        window.sendMessage=function(K,L,J){
            var F = arguments.callee.manager;
            if(F){
                if(K._fromHost){
                    var I,M;
                    var C=K.tag||L||null;
                    var D=!B(C)?A[C.toLowerCase()]||[]:A["$"];
                    for(var G=0,E=D.length;
                    G<
                    E;
                    G++){
						I = D[G];
                        if(I){
                            M=I.apply(I.__scope,arguments)===false?false:M;
                            if(I.__single){
                                D[G]=null;
                            }
                            if(M===false){
                                break;
                            }
                            
                        }
                        
                    }
                    return M;
                }
                else{
                    K={
                        type:B(L)?"message":"message:"+L.toLowerCase().replace(/^\s+|\s+$/g,""),data:K,domain:J||document.domain,uri:document.documentURI,source:window,tag:B(L)?null:L.toLowerCase()
                    }
                    ;
                    try{
                        return F.disableMessaging!==true?F.fireEvent.call(F,K.type,F,K):null;
                    }
                    catch(H){
                        
                    }
                    return null;
                }
                
            }
            
        };

        window.onhostmessage=function(F,E,G,C){
            if(typeof F=="function"){
                if(!B(F.__index)){
                    throw"onhostmessage: duplicate handler definition"+(C?" for tag:"+C:"");
                }
                var D=B(C)?"$":C.toLowerCase();
                A[D]||(A[D]=[]);
                Ext.apply(F,{
                    __tag:D,__single:G||false,__scope:E||window,__index:A[D].length
                });
                A[D].push(F);
            }
            else{
                throw"onhostmessage: function required";
            }
            
        };
        window.unhostmessage=function(D){
            if(typeof D=="function"&&typeof D.__index!="undefined"){
                var C=D.__tag||"$";
                A[C][D.__index]=null;
            }
            
        };
        
    },
	_renderHook:function(){
        this._windowContext=null;
        this._hooked=false;
        try{
            if(this.writeScript('(function(){parent.Ext.get("'+this.dom.id+'")._windowContext='+
			(Ext.isIE?"window":"{eval:function(s){return eval(s);}}")+
			";})();")){
                if(this.disableMessaging!==true){
                    this.loadFunction({
                        name:"XMessage",fn:this._XFrameMessaging
                    },false,true);
                    var B = this.getWindow().sendMessage;
					if (B) {
                        B.manager=this;
                    }
                    
                }
                
            }
            return this.domWritable();
        }
        catch(A){
            
        }
        return false;
    },
	sendMessage:function(C,A,B){
        var D;
        if(this.disableMessaging!==true&&(D=this.getWindow())){
            A||(A=C.tag||"");
            A=A.toLowerCase();
            C=Ext.applyIf(C.data?C:{
                data:C
            }
            ,{
                type:Ext.isEmpty(A)?"message":"message:"+A,
				domain:B||document.domain,
				uri:document.documentURI,
				source:window,tag:A||null,_fromHost:this
            }
            );
            return D.sendMessage?D.sendMessage.call(null,C,A,B):null;
        }
        return null;
    },
		_windowContext:null,getDocument:function(){
        return this.getWindow()?this.getWindow().document:null;
    }
    ,getDocumentURI:function(){
        var A;
        try{
            A=this.src?this.getDocument().location.href:null;
        }
        catch(B){
            
        }
        return A||this.src;
    }
    ,getWindow:function(){
        var A=this.dom;
        return A?A.contentWindow||window.frames[A.name]:null;
    }
    ,print:function(){
        try{
            var B=this.getWindow();
            if(Ext.isIE){
                B.focus();
            }
            B.print();
        }
        catch(A){
            throw"print exception: "+(A.description||A.message||A);
        }
        
    }
    ,destroy:function(){
        this.removeAllListeners();
        if(this.dom){
            if(document.addEventListener){
                Ext.EventManager.un(window,"DOMFrameContentLoaded",this.dom[this._eventName]);
            }
            this.dom[this._eventName]=null;
            this._windowContext=null;
            if(Ext.isIE&&this.dom.src){
                this.dom.src="javascript:false";
            }
            this._maskEl=null;
            Ext.removeNode(this.dom);
        }
        Ext.apply(this.loadMask,{
            masker:null,maskEl:null
        }
        );
        NGMP.panel.ManagedIFrame.Manager.deRegister(this);
    }
    ,domWritable:function(){
        return !!this._windowContext;
    }
    ,execScript:function(block,useDOM){
        try{
            if(this.domWritable()){
                if(useDOM){
                    this.writeScript(block);
                }
                else{
                    return this._windowContext.eval(block);
                }
                
            }
            else{
                throw"execScript:non-secure context";
            }
            
        }
        catch(ex){
            this.fireEvent("exception",this,ex);
            return false;
        }
        return true;
    }
    ,writeScript:function(G,B){
        B=Ext.apply({
            
        }
        ,B||{
            
        }
        ,{
            type:"text/javascript",text:G
        });
        try{
            var D,A,F=this.getDocument();
            if(F&&F.getElementsByTagName){
                if(!(D=F.getElementsByTagName("head")[0])){
                    D=F.createElement("head");
                    F.getElementsByTagName("html")[0].appendChild(D);
                }
                if(D&&(A=F.createElement("script"))){
                    for(var E in B){
                        if(B.hasOwnProperty(E)&&E in A){
                            A[E]=B[E];
                        }
                        
                    }
                    return !!D.appendChild(A);
                }
                
            }
            
        }
        catch(C){
            this.fireEvent("exception",this,C);
        }
        return false;
    }
    ,loadFunction:function(Z,B,C){
        var A=Z.name||Z;
        var D=Z.fn||window[Z];
        this.execScript(A+"="+Z,B);
        if(C){
            this.execScript(A+"()");
        }
        
    }
    ,showMask:function(D,C,B){
        var A;
        if((A=this.loadMask)&&(!A.disabled||B)){
            if(A._vis){
                return;
            }
            A.masker||(A.masker=Ext.get(A.maskEl||this.dom.parentNode||this.wrap({
                tag:"div",style:{
                    position:"relative"
                }
                
            }
            )));
            A._vis=true;
            A.masker.mask.defer(A.delay||5,A.masker,[D||A.msg,C||A.msgCls]);
        }
        
    }
    ,hideMask:function(B){
        var A;
        if((A=this.loadMask)&&!A.disabled&&A.masker){
            if(!B&&(A.hideOnReady!==true&&this._domReady)){
                return;
            }
            A._vis=false;
            A.masker.unmask.defer(A.delay||5,A.masker);
        }
        
    }
    ,loadHandler:function(B){
        if(!this.frameInit||(!this._frameAction&&!this.eventsFollowFrameLinks)){
            return;
        }
        var A=(B&&typeof B.type!=="undefined"?B.type:this.dom.readyState);
        switch(A){
            case"loading":
			case"interactive":
			break;
            case"DOMFrameContentLoaded":if(this._domFired||(B&&B.target!==this.dom)){
                return;
            }
            case"domready":
				if(this._domFired){
               		return;
           		 }
            	if(this._domFired=this._hooked=this._renderHook()){
               	 this._frameAction=(this.fireEvent("domready",this)===false?false:this._frameAction);
           		 }
				break;
            case"domfail":
				this._domReady=true;
           		this.hideMask();
            	break;
            case"load":case"complete":if(!this._domFired){
                this.loadHandler({
                    type:"domready"
                });
            }
            this.hideMask(true);
            if(this._frameAction||this.eventsFollowFrameLinks){
                this.fireEvent.defer(50,this,["documentloaded",this]);
            }
            this._frameAction=false;
            if(this.eventsFollowFrameLinks){
                this._domFired=this._domReady=false;
            }
            if(this._callBack){
                this._callBack(this);
            }
            break;
            default:
				break;
        }
        
    }
    ,checkDOM:function(Z){
        if(Ext.isOpera){
            return;
        }
        var F=0,D=Z||this.getWindow(),C=this,B=false,A=100;
        var E=function(){
            try{
                B=false;
                var I=D.document,G;
                if(!C._domReady){
                    B=(I&&I.getElementsByTagName);
                    B=B&&(G=I.getElementsByTagName("body")[0])&&!!G.innerHTML.length;
                }
                
            }
            catch(H){
                F=A;
            }
            if(!C._frameAction||C._domReady){
                return;
            }
			F++;
            if(F<A&&!B){
                setTimeout(arguments.callee,10);
                return;
            }
            C.loadHandler({
                type:B?"domready":"domfail"
            });
        };
        setTimeout(E,50);
    }
    
});
NGMP.panel.ManagedIFrame.Manager=function(){
    var A={};
    return{
        register:function(B){
            B.manager=this;
            return A[B.id]=B;
        }
        ,deRegister:function(B){
            if(A[B.id]){
                delete A[B.id];
            }
            
        }
        ,hideDragMask:function(){
            if(!this.inDrag){
                return;
            }
            Ext.select(".x-managed-iframe-mask",true).each(function(B){
                B.removeShim();
            }
            );
            this.inDrag=false;
        }
        ,showDragMask:function(){
            if(!this.inDrag){
                this.inDrag=true;
                Ext.select(".x-managed-iframe-mask",true).each(function(B){
                    B.applyShim();
                }
                );
            }
            
        }
        
    };
    
}();

NGMP.panel.ManagedIframePanel=Ext.extend(Ext.Panel,{
    defaultSrc:null,bodyStyle:{
        height:"100%",width:"100%"
    }
    ,frameStyle:false,loadMask:false,animCollapse:false,autoScroll:false,closable:true,ctype:"NGMP.panel.ManagedIframePanel",showLoadIndicator:false,unsupportedText:"Inline frames are NOT enabled/supported by your browser.",initComponent:function(){
        var A=this.unsupportedText?{
            html:this.unsupportedText
        }
        :false;
        this.frameConfig||(this.frameConfig={
            autoCreate:{
                
            }
            
        }
        );
        this.bodyCfg||(this.bodyCfg={
            tag:"div",cls:"x-panel-body",children:[{
                cls:"x-managed-iframe-mask",children:[Ext.apply(Ext.apply({
                    tag:"iframe",frameborder:0,cls:"x-managed-iframe",style:this.frameStyle||this.iframeStyle||false
                }
                ,this.frameConfig.autoCreate),A,Ext.isIE&&Ext.isSecure?{
                    src:Ext.SSL_SECURE_URL
                }
                :false)]
            }
            ]
        });
        this.autoScroll=false;
        if(this.stateful!==false){
            this.stateEvents||(this.stateEvents=["documentloaded"]);
        }
        NGMP.panel.ManagedIframePanel.superclass.initComponent.call(this);
        this.monitorResize||(this.monitorResize=this.fitToParent);
        this.addEvents({
            documentloaded:true,domready:true,message:true,exception:true
        });
        this.addListener=this.on;
    }
    ,doLayout:function(){
        if(this.fitToParent&&!this.ownerCt){
            var B=this.getPosition(),A=(Ext.get(this.fitToParent)||this.getEl().parent()).getViewSize();
            this.setSize(A.width-B[0],A.height-B[1]);
        }
        NGMP.panel.ManagedIframePanel.superclass.doLayout.apply(this,arguments);
    }
    ,beforeDestroy:function(){
        if(this.rendered){
            if(this.tools){
                for(var A in this.tools){
                    Ext.destroy(this.tools[A]);
                }
                
            }
            if(this.header&&this.headerAsText){
                var B = this.header.child('span');
                if(B){
                    B.remove();
                }
                this.header.update("");
            }
            Ext.each(["iframe","header","topToolbar","bottomToolbar","footer","loadMask","body","bwrap"],function(C){
                if(this[C]){
                    if(typeof this[C].destroy=="function"){
                        this[C].destroy();
                    }
                    else{
                        Ext.destroy(this[C]);
                    }
                    this[C]=null;
                    delete this[C];
                }
                
            }
            ,this);
        }
        NGMP.panel.ManagedIframePanel.superclass.beforeDestroy.call(this);
    }
    ,onDestroy:function(){
        Ext.Panel.superclass.onDestroy.call(this);
    }
    ,onRender:function(B,A){
        NGMP.panel.ManagedIframePanel.superclass.onRender.call(this,B,A);
		
        this.iframe=this.body.child("iframe.x-managed-iframe");
		if (this.iframe){
            Ext.each([this[this.collapseEl],this.el,this.iframe],function(D){
                D.setVisibilityMode(Ext.Element[(this.hideMode||"display").toUpperCase()]||1).originalDisplay=(this.hideMode!="display"?"visible":"block");
            }
            ,this);
            if(this.loadMask){
                this.loadMask=Ext.apply({
                    disabled:false,maskEl:this.body,hideOnReady:true
                }
                ,this.loadMask);
            }
            this.iframe=new NGMP.panel.ManagedIFrame(this.iframe,Ext.apply({
                loadMask:this.loadMask,showLoadIndicator:this.showLoadIndicator,disableMessaging:this.disableMessaging
            }
            ,this.frameConfig));
			if (this.iframe) {
                this.loadMask=this.iframe.loadMask;
                this.iframe.ownerCt=this;
                this.relayEvents(this.iframe,["documentloaded","domready","exception","message"].concat(this._msgTagHandlers||[]));
                delete this._msgTagHandlers;
            }
            this.getUpdater().showLoadIndicator=this.showLoadIndicator||false;
            var C=this.ownerCt;
            while(C){
                C.on("afterlayout",function(D,G){
                    var E=NGMP.panel.ManagedIFrame.Manager,F=false;
                    Ext.each(["north","south","east","west"],function(I){
                        var H;
                        if((H=G[I])&&H.splitEl){
                            F=true;
                            if(!H.split._splitTrapped){
                                H.split.on("beforeresize",E.showDragMask,E);
                                H.split._splitTrapped=true;
                            }
                            
                        }
                        
                    }
                    ,this);
                    if(F&&!this._splitTrapped){
                        this.on("resize",E.hideDragMask,E);
                        this._splitTrapped=true;
                    }
                    
                }
                ,this,{
                    single:true
                }
                );
                C=C.ownerCt;
            }
            
        }
        
    }
    ,afterRender:function(A){
        var B=this.html;
        delete this.html;
        NGMP.panel.ManagedIframePanel.superclass.afterRender.call(this);
        if(this.iframe){
            if(this.defaultSrc){
                this.setSrc();
            }
            else{
                if(B){
                    this.iframe.update(typeof B=="object"?Ext.DomHelper.markup(B):B);
                }
                
            }
            
        }
        
    }
    ,sendMessage:function(){
        if(this.iframe){
            this.iframe.sendMessage.apply(this.iframe,arguments);
        }
        
    }
    ,on:function(B){
        var D=/^message\:/i,C=null;
        if(typeof B=="object"){
            for(var A in B){
                if(!this.filterOptRe.test(A)&&D.test(A)){
                    C||(C=[]);
                    C.push(A.toLowerCase());
                }
                
            }
            
        }
        else{
            if(D.test(B)){
                C=[B.toLowerCase()];
            }
            
        }
        if(this.getFrame()&&C){
            this.relayEvents(this.iframe,C);
        }
        else{
            this._msgTagHandlers||(this._msgTagHandlers=[]);
            if(C){
                this._msgTagHandlers=this._msgTagHandlers.concat(C);
            }
            
        }
        NGMP.panel.ManagedIframePanel.superclass.on.apply(this,arguments);
    }
    ,setSrc:function(A,B,D){
        A=A||this.defaultSrc||false;
        if(!A){
            return this;
        }
        if(A.url){
            D=A.callback||false;
            B=A.discardUrl||false;
            A=A.url||false;
        }
        var C=A||(Ext.isIE&&Ext.isSecure?Ext.SSL_SECURE_URL:"");
        if(this.rendered&&this.iframe){
            this.iframe.setSrc(C,B,D);
        }
        return this;
    }
    ,getState:function(){
        var A=this.iframe?this.iframe.getDocumentURI()||null:null;
        return Ext.apply(NGMP.panel.ManagedIframePanel.superclass.getState.call(this)||{
            
        }
        ,A?{
            defaultSrc:typeof f=="function"?A():A
        }
        :null);
    }
    ,getUpdater:function(){
        return this.rendered?(this.iframe||this.body).getUpdater():null;
    }
    ,getFrame:function(){
        return this.rendered?this.iframe:null;
    }
    ,getFrameWindow:function(){
        return this.rendered&&this.iframe?this.iframe.getWindow():null;
    }
    ,getFrameDocument:function(){
        return this.rendered&&this.iframe?this.iframe.getDocument():null;
    }
    ,load:function(B){
        var A = this.getUpdater();
        if(A){
            if(B&&B.renderer){
                A.setRenderer(B.renderer);
                delete B.renderer;
            }
            A.update.apply(A,arguments);
        }
        return this;
    }
    ,doAutoLoad:function(){
        this.load(typeof this.autoLoad=="object"?this.autoLoad:{
            url:this.autoLoad
        });
    }
    ,onShow:function(){
        if(this.iframe){
            this.iframe.setVisible(true);
        }
        NGMP.panel.ManagedIframePanel.superclass.onShow.call(this);
    }
    ,onHide:function(){
        if(this.iframe){
            this.iframe.setVisible(false);
        }
        NGMP.panel.ManagedIframePanel.superclass.onHide.call(this);
    }
    
});
Ext.reg("iframepanel",NGMP.panel.ManagedIframePanel);
NGMP.panel.ManagedIframePortlet=Ext.extend(NGMP.panel.ManagedIframePanel,{
    anchor:"100%",frame:true,collapseEl:"bwrap",collapsible:true,draggable:true,cls:"x-portlet"
});
Ext.reg("iframeportlet",NGMP.panel.ManagedIframePortlet);

NGMP.panel.WindowGroup=Ext.extend(Ext.WindowGroup,{
	getCount:function(){
		return accessList.length;
    }
});

NGMP.panel.WindowPanel=function(B,A){
    this.windowGroup=B;
    this.config=A||{
    };
    this.doMinimize=function(D){
        D.hide();
        var C=new this.windowRecord({
            name:Ext.util.Format.ellipsis(D.initialConfig.title,15),id:D.getId()
        });
        this.windowStore.add(C);
    };
    this.doRestore=function(C){
        if(!C.isVisible()){
            this.windowGroup.get(C.getId()).show();
            var D=this.windowStore.find("id",C.getId());
            if(D>=0){
                this.windowStore.remove(this.windowStore.getAt(D));
            }
            
        }
        
    };
    this.windowIconTemplate=new Ext.XTemplate(
	'<tpl for="."><div class="thumb-wrap"><div class="x-box"><div class="x-box-tl"><div class="x-box-tr"><div class="x-box-tc">',
	'</div></div></div><div class="x-box-ml"><div class="x-box-mr"><div class="x-box-mc"><table><tr><td align="center" valign="top">',
	'<img src="images/MessageWindow32.png" align="middle"/></td></tr><tr><td align="center">{name}</td></tr></table>',
	'</div></div></div><div class="x-box-bl"><div class="x-box-br"><div class="x-box-bc"></div></div></div></div></div></tpl>',
    '<div class="x-clear"></div>');
    this.windowIconTemplate.compile();
    this.windowRecord=Ext.data.Record.create([
		{name:"name"},
		{name:"id"}
    ]);
    this.windowStore=new Ext.data.SimpleStore({
        fields:["name","id"]
    });
    this.windowStore.on("add",function(D,C,E){
        if(D.getCount()==1){
            this.show();
            this.ownerCt.doLayout();
        }
        
    },this);
    this.windowStore.on("remove",function(D,C,E){
        if(D.getCount()===0){
            this.hide();
            this.ownerCt.doLayout();
        }
        
    },this);
/*
    this.windowView=new Ext.DataView({
        singleSelect:true,
		store:this.windowStore,
		cls:"ychooser-view",
		tpl:this.windowIconTemplate,
		itemSelector:"div.thumb-wrap",
		selectedClass:"x-box-blue",
		border:true,
		hideMode:"visibility",
		height:this.config.height||80
    });
    this.windowView.on("click",function(F,C,D,E){
        this.windowGroup.get(F.getRecord(D).get("id")).show();
        this.windowStore.remove(F.getRecord(D))
    },this);
    Ext.apply(this.config,{
        items:this.windowView
    });
*/
    NGMP.panel.WindowPanel.superclass.constructor.call(this,this.config);
};
Ext.extend(NGMP.panel.WindowPanel,Ext.Panel,{
    addWindow:function(A){
        A.on("minimize",this.doMinimize,this);
        A.on("activate",this.doRestore,this);
    },
    removeWindow:function(A){
        A.un("minimize",this.doMinimize,this);
        A.un("activate",this.doRestore,this);
    }
    
});

NGMP.Panel = function(A) {
	Ext.apply(this, A);
	NGMP.Panel.superclass.constructor.call(this);
};

Ext.extend(NGMP.Panel, Ext.Panel, {
	border:false,
	cls:'ngmp-form-panel',
	region:'center',
	layout:'border'
});

NGMP.panel.CenterPanel = function(A) {
	NGMP.panel.CenterPanel.superclass.constructor.call(this,A);
};

Ext.extend(NGMP.panel.CenterPanel, Ext.Panel, {
	region:'center',
	layout:'card',
	border:false,
	bodyStyle:'padding:10px;',
	activeItem: 0,
	defaults:{
		border:false
	}
});
