function addMarkers(){ mySelect = document.getElementById('selection'); Boston = [];West_Roxbury = [];Jamaica_Plain = [];Charlestown = [];School_location_is_in_Boston = [];Brighton = [];Allston = [];Dorchester = [];Hyde_Park = [];Roslindale = [];East_Boston = [];mySelect.options[mySelect.options.length] = new Option("Allston schools",'all=Allston'); mySelect.options[mySelect.options.length] = new Option("Boston schools",'all=Boston'); mySelect.options[mySelect.options.length] = new Option("Brighton schools",'all=Brighton'); mySelect.options[mySelect.options.length] = new Option("Charlestown schools",'all=Charlestown'); mySelect.options[mySelect.options.length] = new Option("Dorchester schools",'all=Dorchester'); mySelect.options[mySelect.options.length] = new Option("East Boston schools",'all=East_Boston'); mySelect.options[mySelect.options.length] = new Option("Hyde Park schools",'all=Hyde_Park'); mySelect.options[mySelect.options.length] = new Option("Jamaica Plain schools",'all=Jamaica_Plain'); mySelect.options[mySelect.options.length] = new Option("Roslindale schools",'all=Roslindale'); mySelect.options[mySelect.options.length] = new Option("School location is in Boston schools",'all=School_location_is_in_Boston'); mySelect.options[mySelect.options.length] = new Option("West Roxbury schools",'all=West_Roxbury'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Boston[Boston.length] = createMarker(new GPoint(-71.04681700,42.31467600),"
Boston College High School
150 Morrissey Blvd
Boston, MA 02125
All-boys school, 9-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Boston College High School",'Boston=' + Boston.length); Boston[Boston.length] = createMarker(new GPoint(-71.12918900,42.25942300),"
Boston Trinity Academy
17 Hale Street
Boston, MA 02136
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Boston Trinity Academy",'Boston=' + Boston.length); Boston[Boston.length] = createMarker(new GPoint(-71.10955600,42.35057200),"
Boston University Academy
One University Road
Boston, MA 02215
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Boston University Academy",'Boston=' + Boston.length); Boston[Boston.length] = createMarker(new GPoint(-71.13060300,42.30934800),"
British School Of Boston
416 Pond Street
Boston, MA 02130
Co-ed school, NS-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("British School Of Boston",'Boston=' + Boston.length); Boston[Boston.length] = createMarker(new GPoint(-71.06823000,42.34083800),"
Cathedral High School
74 Union Park Street
Boston, MA 02118
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cathedral High School",'Boston=' + Boston.length); West_Roxbury[West_Roxbury.length] = createMarker(new GPoint(-71.16674200,42.27787600),"
Catholic Memorial
235 Baker Street
West Roxbury, MA 02132
All-boys school, 7-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Catholic Memorial",'West_Roxbury=' + West_Roxbury.length); Boston[Boston.length] = createMarker(new GPoint(-71.07793300,42.35228600),"
Commonwealth School
151 Commonwealth Avenue
Boston, MA 02116
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Commonwealth School",'Boston=' + Boston.length); Jamaica_Plain[Jamaica_Plain.length] = createMarker(new GPoint(-71.10694800,42.32358600),"
Compass Inc
26 Sunnyside Street
Jamaica Plain, MA 02130
Co-ed school, 4-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Compass Inc",'Jamaica_Plain=' + Jamaica_Plain.length); Charlestown[Charlestown.length] = createMarker(new GPoint(-71.06509800,42.37813000),"
Holden School
8 Pearl Street
Charlestown, MA 02129
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Holden School",'Charlestown=' + Charlestown.length); Jamaica_Plain[Jamaica_Plain.length] = createMarker(new GPoint(-71.12624300,42.30200200),"
Italian Home For Children
1125 Centre Street
Jamaica Plain, MA 02130
Co-ed school, K-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Italian Home For Children",'Jamaica_Plain=' + Jamaica_Plain.length); Boston[Boston.length] = createMarker(new GPoint(-71.15350000,42.34980000),"
Kennedy Day School Program
30 Warren Street Franciscan Ch
Boston, MA 02135
Co-ed school, Ungraded
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kennedy Day School Program",'Boston=' + Boston.length); Jamaica_Plain[Jamaica_Plain.length] = createMarker(new GPoint(-71.11270000,42.31050000),"
Language And Cognitive Develop
11 Wyman St Or P.o. Box 270
Jamaica Plain, MA 02130
Co-ed school, 1-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Language And Cognitive Develop",'Jamaica_Plain=' + Jamaica_Plain.length); Boston[Boston.length] = createMarker(new GPoint(-71.10971400,42.33121600),"
Manville School
53 Parker Hill Avenue
Boston, MA 02120
Co-ed school, 1-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Manville School",'Boston=' + Boston.length); School_location_is_in_Boston[School_location_is_in_Boston.length] = createMarker(new GPoint(-71.07050000,42.33860000),"
Mary McLeod Bethune Institute
Administration Office 15 Squannacook Dr Groton, MA. 01450-1139
School location is in Boston, MA 02118
All-girls school, 3-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mary McLeod Bethune Institute",'School_location_is_in_Boston=' + School_location_is_in_Boston.length); Brighton[Brighton.length] = createMarker(new GPoint(-71.15122900,42.35125300),"
Mesivta High School Of Greater Boston
34 Sparhawk Street
Brighton, MA 02135
All-boys school, 9-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Mesivta High School Of Greater Boston",'Brighton=' + Brighton.length); Allston[Allston.length] = createMarker(new GPoint(-71.14327400,42.35168800),"
Mount Saint Joseph Academy
617 Cambridge Street
Allston, MA 02134
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mount Saint Joseph Academy",'Allston=' + Allston.length); Dorchester[Dorchester.length] = createMarker(new GPoint(-71.06082100,42.32172900),"
Msgr. Ryan Memorial High School
11 Mayhew St.
Dorchester, MA 02125
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Msgr. Ryan Memorial High School",'Dorchester=' + Dorchester.length); Hyde_Park[Hyde_Park.length] = createMarker(new GPoint(-71.12560000,42.25310000),"
New Beginnings Academy
Po Box 366354
Hyde Park, MA 02136
Co-ed school, PK-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Beginnings Academy",'Hyde_Park=' + Hyde_Park.length); Boston[Boston.length] = createMarker(new GPoint(-71.08226800,42.35208900),"
The Newman School
247 Marlborough Street
Boston, MA 02116
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Newman School",'Boston=' + Boston.length); Dorchester[Dorchester.length] = createMarker(new GPoint(-71.05890000,42.31660000),"
Notre Dame Montessori School
263265 Mt. Vernon Street
Dorchester, MA 02125
Co-ed school, Ungraded
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Notre Dame Montessori School",'Dorchester=' + Dorchester.length); West_Roxbury[West_Roxbury.length] = createMarker(new GPoint(-71.15549100,42.27659600),"
Roxbury Latin School
101 Saint Theresa Avenue
West Roxbury, MA 02132
All-boys school, 7-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Roxbury Latin School",'West_Roxbury=' + West_Roxbury.length); Roslindale[Roslindale.length] = createMarker(new GPoint(-71.12211800,42.28175000),"
St. Clare High School
190 Cummins Highway
Roslindale, MA 02131
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("St. Clare High School",'Roslindale=' + Roslindale.length); East_Boston[East_Boston.length] = createMarker(new GPoint(-71.01609300,42.38286400),"
Savio Preparatory High School
145 Byron Street
East Boston, MA 02128
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Savio Preparatory High School",'East_Boston=' + East_Boston.length); Charlestown[Charlestown.length] = createMarker(new GPoint(-71.05174200,42.37400300),"
Seaport Campus
197 8th Street
Charlestown, MA 02129
All-boys school, 9-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Seaport Campus",'Charlestown=' + Charlestown.length); Boston[Boston.length] = createMarker(new GPoint(-71.10685800,42.34094200),"
The Winsor School
103 Pilgrim Road
Boston, MA 02215
All-girls school, 5-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("The Winsor School",'Boston=' + Boston.length); } // End addStateMarkers JavaScript Function // Takes an array of markers and centers/zooms map based on marker range function centerByArray(myArray, recenter, newMaxMin) { if (newMaxMin == true) reMaxMin(myArray); for (var i = 0; i < myArray.length; i++) { var markLng = myArray[i].getPoint().x; var markLat = myArray[i].getPoint().y; if (markLat > maxLat) maxLat = markLat; if (markLng > maxLng) maxLng = markLng; if (markLat < minLat) minLat = markLat; if (markLng < minLng) minLng = markLng; } if (recenter) reCenterMap(); } // Reinit max/mins function reMaxMin(myArray) { maxLng = myArray[0].getPoint().x; maxLat = myArray[0].getPoint().y; minLng = myArray[0].getPoint().x; minLat = myArray[0].getPoint().y; } // Recenter map based on global max/mins function reCenterMap() { var bounds = new GLatLngBounds(); bounds.extend(new GLatLng(minLat, minLng)); bounds.extend(new GLatLng(maxLat, maxLng)); var center_lat = (bounds.getNorthEast().lat() + bounds.getSouthWest().lat()) / 2.0; var center_lng = (bounds.getNorthEast().lng() + bounds.getSouthWest().lng()) / 2.0; var center = new GLatLng(center_lat, center_lng); var zoom = map.getBoundsZoomLevel(bounds); map.setCenter(center,zoom); //map.setCenter(center,11); /* var center = new GPoint( (maxLng + minLng)/2, (maxLat+minLat)/2 ); var delta = new GSize(maxLng - minLng, maxLat - minLat); var minZoom = map.spec.getLowestZoomLevel(center, delta, map.viewSize); if (minZoom < 4) minZoom = 4; // Lowest possible zoom is 4 map.centerAndZoom(center, minZoom); */ } // Fires when drop down list of schools changes function selectChange(selection) { var myVal = selection.options[selection.selectedIndex].value; map.closeInfoWindow(); // Add entire array based on variable type if (myVal.indexOf('all') != -1 && myVal != 'all') { var temp = myVal.split('='); var showArray = temp[1]; // If Array is > X amount of markers, then open in a new page if (eval(showArray).length > 20) // New window depends on whether or not we're on the search page if (location.href.indexOf('nearby_schools.php') == -1) window.open(location.href + '/map/' + showArray); else window.open('/search/////2/' + showArray); map.removeOverlays(Allston); map.removeOverlays(Boston); map.removeOverlays(Brighton); map.removeOverlays(Charlestown); map.removeOverlays(Dorchester); map.removeOverlays(East_Boston); map.removeOverlays(Hyde_Park); map.removeOverlays(Jamaica_Plain); map.removeOverlays(Roslindale); map.removeOverlays(School_location_is_in_Boston); map.removeOverlays(West_Roxbury); map.addOverlays(eval(showArray)); centerByArray(eval(showArray), true, true); // Center and zoom on set of markers } // Add individual markers if (myVal.indexOf('all') == -1 && myVal != 'all' && myVal.length) { var temp = myVal.split('='); var myArray = temp[0]; var myIndex = parseInt(temp[1]) - 1; document.getElementById('map').width = "750"; map.removeOverlay(eval(myArray)[myIndex]); map.addOverlay(eval(myArray)[myIndex]); GEvent.trigger(eval(myArray)[myIndex],'click'); } // Show all markers if (myVal == 'all') { cntMarker = 0; reMaxMin(Boston);map.removeOverlays(Allston); map.removeOverlays(Boston); map.removeOverlays(Brighton); map.removeOverlays(Charlestown); map.removeOverlays(Dorchester); map.removeOverlays(East_Boston); map.removeOverlays(Hyde_Park); map.removeOverlays(Jamaica_Plain); map.removeOverlays(Roslindale); map.removeOverlays(School_location_is_in_Boston); map.removeOverlays(West_Roxbury); map.addOverlays(Allston); centerByArray(Allston, false, false); cntMarker += Allston.length; map.addOverlays(Boston); centerByArray(Boston, false, false); cntMarker += Boston.length; map.addOverlays(Brighton); centerByArray(Brighton, false, false); cntMarker += Brighton.length; map.addOverlays(Charlestown); centerByArray(Charlestown, false, false); cntMarker += Charlestown.length; map.addOverlays(Dorchester); centerByArray(Dorchester, false, false); cntMarker += Dorchester.length; map.addOverlays(East_Boston); centerByArray(East_Boston, false, false); cntMarker += East_Boston.length; map.addOverlays(Hyde_Park); centerByArray(Hyde_Park, false, false); cntMarker += Hyde_Park.length; map.addOverlays(Jamaica_Plain); centerByArray(Jamaica_Plain, false, false); cntMarker += Jamaica_Plain.length; map.addOverlays(Roslindale); centerByArray(Roslindale, false, false); cntMarker += Roslindale.length; map.addOverlays(School_location_is_in_Boston); centerByArray(School_location_is_in_Boston, false, false); cntMarker += School_location_is_in_Boston.length; map.addOverlays(West_Roxbury); centerByArray(West_Roxbury, false, false); cntMarker += West_Roxbury.length; centerByArray(Boston,true, false); if (cntMarker > 20) // New window depends on whether or not we're on the search page if (location.href.indexOf('schools-by-distance') == -1) window.open(location.href + '/map/all'); else window.open('/search////all'); //window.open('/map.php?type=1&schools=&school_level=2&radius=&zipcode=&school_type_search=&school_type_code='); } } function createMarker(point, label, icon) { var marker = new GMarker(point, icon); var html = label; GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); return marker; }