The map might not necessarily appear before this because it does a json call asking for data. So the DOM might be considered ready, but the javascript is waiting for and then processing a json.

Please remove this line.