var barr = [ ] ;
  function initialize() {
    var latlng = new google.maps.LatLng(34.597042, 1.757813);
    var myOptions = {
      zoom: 1,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    
     setMarkers(map, locations);  
  }
  
  var locations = [
  	['Albuquerque NM',35.055125,-106.642043,1,"<div><b>Rhino Board US</b></div><div>2711 Karsten Court SE</div><div>Albuquerque, NM 87102</div><div>(505) 842-5100</div>"],
  	['UK',53.667299,-2.663541,2,"<div><b>Rhino Board UK</b></div><div>CBTC Euxton Lane</div><div>Chorley PR7 6TE</div><div>+ 44 1257 248482</div>"],
  ];
  
  function setMarkers(map, locations) {
  	var image = new google.maps.MarkerImage('images/pin.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 shape = {
	      coord: [1, 1, 1, 20, 18, 20, 18 , 1],
	      type: 'poly'
	  };
	  for (var i = 0; i < locations.length; i++) {
	    var dist = locations[i];
	    var myLatLng = new google.maps.LatLng(dist[1], dist[2]);
	    var marker = new google.maps.Marker({
	        position: myLatLng,
	        map: map,
	        icon: image,
	        shape: shape,
	        title: dist[0],
	        zIndex: dist[3]
	    });
	  
	  	barr[i] = new Object;
	
	  	barr[i].marker = marker ;
	    barr[i].html = dist[4] ; //"This is content for infoWindow";
	 
	    // Create the infoWindow...
	    barr[i].infoWindow = new google.maps.InfoWindow({
	     content: barr[i].html
	    });
	 
	    // Create the listener with a closure...
	    barr[i].listener = makeClosure(i, barr[i].marker) ;
		 
	  }
	 
	   // Make a simple closure with the listener...
	  function makeClosure( i, marker )
	  {
	   var listener = google.maps.event.addListener(marker, 'click', function() {
	    openInfoWindow(i) ;		// <-- this is the key to making it work
	   });
	   return listener ;
	  }
	 
	  // Open the infoWindow - called from the closure...
	  function openInfoWindow(i)
	  {
	   if ( typeof(lastI) == 'number' && typeof(barr[lastI].infoWindow) == 'object' )
	   { 
	    barr[lastI].infoWindow.close() ;
	   }
	   lastI = i ;    
	   barr[i].infoWindow.open(map,barr[i].marker) ;    
	  }
  }