collapsing of several join/quit lines with javascript