       @setState nextState.title
     else
       warn err.msg or "there was an error, couldn't switch to #{nextState} state!"
+    @hideLoader?()

        if name is state.title
          return index

  decorateState:(name)->
    @setTitle @state.title
    @setIconClass @state.iconClass if @state.iconClass?

  getState:-> @state

  setState:(name)->

    {states} = @getOptions()
    @stateIndex = index = @getStateIndex name
    @state      = states[index]
    @decorateState name

    @setCallback states[index].callback.bind @, @toggleState.bind @



    super options, data

    @setState options.defaultState, no

  getStateIndex:(name)->

