     @conversationList = new ChatConversationListView
     @conversationListController = new ChatConversationListController
       view : @conversationList
+
+    @on 'PanelVisibilityChanged', (visible)=>
+      if visible
+        @getSingleton('windowController').addLayer @
+        @once 'ReceivedClickElsewhere', @bound 'hide'
 
   createConversation:(data)->
     # Data includes chatChannel and the conversation

    @addSubView @header
    @addSubView @conversationList
    @conversationListController.loadItems()

  show:->
    @setClass 'visible'


  constructor:->
    super
      cssClass : 'main-chat-panel'

    @registerSingleton "chatPanel", @, yes

