Shouldn't you check that the event is displayed before toggling the calendar?