updated Queue.js

corrected reference to global object
store references to necessary global functions