 ;; Page Initialization
 ;;------------------------------------------------------------------------------
 
-(defn init
-  []
+(defn init []
 
   ; Initialize page content
   (.html ($ "#main-container") (login-html))
 
   ; Populate username field.
-  (.val ($ ".login-name") (get-username))
+  (.val ($ "#login") (get-username))
 
   ; Set username on button click.
   (.click ($ "#submit") on-submit)
 
-  )
+  ; Put focus on username field.
+  (.focus (by-id "login")))
 
 (defn cleanup
   []

;; Events
;;------------------------------------------------------------------------------

(defn on-submit
  "Handle the submit event."
  []
  (let [input (.val ($ ".login-name"))]
    (store-login! input)
    (send-login!)
    (aset js/location "hash" "#/menu")))


(def $ js/$)

;; TODO: move this to a dom namespace
(defn- by-id [id]
  (.getElementById js/document id))

;;------------------------------------------------------------------------------
;; HTML
;;------------------------------------------------------------------------------
