 ")
 
 (defn js []
-"// NOTE: Experimental
-(function (document, window) {
+"(function (document, window) {
 
 var lastElem = null;
 

        chapcount (count chapters)
        id (:id b)
        bookid (book-elem-id id)]
     [:div.book {:id (str "_" bookid)}
     [:h3.chapter [:a {:href (if (> chapcount 1) (str "#" bookid) bookid)} (book-name-nbsp id)]]
     [:div.chapters
      (->> chapters
           (map (fn [ch]
                  (list [:a {:href (rel-url (:id b) (:num ch) chapcount)} (:num ch)]))))]]))


(defn toc [m baseurl canonical]
  (str "<!DOCTYPE html>"

    var el;
    el = FindElem(lastElem);
    SetActiveElem(el, false);
    el = FindElem('_main');
    SetActiveElem(el, false);

    var raw = window.location.hash.substr(1);
    var id = '_' + raw;
    el = FindElem(id);
    if(!el) {
      id = '_main';
      el = FindElem(id);
    }
    if(el) {
        lastElem = id;
        SetActiveElem(el, true);
