 
 (def db
   {:var (str "tosi:" (rand-int 10))
-   :start 10})
+   :start 10
+   :editing {}})
 
 (defn ^:export updatedb [fields value]
   (set! db (assoc-in db fields value))

            (m "td" nil "Comment")
            (m "td" nil "Time")
            (m "td" nil "")])
        (m "tr" nil [(m "td" nil (text title))
                     (m "td" nil (text url))
                     (m "td" nil (text referer))
                     (m "td" nil (text comment))
                     (m "td" nil (text time))
                     (m "td#edit" nil [(m "button" nil "Save")
                                  (m "button" nil "Clear")])])])))

(defn notes [data start]
  "Returns 10 items from data"

(defn setpage [next]
  (updatedb [:start] next))

(defn update_field [id value]
  (println "Updating" id value)
  (set! db (assoc-in db [:editing id] value)))

(defn save []
  (println "Saved!"))

(defn clear []
  (println "Cleared!"))

;
; View
;

(defn text [id value]
  (m "input[type=text]"
     {:value value :onchange #(update_field id (-> % .-target .-value))}
     nil))

(defn editor [data]
  (let [title (get data "title" "")
