Added correct "type" attribute to footer buttons in popups.

The Cancel button has type="button", and each action button has type="submit". This is true even for those cases in which the button is not actually part of a form, for convenience.
Move footer div in popups to inside the form.

This makes more sense, and makes the browser aware that those buttons are actually part of the form, and one of them is the submit button for the form.