title: How to change the marker position in google javascript maps api v3?
body: <p>I have this map:</p>
  
  <pre><code>.... class Maps .... 
  
  Maps.prototype.initialize = function (x, y) {
      var latitude = x;
      var longitude = y;
  
      var mapOptions = {
          zoom: 8,
          center: new google.maps.LatLng(latitude, longitude),
          mapTypeId: google.maps.MapTypeId.ROADMAP
      };
  
      var map = new google.maps.Map(document.getElementById('map_canvas'),  mapOptions);
  
      var marker = new google.maps.Marker({
          position: map.getCenter(),
          map: map,
          title: 'Click to zoom'
      });
  };
  
  Maps.prototype.changePosition = function (x, y) {
  
      var latitude = x;
      var longitude = y;
  
      var map = new google.maps.LatLng(latitude, longitude);
      marker.setPosition(map);
  }
  
  ....
  </code></pre>
  
  <p>then:</p>
  
  <pre><code>var maps = new Maps();
  var marker = maps.initialize(x, y);
  
  window.setTimeout(function() {
      maps.changePosition(x, y));
  }, 3000);
  </code></pre>
  
  <p>the <code>initialize</code> method works, and renders the map and the marker</p>
  
  <p>but the second one doesn't work, doesn't know what <code>setPosition</code> is</p>
  
  <p>any ideas on this issue?</p>