move click marker event handler out of the createMarker loop