/* Google Maps */

var locations = new Array(), icon = new Array(), title = new Array(), content = new Array(), curr_infw, markers = new Array(); // Recently Opened Window
var latlng = new google.maps.LatLng(33.167, -96.775); // Global so that I can overwrite this
var mapZoom = 11;

function createMarker(point, title, content, map, icon) {
	var marker = new google.maps.Marker({ 
		position: point, 
		map: map, 
		title: title, 
		animation: google.maps.Animation.DROP, 
		icon: "/wp-content/themes/landonhomes/images/mapMarker.png" // icon 
	});
	var infowindow = new google.maps.InfoWindow({ content: content });
	google.maps.event.addListener(marker, 'click', function() {
		if (curr_infw) { curr_infw.close();} // If already open, close window
		curr_infw = infowindow;
		infowindow.open(map, marker);
	});
	return marker;
};
function initialize() {
	var myOptions = { zoom: mapZoom, center: latlng, mapTypeControl: false, streetViewControl: false, mapTypeId: google.maps.MapTypeId.ROADMAP /* TERRAIN */ };	
	var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
	for (i=0;i<locations.length;i++) {
		markers[i] = createMarker(locations[i], title[i], content[i], map, icon[i]);
	}
};

