// adapted source to work in the browser
// original: aem1k.com/fire