
    //<![CDATA[
var map;
var geocoder;
var index = 0;
var loaded = false;

// Create a base icon for all of our markers that specifies the
// shadow, icon dimensions, etc.
var baseIcon = new GIcon();
baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
baseIcon.iconSize = new GSize(20, 34);
baseIcon.shadowSize = new GSize(37, 34);
baseIcon.iconAnchor = new GPoint(9, 34);
baseIcon.infoWindowAnchor = new GPoint(9, 2);
baseIcon.infoShadowAnchor = new GPoint(18, 25);


function AddMarkerToMap(name, address, distance) {
  geocoder.getLatLng(
    address,
    function(point) {
      if (point) {
        if(index == 0)
        {
        map.setCenter(point, distance);
        }
        marker = createMarker(point,index,name, address);
        map.addOverlay(marker);
        index = index + 1;
        }
    }
  );
}

// Creates a marker at the given point with the given number label
function createMarker(point, index, name, address) 
{
  var letter = String.fromCharCode("A".charCodeAt(0) + index);
  var letteredIcon = new GIcon(baseIcon);
  letteredIcon.image = "http://www.google.com/mapfiles/marker" + letter + ".png";
  // Set up our GMarkerOptions object
  markerOptions = { icon:letteredIcon };
  var marker = new GMarker(point,markerOptions);
  GEvent.addListener(marker, "click", function() {
  marker.openInfoWindowHtml("<b>" + name + "</b><BR>" + address);
  });
  return marker;
}

function LoadMap()
{
    if(!loaded)
    {
    map = new GMap2(document.getElementById("map"));
    var mapTypeControl = new GMapTypeControl();
    var topRight = new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(10,10));
    var bottomRight = new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(10,10));
    map.addControl(mapTypeControl, topRight);

    GEvent.addListener(map, "dblclick", function() {
    map.removeControl(mapTypeControl);
    map.addControl(new GMapTypeControl(), bottomRight);
    });
    map.addControl(new GSmallMapControl());

    geocoder = new GClientGeocoder();
    }

    if(typeof(LoadMarkers) == 'function')
    {
        LoadMarkers();
    }
    loaded = true;
}
 function showmap()
 {
    divMap = document.getElementById("map");
    divMap.style.display = 'block';
    
    document.getElementById("hideGmap").style.display = 'block';
    document.getElementById("showGmap").style.display = 'none';
    if(!loaded)
    {        
        LoadMap();
    }
 }
 function hidemap()
 {
    divMap = document.getElementById("map");
    divMap.style.display = 'none';
    
    document.getElementById("hideGmap").style.display = 'none';
    document.getElementById("showGmap").style.display = 'block';
        
 }

//]]>
