BK-1268 Insert Figure button does not work in Firefox

The commit is basically , change the $manager to a function (line 7 - 8) , the other changes are tabs indentation and extra spaces that were detected by jshint.

Tested on Firefox in OSX, Ubuntu and Fedora.