
    var map = null;
    var geocoder = null;
    var icon = null;
    var markers = [];
    var activeWindow = 0;
    function load(uniqueId) {
     	map = new google.maps.Map(dojo.byId("gmap_"+uniqueId), {
      	mapTypeId: google.maps.MapTypeId.ROADMAP,
      	navigationControl:true,
      	navigationControlOptions: {style:google.maps.NavigationControlStyle.ZOOM_PAN},
    		mapTypeControl: true,
    		mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR}
      })

      geocoder = new google.maps.Geocoder();
    
    	icon = new google.maps.MarkerImage(
       	"/images/marker.png", 
       	new google.maps.Size(30, 30),
       	new google.maps.Point(0, 0),
      	new google.maps.Point(5, 5)
      );
    }  
    
      function showAddress(bedrijf,address,theatergeocode) {
	  
		var marker = new google.maps.Marker({
              		position: theatergeocode,
              		map: map,
              		icon: icon
          			});
         
		 markers.push(marker);
                
                var infowindow = new google.maps.InfoWindow({
                	content: "<h3>"+bedrijf+"</h3>"+address
                });
                
                google.maps.event.addListener(marker, 'click', function() {
  					infowindow.open(map,marker);
					
				});
		
      }
      
      function setMapPosition(bedrijf,address, zoom) {
      	if (geocoder) {
          geocoder.geocode({address: address, country: "NL"}, function(results, status) {
            if (status == google.maps.GeocoderStatus.OK && results.length) {
      				var myLatlng = new google.maps.LatLng(results[0].geometry.location.lat(),results[0].geometry.location.lng());
					//map.setCenter(myLatlng);
      				map.setCenter(myLatlng);
					map.setZoom(16);
					showAddress(bedrijf,address,myLatlng);	
     				}
     			});		
     		}
      }
    
          

