(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...