﻿
Ext.onReady(function(){
    
   
    var win;
    var button = Ext.get('troubleshootac');

    button.on('click', function(){
        // create the window on the first click and reuse on subsequent clicks
        if(!win){
            win = new Ext.Window({
                el:'hello-win',
                layout:'fit',
                width:330,
                height:250,
                closeAction:'hide',
                plain: true,
                
                items: new Ext.TabPanel({
                    el: 'hello-tabs',
                    autoTabs:true,
                    activeTab:0,
                    deferredRender:false,
                    border:false
                })

                
            });
        }
        win.show(this);
    });
});


//CALL FUNCTION FOR FORGOT PASSWORD
function ForgotPassword()
{
 
if(document.getElementById("Txt_EmailId").value=="")
  {
    
     document.getElementById("Hidden_Focus").value = "Txt_EmailId";
     ShowMessage_ForgotPassword("Please enter your email address.");
     return false;
  }
  else
  {
     var mailid = document.getElementById("Txt_EmailId").value;
     onUpdating();
     Login.GetForgotPassword(mailid,ForgotPasswordCallback);
     return false;
  }
  
}

 function ForgotPasswordCallback(response)
{
    document.getElementById("Txt_EmailId").value = "";  
    onUpdated();     
   ShowMessage_ForgotPassword(response.value);
      
} 


// for pop up forgot password
function ShowMessage_ForgotPassword(Message)
{
   Ext.MessageBox.show({
           title: 'Agency Portal Alert',
           msg: Message,
           buttons: Ext.MessageBox.OK,
           animEl: 'Btn_ForgotPassword',
           fn:SetFocus_ForgotPassword,
           icon:'ext-mb-download',
           minWidth: 400
           
       }); 
}

function SetFocus_ForgotPassword()
{
 if(document.getElementById("Hidden_Focus").value =="Txt_EmailId")
 {
  document.getElementById("Txt_EmailId").focus();
 }
}

function onUpdating(){
           
         
           //get the gridview element        
           Ext.MessageBox.show({
           msg: 'Processing your request , please wait...',
           progressText: 'Processing your request.....',
           width:300,
           wait:true,
           waitConfig: {interval:200},
           animEl: 'mb7'
           });
          
        }

   function onUpdated() {
              
             
                Ext.MessageBox.hide();
               
                Ext.onReady(function(){
                 });
              
           
             
          }



