Hello guys,

I have little problem trying to switch Google Maps types. I use very simple code from Google Maps help:

Code:
function initialize() {
  var mapCent = new google.maps.LatLng(10, 10);
  var myOptions = {
    zoom: 10,
    center: mapCent,
    mapTypeId: google.maps.MapTypeId.ROADMAP
  };

  var map = new google.maps.Map(
      document.getElementById("map_canvas"),
      myOptions);
}
...

The map works fine, but when I try to switch map type, I get error (Chrome console):

Code:
Uncaught ReferenceError: map is not defined

My code of link to switch map type and the function which is inside:

Code:
<a href="#" onclick="perekluchitSputnik(); return false;">
Code:
function perekluchitSputnik() {
	map.setMapTypeId(google.maps.MapTypeId.SATELLITE);
}

What am I doing wrong?