Update the ImageManager js object

- No dependence on Mootools
- Support both jQuery and Mootools version of Chosen (whichever is
  installed will just work)
- Remove/consolidate unneeded/repetitious code
- Fix bugs such as uninitialized variables