  function loadData(){
	$.ajax({
	  url:'paineis_locacao.php',
	  success:function(data){
		display(data.center, data.macDoList);
	  }
	});
  }


  function display( center, macDoList ) {
  
	$('#googleMap').gmap3(
	  {action: 'init',
		options:{
		  center:center,
		  zoom: 8,
		  mapTypeId: google.maps.MapTypeId.TERRAIN
		}
	  },
	  /*{ action: 'addKmlLayer',
          url: 'http://www.publicarpaineis.com.br/v2012/br277_v2.kml'
        },*/
	  {action: 'addMarkers',
		radius:100,
		markers: macDoList,
		clusters:{
		  // This style will be used for clusters with more than 0 markers
		  0: {
			content: '<div class="cluster cluster-1">CLUSTER_COUNT</div>',
			width: 53,
			height: 52
		  },
		  // This style will be used for clusters with more than 20 markers
		  20: {
			content: '<div class="cluster cluster-2">CLUSTER_COUNT</div>',
			width: 56,
			height: 55
		  },
		  // This style will be used for clusters with more than 50 markers
		  50: {
			content: '<div class="cluster cluster-3">CLUSTER_COUNT</div>',
			width: 66,
			height: 65
		  }
		},
		marker: {
		  options: {
			icon: new google.maps.MarkerImage('http://maps.gstatic.com/mapfiles/icon_green.png')
		  },
		  events:{  
			mouseover: function(marker, event, data){
			  $(this).gmap3(
				{ action:'clear', name:'overlay'},
				{ action:'addOverlay',
				  latLng: marker.getPosition(),
				  content:  '<div class="infobulle'+(data.drive ? ' drive' : '')+'">' +
							  '<div class="bg"></div>' +
							  '<div class="text">' + data.cidade + ' (' + data.endereco + ')</div>' +
							'</div>' +
							'<div class="arrow"></div>',
				  offset: {
					x:-46,
					y:-73
				  }
				}
			  );
			},
			mouseout: function(){
			  $(this).gmap3({action:'clear', name:'overlay'});
			}
		  }
		}
	  }
	);
  };

  loadData();
