 
     return
 
-  unlockControls: ->
+  unlockControls = ->
     controls = do @controls
 
     $.each controls, (index, control) =>
-      @unlockControl control
+      unlockControl.call @, control
 
       return
 
-  unlockControl: (control) ->
+  unlockControl = (control) ->
     if control
       locked = control.hasClass 'locked'
 


    return

  deactivate: ->
    if do @active
      @section.velocity @options.deactivate.effect,
        easing: @options.deactivate.easing

    id = @section.data 'id'

    @backstage = @roofy.backstage

    @pointer = @roofy.controlPanel.find "> a.control[data-id='#{id}']"
    @label   = @pointer.find '> span.label'

    @close = @section.find 'a.close'

    initialize.call @

    return

  states: ->
    Section.STATES

  active: ->
    @state == 'active'

  inactive: ->
    @state == 'inactive'

  locked: ->
    @state == 'locked'

  controls: ->
    [@pointer, @close]

  # === Events ===

  beforeActivate: (section) =>
    @state = 'locked'

    lockControls.call @

    update.call @

    return

  onActivate: (section) =>
    @state = 'active'

    enableBackstage.call @

    updatePointer.call @

    update.call @

    unlockControls.call @

    return

  beforeDeactivate: (section) =>
    @state = 'locked'

    lockControls.call @

    update.call @

    return

  onDeactivate: (section) =>
    @state = 'inactive'

    disableBackstage.call @

    updatePointer.call @

    update.call @

    unlockControls.call @

    return

  onControlClick: (event) =>
    control = $ event.currentTarget

    toogle.call @

    false

  # === Private ===

  initialize = ->
    update.call @

    setupPointer.call @

    setupClose.call @

    return

  update = ->
    states = do @states
    states = states.join ' '

