Improved javascript code

Just to make easier the visualization implementation. The first visualization will be maps.