 
   key_down: ->
     ref = this
-    previous = 38
-    next = 40
+    previous = 37
+    next = 39
+    up = 38
+    down = 40
     escape = 27
-    $(document).keydown (e) ->
+    $(document).keydown (e) =>
+      return unless @keys_enabled
       switch e.keyCode
         when previous
-          ref.previous()
+          $(@active_panel).amplePanels('previous')
         when next
-          ref.next()
+          $(@active_panel).amplePanels('next')
+        when up
+          @previous()
+        when down
+          @next()
         when escape
-          ref.toggle() unless ref.modal_active
+          @toggle() unless @modal_active
 
   tpl: (view) ->
     @tpls()[view]


  set_options: (opts) ->
    @current = 0
    ref = this
    default_options = 
      debug: false

      @log "panels(#{i})"
      el = "##{@options.id} .pages .page:nth-child(#{(i+1)}) ul"
      @options.pages[i]['panel_selector'] = el
      @active_panel = el
      @options.pages[i][''] = $(el).attr('id',"#{@options.pages[i]['id']}-panel")
      
      $(el).amplePanels(@options.pages_options)
        .bind 'slide_horizontal', (e,d,dir) ->
          ref.load(i) if dir == 'next'
