/*
===============================================================================
====== Name: googleMap_plot_points.js
====== Desc: Create map based off of Google API and plot points
====== Auth: Chris Barr
====== Date: 05/31/2007
===============================================================================
====== Change History
===============================================================================
====== Date:         Author:           Description:
====== ----------    --------          ----------------------------------------
===============================================================================

function addPoint(Latitude, Longitude, Address, Sequence)
*/

var _boundingBox	= new GLatLngBounds();

if (GBrowserIsCompatible())
{ 
	var googleMap	= new GMap2(document.getElementById("map"));
	var baseIcon	= new GIcon();

	// Display the map, with some controls and set the initial location 
	googleMap.addControl(new GLargeMapControl());
	googleMap.addControl(new GMapTypeControl());
	googleMap.addControl(new GScaleControl());
	googleMap.setCenter(new GLatLng(26.272877, -81.742734),10); // Immokalee Rd & I-75
	googleMap.hideControls();
	GEvent.addListener(googleMap, "mouseover", function(){googleMap.showControls();});
	GEvent.addListener(googleMap, "mouseout", function(){googleMap.hideControls();});

	// Create the basis of the marker icon
	//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);
	
} else {
	alert("Sorry, the Google Maps API is not compatible with this browser");
}

function addPoint(Latitude, Longitude, Address, Sequence)
{
	//var localIcon	= new GIcon(baseIcon);
	var localPoint	= new GLatLng(Latitude, Longitude);
	var localMarker	= new GMarker(localPoint);
	var localTabs	= [
		new GInfoWindowTab("Address", "<span style='color:#000000;'>Listing " + String.fromCharCode((Sequence+65)) + ":<br />" + Address.replace(/\+/g,' ').replace(/,/,'<br />') + "</span>"),
		new GInfoWindowTab("Area Map", "<iframe frameborder=0 width=219 height=202 scrolling=no marginheight=0 marginwidth=0 src=simple_map.asp?ll=" + Latitude + "," + Longitude + " />")
	];

	_boundingBox.extend(localPoint);
	GEvent.addListener(localMarker, "click", function() {localMarker.openInfoWindowTabsHtml(localTabs);});
	googleMap.addOverlay(localMarker);
  	localMarker.setImage("http://www.google.com/mapfiles/marker" + String.fromCharCode((Sequence+65)) + ".png");
	googleMap.setZoom(googleMap.getBoundsZoomLevel(_boundingBox));
	googleMap.setCenter(_boundingBox.getCenter());
};