Javascript teamwork