JavaScript Improvements

 - use an IIFE to avoid global scope pollution
 - avoid the $('#' + formid) hack when triggering the submitComplete event listener
 - follow JavaScript variable naming conventions
 - allowNewTabShortcuts(...) to avoid code duplication