Improve initial positioning of popup dialogs

Improve initial position of popup dialogs, especially for pages that require scrolling
Consolidate common style and HTML element definitions.