// Constructor.
DirectMap = function (map, docElemMapSearch)
{
    this.map = map;
//    this.map.addControl(new PanoMapTypeControl()); 
    this.map.addControl(new GSmallMapControl());
    this.map.addControl(new GMapTypeControl(), new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(10,20)));

//    var options = { resultList : docElemMapSearch, suppressZoomToBounds:true  }; 

    var options = { suppressZoomToBounds:true  }; 

    this.searchControl = new google.maps.LocalSearch(options); 
    this.map.addControl(this.searchControl, new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(10,20))); 

    this.clusterer = new Clusterer(this.map);
    this.clusterer.SetMinMarkersPerCluster(2); 
    this.clusterer.SetMaxVisibleMarkers(2); 
    this.clusterer.SetMaxLinesPerInfoBox(7); 
};

DirectMap.prototype.executeLocalSearch = function (destination)
{
    this.searchControl.execute(destination);
};


DirectMap.prototype.setCenter = function (lat, long, zoom)
{
    this.map.setCenter(new GLatLng(lat, long), zoom);
};

//DirectMap.defaultIcon = new GIcon();
//DirectMap.defaultIcon.golf = http://www.annoncedirect.com/images/Golf.PNG';
//DirectMap.defaultIcon.iconSize = new GSize( 30, 51 );
//DirectMap.defaultIcon.golfSize = new GSize( 56, 51 );


// Call this to add a marker.
DirectMap.prototype.addMarker = function (map, markerNum, lat, long, urlImg, title)
{

    var blueIcon = new GIcon(G_DEFAULT_ICON);
    blueIcon.image = "http://www.annoncedirect.com/images/MapsIcons/iconb.png";
    markerOptions = { icon:blueIcon };

    var marker = new GMarker(new GLatLng(lat, long), markerOptions); 
    marker.value = markerNum;

    GEvent.addListener(marker,"click", function() { 
       var myHtml = "<a href='javascript:OpenImages(\"" + markerNum + "\",\"" + markerNum + ".jpg\")'><img src=" + urlImg + " border=1 class=imgTag></a><a href=#" + markerNum + ">" + title + "</a>"; 
       map.openInfoWindowHtml(new GLatLng(lat, long), myHtml); } ); 

    this.clusterer.AddMarker(marker,"<table><tr><td valign=bottom><a href='javascript:OpenImages(\"" + markerNum + "\",\"" + markerNum + ".jpg\")'><img src=" + urlImg + " border=1 class=imgTag width=20 onmouseover=this.width=100 onmouseout=this.width=20></a></td><td valign=top><a href=#" + markerNum + ">" + title + "</a></td></tr></table>"); 
    return marker;
};