var timeclockHoursPopup = new Ext.Window({
  layout: 'fit',
  title: 'View my Hours',
  width: 435,
  height: 382,
  closeAction: 'hide',
  modal: true,
  plain: true,
  items: new timeclockHoursGrid(),
  buttons: [
    {
      text: 'Close',
      handler: function(btn){
        timeclockHoursPopup.hide();
      }
    }
  ],
  listeners: {
    beforeShow: function(){
      if (SchoolDynamics.TeacherID != 'KIOSK') {return true;}
      staffid = Ext.getCmp('tcStaffMember').getValue();
      password = Ext.getCmp('tcPassword').getValue();
      tcHoursGrid = Ext.getCmp('timeclock_hours_grid');
      tcHoursGrid.store.baseParams.staffid = staffid;
      tcHoursGrid.store.baseParams.password = password;
      var showPopup;
      Ext.Ajax.request({
        url: 'main_menu/timeclock_data.json.php',
        async: false,
        success: function(r){
            if (r.responseText.trim() == 'true') {
              showPopup = true;
            }  else {
              Ext.Msg.alert('ERROR','Wrong password');
              showPopup = false;            
            }
        },
        params: { command: 'isValidPass', staffid: staffid, tcPassword: password}
      });
      
      return showPopup;
    },
    show: function (tab) {
      Ext.getCmp('timeclock_hours_grid').store.load();
    }
  }

});