Added 'bounds' attribute to the map and listener to 'idle' event to update them
Fixed click event on marker not triggered by calling scope.click() within a ()
Cleaned up and updated example with bounds