Subroutine for creating javascript and HTML files, some other stuff