Add status handling to couch sync service

This adds a status to the couch sync service. Status can be "sync", "online", "offline". The status can be observed using sync.onStatusChange().

The idea is to reduce the number of pouchdb event handler registrations throughout the application. This can also be used by controllers to know when they can fetch data using the views. Maybe a sync.ready() method should be used (which is called when status moves to "online").
Maybe the authentication errors (error.status === 401 && error.name === 'unauthorized') shouldn't change the status to offline?