     if tab = window.location.href.match(/tab=(\w+)\b/i)?[1]
       if tab in ["details", "logs"]
         $(".agent-show .nav-pills li a[href='##{tab}']").click()
+
+    $('#toggle-memory').click ->
+      if $('#memorypanel').hasClass('hidden')
+        $('#memorypanel').removeClass 'hidden'
+      else
+        $('#memorypanel').addClass 'hidden'
 
   fetchLogs: (e) ->
     agentId = $(e.target).closest("[data-agent-id]").data("agent-id")

          $("#logs .refresh, #logs .clear").show()

  clearMemory: (e) ->
    if confirm("Are you sure you want to clear memory of this Agent?")
      agentId = $(e.target).closest("[data-agent-id]").data("agent-id")
      e.preventDefault()

        .fail ->
          $("#memory .spinner").fadeOut ->
            $("#memory .clear").css(display: 'inline-block')
            

$ ->
  Utils.registerPage(AgentShowPage, forPathsMatching: /^agents\/\d+/)

