if (typeof HSP == "undefined") HSP = new Object();
if (typeof HSP.mappage == "undefined") HSP.mappage = new Object();

HSP.init_mappage = function ()
{
	console.log("HSP.init_mappage()");

	HSP.map.paddingX = 50;
	HSP.map.paddingY = 60;

	if (HSP.map.place_id) {
		HSP.map.init("detailed_place_marker", HSP.map.NORMAL, 15);
	} else {
		HSP.map.init("detailed_place_marker", HSP.map.NORMAL, 13);
	}

	HSP.mappage.init_tabs();
	HSP.mappage.init_filters();
	HSP.mappage.init_image_nav();
	HSP.mappage.init_stop_nav();
	HSP.mappage.init_story_nav();
	HSP.mappage.init_overlays();
	
	if (HSP.map.occurrence_id) {
		HSP.map.place_id = HSP.map.stories[HSP.map.occurrence_id];
	}
	
	if (HSP.map.place_id) {
		for (var i = 0; i < HSP.map.places.length; i++) {
			if (HSP.map.places[i].place_id == HSP.map.place_id) {
				GEvent.trigger(HSP.map.markers.all[i], "click");
				break;
			}
		}
	}
	
	if (true) {
		GEvent.addListener(HSP.map.the_map, "click", function (overlay, latlng) {
			if (latlng) {
				var lat = latlng.lat();
				var lng = latlng.lng();
				var zoom = HSP.map.the_map.getZoom();
				
				console.log("HSP.map.the_map.click()", "lat/long=", lat + "," + lng, "zoom=" + zoom);	
			}
		});
	}

	if (true) {
		HSP.mappage.rescale();
		$(window).resize(HSP.mappage.rescale);
	}
}

HSP.mappage.minheight = 620;

HSP.mappage.init_tabs = function ()
{
	$("a#filters-tab").bind("click", function () {
		$("#tabs").css("background-position", "top left");
										   
		$("#filters").css("display", "block");
		$("#demographics").css("display", "none");

		$("a#filters-tab").addClass("selected");
		$("a#demographics-tab").removeClass("selected");

		$("select#places option").attr("selected", "");
		$("select#places option#places-0").attr("selected", "selected");
		
		$("input#all-filter").attr("checked", "checked");
		
		$("ul#topics input.checkbox").attr("checked", "");
		$("ul#sources input.checkbox").attr("checked", "");
		
		$("select#tours option").attr("selected", "");
		$("select#tours option#tours-0").attr("selected", "selected");
	
		$("select#maps option").attr("selected", "");
		$("select#maps option:first-child").attr("selected", "selected");

		if (HSP.mappage.overlay) {
			HSP.map.the_map.removeOverlay(HSP.mappage.overlays[HSP.mappage.overlay.area].overlays[HSP.mappage.overlay.which]);
		}

		HSP.map.display.topics = [];
		HSP.map.display.sources = [];
		HSP.map.display.tour = 0;
		
		HSP.map.showMarkers();

		return false;
	});
	
	$("a#demographics-tab").bind("click", function () {
		$("#tabs").css("background-position", "bottom left");
		
		$("#filters").css("display", "none");
		$("#demographics").css("display", "block");

		$("a#filters-tab").removeClass("selected");
		$("a#demographics-tab").addClass("selected");

		$("input#show-places").attr("checked", "");
		$("#demographics select option").attr("selected", "");
		$("#demographics select option:first-child").attr("selected", "selected");

		HSP.map.the_mgr.clearMarkers();

		return false;
	});
}

HSP.mappage.init_filters = function ()
{
	$("select#places option").attr("selected", "");
	$("select#places option#places-0").attr("selected", "selected");
	
	$("input#all-filter").attr("checked", "checked");
	
	$("ul#topics input.checkbox").attr("checked", "");
	$("ul#sources input.checkbox").attr("checked", "");
	
	$("select#tours option").attr("selected", "");
	$("select#tours option#tours-0").attr("selected", "selected");

	$("select#maps option").attr("selected", "");
	$("select#maps option:first-child").attr("selected", "selected");

	$("ul#legend li a").attr("target", "_blank");

	$("select#places").bind("change", function () {
		var value = $(this).val();
		var type  = value.charAt(0);
		var id = parseInt(value.slice(1), 10);
		
		// $("ul#topics input.checkbox").attr("checked", "");
		// $("ul#topics input#topic-filter-0").attr("checked", "checked");

		$("select#tours option").attr("selected", "");
		$("select#tours option#tours-0").attr("selected", "selected");

		if (HSP.map.display.tour > 0) HSP.map.closeMarkers();

		$("body").removeClass("tour-mode");
		HSP.map.display.neighborhood = id;
		// HSP.map.display.topics = [];
		HSP.map.display.tour = 0;
		
		HSP.mappage.tour_info_close();
		
		// HSP.map.showMarkers();
		HSP.map.updateCookie();

		HSP.map.disconnectVisibleMarkers();
		HSP.map.unboxVisibleMarkers();

		var lat;
		var lng;
		var zoom;

		if (id == 0) {
			lat = 39.954293352120565;
			lng = -75.16439348459244;
		} else {
			lat = HSP.map.neighborhoods[id].lat;
			lng = HSP.map.neighborhoods[id].lng;
		}

		if (id == 0) {
			zoom = 13;
		} else if (type == "N") {
			zoom = 14;
		} else if (type == "S") {
			zoom = 16;
		}
		
		console.log("HSP.mappage select#places", id, lat, lng, zoom);
		
		HSP.map.the_map.setCenter(new GLatLng(lat, lng), zoom);
		
		HSP.util.trackEvent("Map Filter", "Set", "Place-" + id, 0);
	});

	$("input#all-filter").bind("click", function () {
		var checked = $(this).attr("checked");
		
		if (checked) {
			$("ul#topics input.checkbox").attr("checked", "");
			$("ul#sources input.checkbox").attr("checked", "");
			$("select#tours option").attr("selected", "");
			$("select#tours option#tours-0").attr("selected", "selected");

			$("body").removeClass("tour-mode");
			HSP.map.display.topics = [];
			HSP.map.display.sources = [];
			HSP.map.display.tour = 0;
			
			HSP.mappage.tour_info_close();
			
			HSP.map.showMarkers();
			HSP.map.updateCookie();
			
			HSP.map.disconnectVisibleMarkers();
			HSP.map.unboxVisibleMarkers();
		}

		HSP.util.trackEvent("Map Filter", checked ? "Set" : "Clear", "All", 0);
	});

	$("ul#topics input.checkbox").bind("click", function () {
		// 012345678901234
		// topic-filter-XX
		var id = parseInt($(this).attr("id").slice(13), 10);

		$("select#tours option").attr("selected", "");
		$("select#tours option#tours-0").attr("selected", "selected");

		if (HSP.map.display.tour > 0) HSP.map.closeMarkers();

		$("body").removeClass("tour-mode");
		HSP.map.display.topics = [];
		HSP.map.display.tour = 0;
		
		HSP.mappage.tour_info_close();

		$("ul#topics input.checkbox").each(function (unused) {
			var id = parseInt($(this).attr("id").slice(13), 10);
			var checked = $(this).attr("checked");
		
			if (checked) {
				HSP.map.display.topics.push(id);
			}
		});
		
		if (HSP.map.display.topics.length == 0 && HSP.map.display.sources.length == 0) {
			$("input#all-filter").attr("checked", "checked");
		} else {
			$("input#all-filter").attr("checked", "");
		}
				
		HSP.map.showMarkers(false);
		HSP.map.updateCookie();
		
		HSP.map.disconnectVisibleMarkers();
		HSP.map.unboxVisibleMarkers();

		HSP.util.trackEvent("Map Filter", $(this).attr("checked") ? "Set" : "Clear", "Topic-" + id, 0);
	});

	$("ul#sources input.checkbox").bind("click", function () {
		// 0123456789012345
		// source-filter-XX
		var id = parseInt($(this).attr("id").slice(14), 10);

		$("select#tours option").attr("selected", "");
		$("select#tours option#tours-0").attr("selected", "selected");

		if (HSP.map.display.tour > 0) HSP.map.closeMarkers();

		$("body").removeClass("tour-mode");
		HSP.map.display.sources = [];
		HSP.map.display.tour = 0;
		
		HSP.mappage.tour_info_close();

		$("ul#sources input.checkbox").each(function (unused) {
			var id = parseInt($(this).attr("id").slice(14), 10);
			var checked = $(this).attr("checked");
		
			if (checked) {
				HSP.map.display.sources.push(id);
			}
		});
		
		if (HSP.map.display.topics.length == 0 && HSP.map.display.sources.length == 0) {
			$("input#all-filter").attr("checked", "checked");
		} else {
			$("input#all-filter").attr("checked", "");
		}
				
		HSP.map.showMarkers(false);
		HSP.map.updateCookie();
		
		HSP.map.disconnectVisibleMarkers();
		HSP.map.unboxVisibleMarkers();
		
		HSP.util.trackEvent("Map Filter", $(this).attr("checked") ? "Set" : "Clear", "Source-" + id, 0);
	});

	$("select#tours").bind("change", function () {
		var id = parseInt($(this).val(), 10);
		
		$("select#places option").attr("selected", "");
		$("select#places option#places-0").attr("selected", "selected");
		$("ul#topics input.checkbox").attr("checked", "");
		
		HSP.map.closeMarkers();
		
		HSP.map.display.neighborhood = 0;
		HSP.map.display.topics = [];
		HSP.map.display.sources = [];
		HSP.map.display.tour = id;
		
		if (id == 0) {
			$("body").removeClass("tour-mode");
			HSP.map.showMarkers(false);
			HSP.map.updateCookie();
			HSP.mappage.tour_info_close();
			HSP.map.disconnectVisibleMarkers();
		} else {
			$("body").addClass("tour-mode");
			HSP.map.showMarkers(false);
			HSP.map.updateCookie();
			$("#tour-info").css("display", "block");
			$(".tour-info-box").css("display", "none");
			$("#tour-info-" + id).css("display", "block");
//			HSP.map.connectVisibleMarkers();

			HSP.util.trackEvent("Map Filter", "Set", "Tour" + id, 0);
		}

		return false;									
	});

	$("#maps").bind("change", HSP.mappage.set_map);
	$("#show-streets").bind("click", HSP.mappage.set_map);
}

HSP.mappage.set_map = function ()
{
	// 012345
	// map-NN										 
	var id = $("#maps").attr("value").slice(4);
	// id = parseInt(id, 10);
	
	switch (id) {
		case "normal":
		case "physical":
			$("#show-streets").attr("disabled", "disabled").attr("checked", "checked");
			break;
		default:
			$("#show-streets").attr("disabled", "");
			break;
	}

	var disabled = $("#show-streets").attr("disabled");
	var checked = $("#show-streets").attr("checked");
	var streets = !disabled && checked;

	$("ul#legend li").css("display", "none");
	$("ul#legend li#legend-" + id).css("display", "block");

	switch (id) {
		case "1962":
			HSP.map.show_layers(HSP.map.MAP_1962, streets);
			break;
		case "1942":
			HSP.map.show_layers(HSP.map.MAP_1942, streets);
			break;
		case "1875":
			HSP.map.show_layers(HSP.map.MAP_1875, streets);
			break;
		case "1895":
			HSP.map.show_layers(HSP.map.MAP_1895, streets);
			break;
		case "1934":
			HSP.map.show_layers(HSP.map.MAP_1934, streets);
			break;
		case "satellite":
			HSP.map.show_layers(HSP.map.SATELLITE, streets);
			break;
		case "physical":
			HSP.map.show_layers(HSP.map.PHYSICAL, streets);
			break;
		case "normal":
		default:
			HSP.map.show_layers(HSP.map.NORMAL, streets);
			break;
	}
	
	HSP.util.trackEvent("Map Filter", "Set", "Map-" + id, 0);
}

HSP.mappage.init_image_nav = function ()
{
	$("a.image-next").live("click", HSP.mappage.image_next);
	$("a.image-prev").live("click", HSP.mappage.image_prev);
}

HSP.mappage.image_next = function ()
{
	var parents = $(this).parents();
	var $marker = $(parents[1]);
	
	var message = $marker.find("span.image-message").text();
	var a = message.split(" ");
	var i = parseInt(a[1], 10) - 1;
	var n = parseInt(a[3], 10);

	if (++i == n) i = 0;
	
	$marker.find(".image").css("display", "none");
	$marker.find(".image-" + i).css("display", "block");

	$marker.find("p.caption").css("display", "none");
	$marker.find("p.caption-" + i).css("display", "block");

	$marker.find("span.image-message").text("Media " + (i+1) + " of " + n);
	
	return false;
}

HSP.mappage.image_prev = function ()
{
	var parents = $(this).parents();
	var $marker = $(parents[1]);
	
	var message = $marker.find("span.image-message").text();
	var a = message.split(" ");
	var i = parseInt(a[1], 10) - 1;
	var n = parseInt(a[3], 10);

	if (--i < 0) i = n-1;
	
	$marker.find(".image").css("display", "none");
	$marker.find(".image-" + i).css("display", "block");

	$marker.find("p.caption").css("display", "none");
	$marker.find("p.caption-" + i).css("display", "block");

	$marker.find("span.image-message").text("Media " + (i+1) + " of " + n);
	
	return false;
}

/*
**
*/

HSP.mappage.init_stop_nav = function ()
{
	$("a.tour-start").bind("click", HSP.mappage.start_tour);
	$("a.tour-info-close").bind("click", HSP.mappage.tour_info_close);
	$("a.stop-next").live("click", HSP.mappage.stop_next);
	$("a.stop-prev").live("click", HSP.mappage.stop_prev);
}

HSP.mappage.tour_info_close = function ()
{
	console.log("HSP.mappage.tour_info_close()");
	
	$("#tour-info").css("display", "none");
	$(".tour-info-box").css("display", "none");
	$("select#tours option").attr("selected", "");
	$("select#tours option#tours-0").attr("selected", "selected");
	
	return false;
}

HSP.mappage.start_tour = function () {
	console.log("HSP.mappage.start_tour()", HSP.map.tour);

	$("#tour-info").css("display", "none");
	$(".tour-info-box").css("display", "none");

	HSP.mappage.stop_goto(HSP.map.display.tour, 0)
	
	HSP.map.the_map.setZoom(15);
	
	return false;
}

HSP.mappage.stop_goto = function (tour, tour_stop)
{
	var places = HSP.tours[HSP.map.display.tour];
	var place_id = places[tour_stop];
	var i;

	console.log("HSP.mappage.stop_goto()", tour, tour_stop, place_id);

	for (var i = 0; i < HSP.map.places.length; i++) {
		if (HSP.map.places[i].place_id == place_id) {
			HSP.map.place_id = place_id;
			
			HSP.map.display.tour_stop = tour_stop;
			
			if (HSP.map.markers.all[i]) {
				HSP.map.display.tour_flag = true;
				GEvent.trigger(HSP.map.markers.all[i], "click");
			}
			
			return false;
		}
	}
	
	return false;
}

HSP.mappage.stop_prev = function ()
{
	console.log("HSP.mappage.stop_prev()", HSP.map.display.tour, HSP.map.place_id);

	HSP.mappage.stop_goto(HSP.map.display.tour, HSP.map.display.tour_stop-1);
	
	return false;
}

HSP.mappage.stop_next = function ()
{
	console.log("HSP.mappage.stop_next()", HSP.map.display.tour);

	HSP.mappage.stop_goto(HSP.map.display.tour, HSP.map.display.tour_stop+1);

	return false;
}

/*
**
*/

HSP.mappage.story_set = function (i)
{
	var n = $("a.hsp-marker-story-nav-prev").siblings("span.hsp-marker-story-nav-n").text();
	
	$(".hsp-marker-box").css("display", "none");
	$(".hsp-marker-box-" + i).css("display", "block");
	$("span.hsp-marker-story-nav-i").text(i);

	/*
	if (i == 1) {
		$("a.hsp-marker-story-nav-prev").css("color", "#444");
	} else {
		$("a.hsp-marker-story-nav-prev").css("color", "#00aa88");
	}

	if (i == n) {
		$("a.hsp-marker-story-nav-next").css("color", "#444");
	} else {
		$("a.hsp-marker-story-nav-next").css("color", "#00aa88");
	}
	*/
}

HSP.mappage.init_story_nav = function ()
{
	$("a.hsp-marker-story-nav-prev").live("click", function () {
		var i = $(this).siblings("span.hsp-marker-story-nav-i").text();
		var n = $(this).siblings("span.hsp-marker-story-nav-n").text();

		if (--i >= 1) {
			HSP.mappage.story_set(i);
		}
		
		return false;
	});
	
	$("a.hsp-marker-story-nav-next").live("click", function () {
		var i = $(this).siblings("span.hsp-marker-story-nav-i").text();
		var n = $(this).siblings("span.hsp-marker-story-nav-n").text();

		if (++i <= n) {
			HSP.mappage.story_set(i);
		}
		
		return false;
	});
}

/*
**
*/

HSP.mappage.rescale = function () {
	var h = 0;
	var window_h = $(window).height();
	var document_h = $(document).height();

	var map_h = $("#map").outerHeight();
	var offset = $("#map").offset();

	h = window_h - offset.top - 20;

	if (h < HSP.mappage.minheight) h = HSP.mappage.minheight;

	console.log("HSP.mappage.rescale()", offset.top, map_h, h);

	$("#map").css("height", h + "px");
	
	HSP.map.the_map.checkResize();
}

/*
**
*/

HSP.mappage.init_overlays = function ()
{
	console.log("HSP.mappage.init_overlays()");
	
	var areas = [ "FOURTH_STREET", "NINTH_STREET", "I95_NORTH", "I95_SOUTH", "PASCHALL_LYND" ];
	var i;
	var j;
	var lats;
	var lngs;
	var boundaries;
	var overlay;

	for (i = 0; i < areas.length; i++) {
		lats = HSP.mappage.overlays[areas[i]].lats.sort(function (a,b) { return a-b; });
		lngs = HSP.mappage.overlays[areas[i]].lngs.sort(function (a,b) { return a-b; });
		boundaries = new GLatLngBounds(new GLatLng(lats[0], lngs[0]), new GLatLng(lats[lats.length - 1], lngs[lngs.length - 1]));
		
		 HSP.mappage.overlays[areas[i]].overlays = [];
		 HSP.mappage.overlays[areas[i]].$img = [];
		
		for (j = 0; j < HSP.mappage.overlays[areas[i]].maps.length; j++) {
			overlay = new GGroundOverlay("/images/overlays/" + HSP.mappage.overlays[areas[i]].maps[j], boundaries);
			
			HSP.mappage.overlays[areas[i]].overlays[j] = overlay;
		}
	}
	
	HSP.mappage.overlay = null;

	$("input#show-places").bind("click", function () {
		var checked = $(this).attr("checked");
		
		if (checked) {
			HSP.map.display.topics = [];
			HSP.map.display.sources = [];
			HSP.map.display.tour = 0;
			
			HSP.mappage.tour_info_close();
			
			HSP.map.showMarkers();
			HSP.map.updateCookie();
			
			HSP.map.disconnectVisibleMarkers();
			HSP.map.unboxVisibleMarkers();
		} else {
			HSP.map.the_mgr.clearMarkers();
		}

		HSP.util.trackEvent("Map Filter", checked ? "Set" : "Clear", "All", 0);
	});

	$("#demographics select option").attr("selected", "");
	$("#demographics select option:first-child").attr("selected", "selected");

	$("#demographics select").bind("change", function () {
		var value = $(this).val();
		var parts = value.split("-");
		var area = parts[0];
		var which = parseInt(parts[1], 10);
		var i;

		console.log("#demographics select.change()", area, which);

		$("#demographics select option").not($(this).children()).attr("selected", "");
		$("#demographics select option:first-child").not($(this).children()).attr("selected", "selected");
		
		if (HSP.mappage.overlay) {
			console.log("#demographics select.change()", "removing", HSP.mappage.overlays[HSP.mappage.overlay.area].overlays[HSP.mappage.overlay.which]); 
			HSP.map.the_map.removeOverlay(HSP.mappage.overlays[HSP.mappage.overlay.area].overlays[HSP.mappage.overlay.which]);
		}

		if (area == "RESET") {
			HSP.mappage.overlay = null;
			$("#demo-legend h3").css("display", "none");
			$("#demo-legend p").remove();
			$("#demo-legend img").remove();
			$("#demo-legend-info").remove();
		} else {
			console.log("#demographics select.change()", "adding", HSP.mappage.overlays[area].overlays[which]); 
			HSP.map.the_map.addOverlay(HSP.mappage.overlays[area].overlays[which]);
			
			if (HSP.mappage.overlay == null || area != HSP.mappage.overlay.area) {
				var lat = 0;
				var lng = 0;
				
				for (i = 0; i < HSP.mappage.overlays[area].lats.length; i++) {
					lat += HSP.mappage.overlays[area].lats[i];
				}
	
				for (i = 0; i < HSP.mappage.overlays[area].lats.length; i++) {
					lng += HSP.mappage.overlays[area].lngs[i];
				}
				
				lat /= HSP.mappage.overlays[area].lats.length;
				lng /= HSP.mappage.overlays[area].lngs.length;
				
				HSP.map.the_map.setCenter(new GLatLng(lat, lng), HSP.mappage.overlays[area].zoom);
			}
			
			$("#demo-legend h3").css("display", "block");
			$("#demo-legend p").remove();
			$("<p>" + $(this).children("option:selected").text() + "</p>").insertAfter("#demo-legend h3");
			
			var src1 = $("#demo-legend img").attr("src");
			var src2 = "/images/overlays/" + HSP.mappage.overlays[area].legends[which].src;
			
			if (src1 != src2) {
				var width = HSP.mappage.overlays[area].legends[which].width;
				var height = HSP.mappage.overlays[area].legends[which].height;
				
				$("#demo-legend img").remove();
				$("#demo-legend").append("<img src='" +  src2 + "' width='" +  width + "' height='" +  height + "' alt='' />");
				
				var type = HSP.mappage.overlays[area].legends[which].type
				
				$("#demo-legend-info").remove();
				$("#col2").append("<div id='demo-legend-info'></div>");
				$("#demo-legend-info").append("<h2>How to interpret the map legend</h2>");
				switch (type) {
					case "E":
						$("#demo-legend-info").append("<p>Ethnicity categories are based on the most common place of birth of the residents, and of their parents, at each address as reported by the US Census.</p>");
						break;
					case "O":
						$("#demo-legend-info").append("<p>Occupation categories are based on the occupation for the first listed head of household for each address as reported by the US Census.</p>");
						break;
					case "P":
						$("#demo-legend-info").append("<p>Population categories are based on the number of residents reported to be living at each address by the US Census.</p>");
						break;
					case "L":
						$("#demo-legend-info").append("<p>Land Use categories are based on the description of how the building at each address was used as recorded on fire insurance maps.</p>");
						break;
				}
			}
			
			$("#demo-legend p.datasrc").remove();
		
			if (HSP.mappage.overlays[area].legends[which]["datasrc"] != undefined) {
				var datasrc = HSP.mappage.overlays[area].legends[which]["datasrc"];
				
				$("#demo-legend").append("<p class='datasrc'>Data source: " + datasrc + "</p>");
			}
			
			HSP.mappage.overlay = { area: area, which: which };
		}
		
		return false;
	});
}

HSP.mappage.overlays = new Object();

HSP.mappage.overlays.FOURTH_STREET = {
	lats: [ 39.94188368300,  39.93794085700,  39.94148863100,  39.93848714200 ],
	lngs: [ -75.15077001570, -75.14833654140, -75.14754265530, -75.15155203450 ],
	zoom: 17,
	maps: [
		"Fourth_Street_NOEthnicity_1880.png",
		"Fourth_Street_NOEthnicity_1900.png",
		"Fourth_Street_NOEthnicity_1910.png",
		"Fourth_Street_NOEthnicity_1920.png",
		"Fourth_Street_NOEthnicity_1930.png",
		
		"Fourth_Street_Land_Use_1888.png",
		"Fourth_Street_Land_Use_1905.png",
		"Fourth_Street_Land_Use_1915.png",
		"Fourth_Street_Land_Use_1921.png",
		
		"Fourth_Street_Occupation_1880.png",
		"Fourth_Street_Occupation_1900.png",
		"Fourth_Street_Occupation_1910.png",
		"Fourth_Street_Occupation_1920.png",
		"Fourth_Street_Occupation_1930.png",
		
		"Fourth_Street_Population_1880.png",
		"Fourth_Street_Population_1900.png",
		"Fourth_Street_Population_1910.png",
		"Fourth_Street_Population_1920.png",
		"Fourth_Street_Population_1930.png"
	],
	legends: [
		{ src: "Fourth_Street_NOEthnicity_legend.png", width: 143, height: 285, type: "E" },
		{ src: "Fourth_Street_NOEthnicity_legend.png", width: 143, height: 285, type: "E" },
		{ src: "Fourth_Street_NOEthnicity_legend.png", width: 143, height: 285, type: "E" },
		{ src: "Fourth_Street_NOEthnicity_legend.png", width: 143, height: 285, type: "E" },
		{ src: "Fourth_Street_NOEthnicity_legend.png", width: 143, height: 285, type: "E" },

		{ src: "Fourth_Street_Land_Use_legend.png", width: 148, height: 173, type: "L", datasrc: "1888 Hexamer" },
		{ src: "Fourth_Street_Land_Use_legend.png", width: 148, height: 173, type: "L", datasrc: "1905 Hexamer" },
		{ src: "Fourth_Street_Land_Use_legend.png", width: 148, height: 173, type: "L", datasrc: "1915-1916 Hexamer" },
		{ src: "Fourth_Street_Land_Use_legend.png", width: 148, height: 173, type: "L", datasrc: "1921 Hexamer" },

		{ src: "Fourth_Street_Occupation_legend.png", width: 145, height: 223, type: "O" },
		{ src: "Fourth_Street_Occupation_legend.png", width: 145, height: 223, type: "O" },
		{ src: "Fourth_Street_Occupation_legend.png", width: 145, height: 223, type: "O" },
		{ src: "Fourth_Street_Occupation_legend.png", width: 145, height: 223, type: "O" },
		{ src: "Fourth_Street_Occupation_legend.png", width: 145, height: 223, type: "O" },
		
		{ src: "Fourth_Street_Population_legend.png", width: 140, height: 97, type: "P" },
		{ src: "Fourth_Street_Population_legend.png", width: 140, height: 97, type: "P" },
		{ src: "Fourth_Street_Population_legend.png", width: 140, height: 97, type: "P" },
		{ src: "Fourth_Street_Population_legend.png", width: 140, height: 97, type: "P" },
		{ src: "Fourth_Street_Population_legend.png", width: 140, height: 97, type: "P" }
	]
};

HSP.mappage.overlays.NINTH_STREET = {
	lats: [ 39.93919212650, 39.93856615600, 39.93678896050, 39.93594439220 ],
	lngs: [ -75.15943076970, -75.15632269170, -75.15994432240, -75.15688280750 ],
	zoom: 17,
	maps: [
		"Ninth_Street_Ethnicity_1880.png",
		"Ninth_Street_Ethnicity_1900.png",
		"Ninth_Street_Ethnicity_1910.png",
		"Ninth_Street_Ethnicity_1920.png",
		
		"9th_Street_LandUse_1888.png",
		"9th_Street_LandUse_1895.png",
		"9th_Street_LandUse_1909.png",
		"9th_Street_LandUse_1916.png",
		
		"Ninth_Street_Occupation_1880.png",
		"Ninth_Street_Occupation_1900.png",
		"Ninth_Street_Occupation_1910.png",
		"Ninth_Street_Occupation_1920.png"
	],
	legends: [
		{ src: "Ninth_Street_Ethnicity_legend.png", width: 133, height: 264, type: "E" },
		{ src: "Ninth_Street_Ethnicity_legend.png", width: 133, height: 264, type: "E" },
		{ src: "Ninth_Street_Ethnicity_legend.png", width: 133, height: 264, type: "E" },
		{ src: "Ninth_Street_Ethnicity_legend.png", width: 133, height: 264, type: "E" },
		
		{ src: "9th_Street_Land_Use_legend.png", width: 168, height: 233, type: "L", datasrc: "1888 Hexamer" },
		{ src: "9th_Street_Land_Use_legend.png", width: 168, height: 233, type: "L", datasrc: "1895 Bromley" },
		{ src: "9th_Street_Land_Use_legend.png", width: 168, height: 233, type: "L", datasrc: "1909 Hexamer" },
		{ src: "9th_Street_Land_Use_legend.png", width: 168, height: 233, type: "L", datasrc: "1915-1916 Hexamer" },
		
		{ src: "Ninth_Street_Occupation_legend.png", width: 165, height: 232, type: "O" },
		{ src: "Ninth_Street_Occupation_legend.png", width: 165, height: 232, type: "O" },
		{ src: "Ninth_Street_Occupation_legend.png", width: 165, height: 232, type: "O" },
		{ src: "Ninth_Street_Occupation_legend.png", width: 165, height: 232, type: "O" },
		{ src: "Ninth_Street_Occupation_legend.png", width: 165, height: 232, type: "O" }
	]
};

HSP.mappage.overlays.I95_NORTH = {
	lats: [ 39.94104765730, 39.94078367230, 39.93362411210, 39.93333209350 ],
	lngs: [ -75.14407443730, -75.14216009450, -75.14569416440, -75.14340755520 ],
	zoom: 16,
	maps: [
		"I95_North_Section_land_use.png"
	],
	legends: [
		{ src: "I95_land_use_legend.png", width: 116, height: 159, type: "L", datasrc: "1963 Sanborn Map" }
	]
};

HSP.mappage.overlays.I95_SOUTH = {
	lats: [ 39.93013526090, 39.92986903970, 39.92372191560, 39.92402378210 ],
	lngs: [ -75.14650195000, -75.14446340610, -75.14784375600, -75.14558327780  ],
	zoom: 16,
	maps: [
		"I95_South_Section_land_use.png"
	],
	legends: [
		{ src: "I95_land_use_legend.png", width: 116, height: 159, type: "L", datasrc: "1963 Sanborn Map" }
	]
};

HSP.mappage.overlays.PASCHALL_LYND = {
	lats: [ 39.96171068030, 39.96171304140, 39.96323200700, 39.96322866480 ],
	lngs: [ -75.14451357680, -75.14695930080, -75.14452312210, -75.14696004990 ],
	zoom: 17,
	maps: [
		"Paschall_Lynd_Ethnicity_1880.png",
		"Paschall_Lynd_Ethnicity_1900.png",
		"Paschall_Lynd_Ethnicity_1910.png",
		"Paschall_Lynd_Ethnicity_1920.png",
		"Paschall_Lynd_Ethnicity_1930.png",
		
		"Paschall_Lynd_Occupation_1880.png",
		"Paschall_Lynd_Occupation_1900.png",
		"Paschall_Lynd_Occupation_1910.png",
		"Paschall_Lynd_Occupation_1920.png",
		"Paschall_Lynd_Occupation_1930.png",
		
		"Paschall_Lynd_Population_1880.png",
		"Paschall_Lynd_Population_1900.png",
		"Paschall_Lynd_Population_1910.png",
		"Paschall_Lynd_Population_1920.png",
		"Paschall_Lynd_Population_1930.png"
	],
	legends: [
		{ src: "Paschall_Lynd_Ethnicity_legend.png", width: 112, height: 70, type: "E" },
		{ src: "Paschall_Lynd_Ethnicity_legend.png", width: 112, height: 70, type: "E" },
		{ src: "Paschall_Lynd_Ethnicity_legend.png", width: 112, height: 70, type: "E" },
		{ src: "Paschall_Lynd_Ethnicity_legend.png", width: 112, height: 70, type: "E" },
		{ src: "Paschall_Lynd_Ethnicity_legend.png", width: 112, height: 70, type: "E" },
		
		{ src: "Paschall_Lynd_Occupation_legend.png", width: 132, height: 298, type: "O" },
		{ src: "Paschall_Lynd_Occupation_legend.png", width: 132, height: 298, type: "O" },
		{ src: "Paschall_Lynd_Occupation_legend.png", width: 132, height: 298, type: "O" },
		{ src: "Paschall_Lynd_Occupation_legend.png", width: 132, height: 298, type: "O" },
		{ src: "Paschall_Lynd_Occupation_legend.png", width: 132, height: 298, type: "O" },
		
		{ src: "Paschall_Lynd_Population_legend.png", width: 140, height: 97, type: "P" },
		{ src: "Paschall_Lynd_Population_legend.png", width: 140, height: 97, type: "P" },
		{ src: "Paschall_Lynd_Population_legend.png", width: 140, height: 97, type: "P" },
		{ src: "Paschall_Lynd_Population_legend.png", width: 140, height: 97, type: "P" },
		{ src: "Paschall_Lynd_Population_legend.png", width: 140, height: 97, type: "P" }
	]
};
