Added events for viewers

Modifications in dahuapp.viewer.js which allows to implement new functions by using an event management.