lowercase camelcase mixup

The script stopped because of a mixed use of lowercase and camelcase function name. I changed it back to camelcase (due to the name of the plugin also being written in camelcase).
I also fixed some warnings created by jshint (double use of var with the same varname and a missing semicolon).