Private JS scopes

Put the cockpit javascript code into private scopes as much as possible. This lets us catalog what our current interaction between the various parts of cockpit is. This all goes via the 'cockpit.xxxx' namespace.

This is a step in the direction of communicating between iframes, and (in the far future) having a public cockpit API for plugins.

Some functions were moved into near the places where they were used, so as not to add unnecessary surface area to the 'cockpt.xxxx' functions.