         (cb) -> load("/static/threejs/r#{VERSION}/Detector.min.js", cb)
         (cb) ->
             f = () ->
-                if THREE?
+                if Detector?
                     cb()
                 else
                     #console.log("load_threejs: waiting for THREEJS...")

$.ajaxSetup(cache: true) # when using getScript, cache result.

load_threejs = (cb) ->
    _loading_threejs_callbacks.push(cb)
    #console.log("load_threejs")
    if _loading_threejs_callbacks.length > 1
        #console.log("load_threejs: already loading...")
        return

    load = (script, name, cb) ->
        if typeof(name) != 'string'

            cb(err)
        _loading_threejs_callbacks = []
    )


_scene_using_renderer  = undefined
