Fixed forms not always working.

Moved forms JavaScript to a separate file called "formmanager.js"