Javascript version of mind mapping