1. I'm not sure there are a massive amount of global variables. AFAICT they are things like paths to the root, and they're all prefixed with $qa_. There are a bunch of defines, which is standard practice really.
2. All the HTML (or at least the vast majority) is in the theme file, so it's separate from the control logic.