  var Page = {
    	load: function() {
    var myLatlng = new google.maps.LatLng(39.886979,3.030395);
    var myOptions = {
      zoom: 4,
      center: myLatlng, 
   	  disableDefaultUI: true,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    }
    var map = new google.maps.Map(document.getElementById("mapa_hp"), myOptions);
    setMarkers(map, beaches);

	   }
    }
    
var beaches = [
  ['Follonica', 42.925458,10.7547, 1],
  ['Portoferraio', 42.81676,10.315246, 2],
  ['Bastia', 42.695038,9.451997, 3],
  ['Monaco', 43.732009,7.407074, 4],
  ['', 42.957026,6.423798, 5],
  ['Marseille', 43.271806,5.316925, 6],
  ['', 43.134264,3.174133, 7],
  ['', 41.940289,3.338928, 8],
  ['Barcelona', 41.386288,2.218323, 9],
  ['Menorca', 40.041494,3.965149, 10],
  ['Mallorca' , 39.322825,3.223572, 11],
  ['Ibiza', 39.097242,1.300964, 12],
  ['Cartagena', 37.582025,-0.682984, 13],
  ['', 36.688684,-1.990357, 14],
  ['Malaga', 36.653437,-4.385376, 15],
  ['Gibraltar', 36.069526,-5.429077, 16],
  ['Tanger', 35.829394,-5.725708, 17],
  ['Cádiz', 36.512285,-6.395874, 18],
  ['', 36.512285,-6.395874, 19],
  ['Lisabon',  38.730947,-9.603882, 20],
  ['Porto ',  41.148052,-8.768921, 21]
]; 

function setMarkers(map, locations) {
  // Add markers to the map

  // Marker sizes are expressed as a Size of X,Y
  // where the origin of the image (0,0) is located
  // in the top left of the image.

  // Origins, anchor positions and coordinates of the marker
  // increase in the X direction to the right and in
  // the Y direction down.
  var image = new google.maps.MarkerImage('common/images/beachflag.png',
      // This marker is 20 pixels wide by 32 pixels tall.
      new google.maps.Size(20, 32),
      // The origin for this image is 0,0.
      new google.maps.Point(0,0),
      // The anchor for this image is the base of the flagpole at 0,32.
      new google.maps.Point(0, 32));
  var shadow = new google.maps.MarkerImage('common/images/beachflag_shadow.png',
      // The shadow image is larger in the horizontal dimension
      // while the position and offset are the same as for the main image.
      new google.maps.Size(37, 32),
      new google.maps.Point(0,0),
      new google.maps.Point(0, 32));
      // Shapes define the clickable region of the icon.
      // The type defines an HTML &lt;area&gt; element 'poly' which
      // traces out a polygon as a series of X,Y points. The final
      // coordinate closes the poly by connecting to the first
      // coordinate.
  var shape = {
      coord: [1, 1, 1, 20, 18, 20, 18 , 1],
      type: 'poly'
  };
  for (var i = 0; i < locations.length; i++) {
    var beach = locations[i];
    var myLatLng = new google.maps.LatLng(beach[1], beach[2]);
    var marker = new google.maps.Marker({
        position: myLatLng,
        map: map,
        shadow: shadow,
        icon: image,
        shape: shape,
        title: beach[0],
        zIndex: beach[3]
    });
  }  
}   


  
   
    window.addEvent('domready', Page.load.bind(Page));
