returns document click events to a function