Hay portal_js is there for all this javascript stuff... Or make that in a view and bundle all of that on one file .....