moved map js code from html to js file