Fixed an issue with js not being called

When html files were included after the dom had been parsed
there was an issue with the js of that file as specified in the
script tags not being called. This was fixed by moving these lines
into the index file. This should have some work around, it is not
decent for the index to have to know the structure of its sub files.