   app-state
   {:target (. js/document (getElementById "accounting"))})
 
+(comment
+  [["2015/02/23" "Whole Foods" :e-groceries 25 :l-amex]
+   ["2015/02/24" "Trader Joe's" :e-groceries 20 :e-alcohol 10 :l-amex]
+   ["2015/02/25" "Ameritrade" :a-ameritrade [100 :GLD] :a-ameritrade -10010]]
+)   
+    

    (compare (Math/abs n2) (Math/abs n1))
    (compare n1 n2)))
    
(defn tx-tds [tx]
  (let [[from-part to-part :as parts] (sort-by :amount cmp-sign-abs (:parts tx))]
    (update-in 
      (if (single-row-tx? parts)
        [{:to-account (:account to-part)
          :from-account (:account from-part)
          :amount (fixpt->str (:amount to-part))
          :note (:note to-part)}]
        (vec
          (for [{:keys [account amount note]} parts
                :let [pos (pos? amount)]]
            {:amount (fixpt->str (if pos amount (- amount)))
             (if pos :to-account :from-account) account
             :note note})))
      [0] merge (select-keys tx [:date :description]))))

      " \u00A0 "
      (render-menu-link :summary "Summary" screen)
      " \u00A0 "
      (render-menu-link :detail "Detail" screen)
      " \u00A0 "
      (render-menu-link :register "Register" screen))
    (case screen
      :import (render-import state)
      :summary (render-summary (summarize txs))
      :detail (render-detail state)
      :register (render-register state))))

(defn dom-el [id]
  (.getElementById js/document id))
