MODx.Wizard=function(A){A=A||{};Ext.applyIf(A,{layout:"card",layoutConfig:{layoutOnCardChange:true,deferredRender:false},activeItem:0,closeAction:"hide",resizable:true,collapsible:true,maximizable:true,autoHeight:true,anchor:"90%",width:"90%",defaults:{border:false},modal:Ext.isIE?false:true,hideMode:"offsets",cls:"modx-window",bbar:[{itemId:"btn-back",text:_("back"),handler:function(){this.fireEvent("backward");},scope:this,disabled:true},{itemId:"btn-next",text:_("next"),handler:function(){this.fireEvent("forward");},scope:this}],firstPanel:"",lastPanel:"",showFirstPanel:true});MODx.Wizard.superclass.constructor.call(this,A);this.lastActiveItem=A.firstPanel;this.config=A;this.addEvents({forward:true,backward:true,proceed:true,finish:true,ready:true});this.on("show",this.onShow,this);this.on("forward",this.onForward,this);this.on("backward",this.onBackward,this);this.on("proceed",this.proceed,this);};Ext.extend(MODx.Wizard,Ext.Window,{windows:{},onForward:function(){this.navHandler(1);},onBackward:function(){this.navHandler(-1);},onShow:function(){if(this.config.showFirstPanel){this.getBottomToolbar().getComponent("btn-next").setText(_("next"));}if(this.config.showFirstPanel){if(this.fireEvent("proceed",this.config.firstPanel)){this.fireEvent("ready");}}else{this.fireEvent("ready");}},navHandler:function(B){this.doLayout();var A=this.getLayout().activeItem;if(B===-1){this.fireEvent("proceed",A.config.back||A.config.id);}else{A.submit();}},proceed:function(B){var A=this.getBottomToolbar();if(!A){return false;}this.getLayout().setActiveItem(B);if(B==this.config.firstPanel){A.getComponent("btn-back").setDisabled(true);}else{if(B==this.config.lastPanel){A.getComponent("btn-next").setText(_("finish"));}else{A.getComponent("btn-back").setDisabled(false);A.getComponent("btn-next").setText(_("next"));}}var C=Ext.getCmp(B).fireEvent("fetch");if(C){if(!Ext.isIE){this.syncSize();this.center();}}return true;}});Ext.reg("modx-wizard",MODx.Wizard);MODx.panel.WizardPanel=function(A){A=A||{};Ext.applyIf(A,{autoHeight:true,bodyStyle:"padding: 20px"});MODx.panel.WizardPanel.superclass.constructor.call(this,A);this.config=A;this.addEvents({fetch:true});this.on("fetch",this.fetch,this);};Ext.extend(MODx.panel.WizardPanel,Ext.FormPanel,{fetch:function(){return true;},submit:function(){return true;}});Ext.reg("panel-wizard-panel",MODx.panel.WizardPanel);