I have tried to change ID for Google Map and Geolocation.

Code:
  google.maps.visualRefresh = true;
  var map = 'mymap-canvas1';
  function initialize() {
   var mapOptions = {
   zoom: 15,
   mapTypeId: google.maps.MapTypeId.ROADMAP
   };
   map = new google.maps.Map(document.getElementById('mymap-canvas1'),
    mapOptions);
   if(navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(function(position)
     {
      var pos = new google.maps.LatLng(position.coords.latitude,
       position.coords.longitude);
      var infowindow = new google.maps.InfoWindow(
       {
       map: map,
       position: pos,
       content: 'Location found using HTML5.'
       }
      );
      map.setCenter(pos);
     }, function() {
      handleNoGeolocation(true);
     }
    );
   }else {
    handleNoGeolocation(false);
   }
  }
  function handleNoGeolocation(errorFlag) {
   if(errorFlag) {
    var content = 'Error: The Geolocation service failed.';
   }else {
    var content = 'Error: Your browser doesn\'t support geolocation.';
   }
   var options = {
   map: map,
   position: new google.maps.LatLng(60, 105),
   content: content
   };
   var infowindow = new google.maps.InfoWindow(options);
   map.setCenter(options.position);
  }
  google.maps.event.addDomListener(window, 'load', initialize);
 }
);
It will work original ID: map = new google.maps.Map(document.getElementById('map-canvas'),

Why is this not working even there is modified line with the ID like: var map = 'mymap-canvas1';

Need help.