Allow embedding in <head>

Made the CSS / JS statements modular so that they can be included either
in the <body> or <head> if possible.