     [(str "h" (if (< hour 10) "0" "") hour)
      (str "m" (if (not= minute 0) "30" "00"))]))
 
+(defn- create-lesson-div
+  "Creates a <div> element for a new lesson using jQuery"
+  [& {:keys [moduleCode moduleName lessonType lessonGroup venue slotsOcc
+             bgColorCssClass isActuallySelected?]}]
+  (let [$divElem  ($ "<div />" (js-obj "class" "lesson"))]
+    (.addClass $divElem bgColorCssClass)
+    ; add background color css class
+    (.append $divElem (text ($ "<p />") (str moduleCode " " moduleName)))
+    (.append $divElem (text ($ "<p />") (str lessonType " [" lessonGroup "]")))
+    (.append $divElem (text ($ "<p />") venue))
+    (width $divElem (str (* half-hour-pixels slotsOcc) "px"))
+    ; make the <div> less opaque for a lesson added by jQuery UI draggable
+    (if (not isActuallySelected?)
+        (.addClass $divElem "lesson-droppable-not-hover"))
+    $divElem))
+
 (defn- add-module-lesson!
   "Adds a single lesson of a module (obtained from the `ModulesMap` global) to
-   the timetable, and returns its jQuery div element."
+   the timetable.
+   Returns a `ModulesSelectedLessonInfo` object augmented with the `:divElem`,
+   `:moduleCode`, `:lessonType` and `:lessonGroup` keys."
   [moduleCode moduleName lessonType lessonLabel modulesMapLesson bgColorCssClass
    isActuallySelected?]
   (let [rowNum    (find-free-row-for-lesson modulesMapLesson)

        startTime (:startTime modulesMapLesson)
        endTime   (:endTime modulesMapLesson)
        slotsOcc  (- endTime startTime)
        $divElem  ($ "<div />" (js-obj "class" "lesson"))

        [hourClass minuteClass]
        (get-css-hour-minute-classes-for-time startTime)]
    ; Create new row if necessary
    (if (= rowNum (get-nr-rows-in-timetable-day day))
        (add-new-row-to-timetable-day! day))

                            :endTime endTime}
                           $divElem)

    (let [dayHTMLElem (nth HTML-Timetable day)
          rowHTMLElem (nth (children dayHTMLElem "tr") rowNum)
          tdHTMLElem  (nth (children
