
function C_ResetPWDialog()
{this.window=null;this.show=function(params)
{if(!this.window)
{this.form=new Ext.form.FormPanel({baseCls:'x-plain',url:'/data/reset-password.php',labelAlign:'right',bodyStyle:'padding: 7px 15px 0px 15px',buttonAlign:'center',defaults:{hideLabel:true},baseParams:{},items:[{xtype:'displayfield',hideLabel:true,style:'margin:0 0 10px 0; font: 13px \'Helvetica Neue\', Arial; color:#444',html:'Enter your email address and we will send you a new password. If you \
                           continue to have trouble logging in, send us an email at \
                           <a href="mailto:info@ridenet.net">info@ridenet.net</a>'},{xtype:'textfield',emptyText:'email (name@example.com)',name:'Email',width:330,vtype:'email',allowBlank:false,blankText:'You must enter your email'},{xtype:'container',cls:'form-spacer',height:3},{xtype:'container',id:'status-msg2',style:'display:none',cls:'form-status'},{xtype:'container',cls:'form-spacer',height:3}],buttons:[{text:'Reset Password',width:120,handler:this.saveButtonClick,scope:this},{text:'Cancel',handler:this.cancelButtonClick,scope:this}],keys:[{key:[10,13],scope:this,stopEvent:true,fn:this.saveButtonClick}]});this.window=new Ext.Window({title:'Reset Password',width:390,autoHeight:true,forceLayout:true,resizable:false,closeAction:'hide',modal:true,bodyStyle:'padding:5px;',items:this.form});this.window.on('show',function(){this.form.getForm().reset();this.setMessage('','black');this.form.getForm().findField('Email').focus(true,200);},this);}
this.window.show(params.animateTarget);}
this.cancelButtonClick=function()
{this.window.hide();}
this.saveButtonClick=function()
{this.setMessage("Resetting Password...","black",true);this.window.getEl().mask();this.form.getForm().submit({reset:false,success:this.onPostSuccess,failure:this.onPostFailure,scope:this});}
this.onPostSuccess=function(form,action)
{Ext.Msg.show({title:"Reset Password",msg:"<span style='font-size:14px'>Your password was reset. Check your email for a new temporary password.</span>",closable:false,buttons:Ext.MessageBox.OK,fn:function(btn){this.window.getEl().unmask();this.window.hide();},scope:this});}
this.onPostFailure=function(form,action)
{this.window.getEl().unmask();switch(action.failureType){case Ext.form.Action.CLIENT_INVALID:this.setMessage("Fields marked in red are required.","red");break;case Ext.form.Action.SERVER_INVALID:this.setMessage(action.result.message,"red");break;case Ext.form.Action.CONNECT_FAILURE:this.setMessage("Error resetting password: Server did not respond","red");break;}}
this.setMessage=function(message,color,loading)
{setFormMessage(message,color,loading,'status-msg2');this.window.syncSize();}}
