(Bug 4703) Fixes double-loading of stylesheets

We call need_res twice now: once at the top of the page (for JS
variables and stylesheets), once at the bottom of the page (for JS
scripts).

There was a bug which caused the stylesheets to be printed twice.
Oops...
Merge pull request #584 from afuna/bug4703-double-stylesheets

(Bug 4703) Fixes double-loading of stylesheets