 
       @panel.removeClass('uploadcare-dialog-opened-tabs')
 
-      className = 'uploadcare-dialog-tab'
+      @panel.find(".#{tabClass}")
+            .removeClass("#{tabClass}_current")
+            .filter(".#{tabClass}-#{tab}")
+            .addClass("#{tabClass}_current")
+
+      className = "#{tabClass}s-panel"
       @panel.find(".#{className}")
             .removeClass("#{className}_current")
             .filter(".#{className}-#{tab}")
             .addClass("#{className}_current")
 
-      className = 'uploadcare-dialog-tabs-panel'
-      @panel.find(".#{className}")
-            .removeClass("#{className}_current")
-            .filter(".#{className}-#{tab}")
-            .addClass("#{className}_current")
-
       @dfd.notify(tab)
 
     showTab: (tab) =>
-      className = 'uploadcare-dialog-tab'
-      @panel.find(".#{className}-#{tab}")
-            .removeClass("#{className}_hidden")
       @onTabVisibility.fire(tab, true)
 
     hideTab: (tab) =>
+      @onTabVisibility.fire(tab, false)
       if @currentTab == tab
         @switchTab(@__firstVisibleTab())
-      className = 'uploadcare-dialog-tab'
-      @panel.find(".#{className}-#{tab}")
-            .addClass("#{className}_hidden")
-      @onTabVisibility.fire(tab, false)
 
     isTabVisible: (tab) =>
-      className = 'uploadcare-dialog-tab'
-      not @panel.find(".#{className}-#{tab}")\
-            .is(".#{className}_hidden")
+      not @panel.find(".#{tabClass}-#{tab}")\
+            .is(".#{tabClass}_hidden")
 
     __firstVisibleTab: ->
       for tab in @settings.tabs


      @tabs = {}
      @__prepareFooter()
      @onTabVisibility = $.Callbacks()

      if @settings.publicKey
        @__prepareTabs(tab)

    new tabCls(tabPanel, tabButton, dialogApi, settings, name)

  class Panel
    tabClass = 'uploadcare-dialog-tab'

    constructor: (@settings, placeholder, files, tab) ->
      @dfd = $.Deferred()
      @dfd.always(@__closePanel)
