Inspired by @elexis' ticket (#5387) and his (and others') work on various gui pages and code thereof.
Functions/variables that cannot be removed from the global namespace have a comment explaining why.
Changeset also includes a reduction in xml gui objects - instead of having four rows of 20 "structure boxes" (the boxes that represent structures) - most of which were never really used - there are now 40 total that are programatically positioned vertically as well as horizontally, serving all phases. Taking into account the children of each "structure box", this is a reduction of ~3964 UI objects(!).
We also now take into account the length of a structure/unit's name-text when determining the width of a "structure/trainer box". No more truncated names!
Otherwise, end result should be pretty much the same.