[bug 852570] Restructure mobile HTML base template 

Phew! I had a really long set of changes for this but then it hit me that there was a way simpler way of doing this (which is how it's now implemented). If anything's busted I guess someone will pick it up along the way. I'm combed through everything I could think of and it looks fine to me.

r?