 			# html for the actual lightbox
 			lightboxHtml = "<div class='drm-blackout'><button class='close'>x</button><img src='#{img}' alt='thumbnail' class='img-visible'><ul class='thumbnail-list'>#{thumbnails}</div>"
 
+			return lightboxHtml
+
 		addLightbox: (e) ->
 			lightbox = $ '.drm-blackout'
-			lightboxHtml = drmLightbox.createLightbox()
+			lightboxHtml = drmLightbox.createLightbox.call $ @
 
 			# if the lightbox isn't already showing, append it to body and fade it into view
 			if lightbox.length == 0
-				$(lightboxHtml).hide().appendTo(body).fadeIn drmLightbox.config.speed
+				console.log lightboxHtml
+				$(lightboxHtml).hide().appendTo(drmLightbox.body).fadeIn drmLightbox.config.speed
 
 			e.preventDefault()
 

			e.stopPropagation()	

		removeLightbox: ->
			$('.drm-blackout').fadeOut(drmLightbox.config.speed).remove()
	}

	drmLightbox.init()

###############################################################################
# Displays a lightbox with an image slideshow built with images from a 
# thumbnail set
###############################################################################

( ($) ->
