// Create a base icon for all of our markers that specifies the
	// shadow, icon dimensions, etc.
	var map;
	var baseIcon = new GIcon();
	baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
	baseIcon.iconSize = new GSize(25, 25);
	baseIcon.shadowSize = new GSize(37, 34);
	baseIcon.iconAnchor = new GPoint(9, 34);
	baseIcon.infoWindowAnchor = new GPoint(9, 2);
	baseIcon.infoShadowAnchor = new GPoint(18, 25);
	var markerArray = new Array();	
	var hasMarkersOverlaid = true;
    var bounds = new GLatLngBounds();

	function mapLoad() {
      if (GBrowserIsCompatible()) {      	
        map = new GMap2(document.getElementById("map"));	
		map.addControl(new GSmallZoomControl());	
		//map.disableDragging();
        
        LoadMarkers();
        
		map.setCenter(bounds.getCenter());
		
		//Set map zoom level up one level from bounds zoom level to ensure at least 10 properties appear
		map.setZoom(map.getBoundsZoomLevel(bounds));
		
		for(i=0; i < markerArray.length; i++)
		{
			map.addOverlay(markerArray[i]);			
		}														
      }
    }
	
	
	// Creates a marker whose info window displays the letter corresponding
	// to the given index.
	function createMarker(point, index, OrgName, Address, City, State, Zip, Phone) {
	  var icon = new GIcon(baseIcon);
	  var marker = null;
	  var directionAddress = Address + ", " + City + ", " + State + " " + Zip;

	  icon.image = "/s/i/mapicons/babel_24522212_0_0_0_25_" + index + ".png";

	  marker = new GMarker(point, icon);

	  var infoTabs = [ new GInfoWindowTab("Details", "<div style='background-color:#FFF;height:50px;width:250px;'><b>" + OrgName + "</b>" + "<br>" + Address + "<br>" + City + ", " + State + " " + Zip + "<br>"  + Phone + "</div>") ];
	  GEvent.addListener(marker, "click", function() {  marker.openInfoWindowTabsHtml(infoTabs);});

	  return marker;
	}
	
	// Determines if markers have been overlaid on the map. If they have it
	// fires the click event for the marker. Otherwise, it clears all markers and adds the 
	// marker and then fires the click event.
	function findOnMap(index)
	{
		if(document.getElementById('map').style.visibility == 'hidden')
		{
			document.getElementById('map').style.visibility = 'visible';
			document.getElementById('map').style.height = '250px';
		}

		if(!hasMarkersOverlaid)
		{		
			map.clearOverlays();
			map.setCenter(markerArray[index].getPoint(), 12);
			map.addOverlay(markerArray[index]);
		}
		
		GEvent.trigger(markerArray[index], 'click'); 
		return true;
	}



