[WIP] Move JS from html files to forum_fn.js

Ticket: http://tracker.phpbb.com/browse/PHPBB3-11795
RFC: http://area51.phpbb.com/phpBB/viewtopic.php?f=108&t=44477

WIP because it requires merge of several other pull requests:
https://github.com/phpbb/phpbb3/pull/1665
https://github.com/phpbb/phpbb3/pull/1664

and includes commits from several other unmerged pull requests