function addMarkers(){ mySelect = document.getElementById('selection'); Mansfield = [];Braintree = [];Brookline = [];Quincy = [];Sharon = [];Canton = [];Wellesley = [];Weymouth = [];Milton = [];East_Walpole = [];Walpole = [];Wapole = [];Holbrook = [];Randolph = [];Medfield = [];Dedham = [];Needham = [];Westwood = [];mySelect.options[mySelect.options.length] = new Option("Braintree schools",'all=Braintree'); mySelect.options[mySelect.options.length] = new Option("Brookline schools",'all=Brookline'); mySelect.options[mySelect.options.length] = new Option("Canton schools",'all=Canton'); mySelect.options[mySelect.options.length] = new Option("Dedham schools",'all=Dedham'); mySelect.options[mySelect.options.length] = new Option("East Walpole schools",'all=East_Walpole'); mySelect.options[mySelect.options.length] = new Option("Holbrook schools",'all=Holbrook'); mySelect.options[mySelect.options.length] = new Option("Mansfield schools",'all=Mansfield'); mySelect.options[mySelect.options.length] = new Option("Medfield schools",'all=Medfield'); mySelect.options[mySelect.options.length] = new Option("Milton schools",'all=Milton'); mySelect.options[mySelect.options.length] = new Option("Needham schools",'all=Needham'); mySelect.options[mySelect.options.length] = new Option("Quincy schools",'all=Quincy'); mySelect.options[mySelect.options.length] = new Option("Randolph schools",'all=Randolph'); mySelect.options[mySelect.options.length] = new Option("Sharon schools",'all=Sharon'); mySelect.options[mySelect.options.length] = new Option("Walpole schools",'all=Walpole'); mySelect.options[mySelect.options.length] = new Option("Wapole schools",'all=Wapole'); mySelect.options[mySelect.options.length] = new Option("Wellesley schools",'all=Wellesley'); mySelect.options[mySelect.options.length] = new Option("Westwood schools",'all=Westwood'); mySelect.options[mySelect.options.length] = new Option("Weymouth schools",'all=Weymouth'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Mansfield[Mansfield.length] = createMarker(new GPoint(-71.21716200,42.02970700),"
Al-noor Academy High School
20 Church Street
Mansfield, MA 02048
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Al-noor Academy High School",'Mansfield=' + Mansfield.length); Braintree[Braintree.length] = createMarker(new GPoint(-71.00486100,42.22901700),"
Archbishop Williams High School
80 Independence Avenue
Braintree, MA 02184
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Archbishop Williams High School",'Braintree=' + Braintree.length); Brookline[Brookline.length] = createMarker(new GPoint(-71.12726800,42.34962600),"
Bay Cove Academy
156 Lawton Street
Brookline, MA 02446
Co-ed school, 8-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bay Cove Academy",'Brookline=' + Brookline.length); Brookline[Brookline.length] = createMarker(new GPoint(-71.12056100,42.34462400),"
Beacon High School
74 Green
Brookline, MA 02446
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Beacon High School",'Brookline=' + Brookline.length); Brookline[Brookline.length] = createMarker(new GPoint(-71.11508200,42.34365500),"
Boston Trinity Academy
1187 Beacon Street
Brookline, MA 02446
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Boston Trinity Academy",'Brookline=' + Brookline.length); Braintree[Braintree.length] = createMarker(new GPoint(-71.00301500,42.22981400),"
Cardinal Cushing Centers
85 Washington Street
Braintree, MA 02184
Co-ed school, 3-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cardinal Cushing Centers",'Braintree=' + Braintree.length); Quincy[Quincy.length] = createMarker(new GPoint(-71.00879800,42.25606700),"
Cerebral Palsy Of Massachusett
105 Adams Street
Quincy, MA 02169
Co-ed school, Ungraded
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cerebral Palsy Of Massachusett",'Quincy=' + Quincy.length); Sharon[Sharon.length] = createMarker(new GPoint(-71.17324600,42.13213200),"
Chabad Day School Of Sharon
162 North Main Street
Sharon, MA 02067
Co-ed school, K-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Chabad Day School Of Sharon",'Sharon=' + Sharon.length); Canton[Canton.length] = createMarker(new GPoint(-71.12970000,42.17000000),"
Clark School East
1 Whitman Road, Canton
Canton, MA 02021
Co-ed school, Nursery
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Clark School East",'Canton=' + Canton.length); Wellesley[Wellesley.length] = createMarker(new GPoint(-71.28781700,42.29194300),"
Dana Hall School
45 Dana Road
Wellesley, MA 02482
All-girls school, 6-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Dana Hall School",'Wellesley=' + Wellesley.length); Brookline[Brookline.length] = createMarker(new GPoint(-71.13537400,42.30930300),"
Dexter School
20 Newton Street
Brookline, MA 02445
All-boys school, PK-11
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Dexter School",'Brookline=' + Brookline.length); Weymouth[Weymouth.length] = createMarker(new GPoint(-70.95855300,42.18830000),"
First Baptist Christian School
40 West Street
Weymouth, MA 02190
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("First Baptist Christian School",'Weymouth=' + Weymouth.length); Milton[Milton.length] = createMarker(new GPoint(-71.05998200,42.25859800),"
Fontbonne Academy
930 Brook Road
Milton, MA 02186
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fontbonne Academy",'Milton=' + Milton.length); East_Walpole[East_Walpole.length] = createMarker(new GPoint(-71.25350000,42.14480000),"
The Home For Little Wanderers/longview Farm
Po Box 166 399 Lincoln Road
East Walpole, MA 02032
All-boys school, 5-11
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("The Home For Little Wanderers/longview Farm",'East_Walpole=' + East_Walpole.length); Brookline[Brookline.length] = createMarker(new GPoint(-71.11200300,42.34749600),"
Ivy Street School
200 Ivy Street
Brookline, MA 02446
Co-ed school, 8-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ivy Street School",'Brookline=' + Brookline.length); Canton[Canton.length] = createMarker(new GPoint(-71.11281900,42.17800600),"
The Judge Rotenberg Center
240 Turnpike Street
Canton, MA 02021
Co-ed school, 2-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Judge Rotenberg Center",'Canton=' + Canton.length); Canton[Canton.length] = createMarker(new GPoint(-71.11316200,42.17914700),"
The Judge Rotenberg Ed Center Inc
240 Turnpike St.
Canton, MA 02021
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Judge Rotenberg Ed Center Inc",'Canton=' + Canton.length); Walpole[Walpole.length] = createMarker(new GPoint(-71.21520000,42.15440000),"
League School
300 Boston Providence Turnpike
Walpole, MA 02032
Co-ed school, NS-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("League School",'Walpole=' + Walpole.length); Wapole[Wapole.length] = createMarker(new GPoint(-71.21520000,42.15440000),"
League School Of Greater Boston
300 Boston Providence Tpke
Wapole, MA 02032
Co-ed school, NS-NS
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("League School Of Greater Boston",'Wapole=' + Wapole.length); Holbrook[Holbrook.length] = createMarker(new GPoint(-70.97848900,42.15372000),"
Lighthouse Baptist Christian A
Po Box 434
Holbrook, MA 02343
Co-ed school, PK-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lighthouse Baptist Christian A",'Holbrook=' + Holbrook.length); Brookline[Brookline.length] = createMarker(new GPoint(-71.13004200,42.33015500),"
Maimonides School
34 Philbrick Road
Brookline, MA 02445
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Maimonides School",'Brookline=' + Brookline.length); Braintree[Braintree.length] = createMarker(new GPoint(-70.97429400,42.18431400),"
Massasoit School Inc
Six Columbian Street
Braintree, MA 02184
Co-ed school, 2-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Massasoit School Inc",'Braintree=' + Braintree.length); Randolph[Randolph.length] = createMarker(new GPoint(-71.05054600,42.20139600),"
May Center
41 Pacella Park Drive
Randolph, MA 02368
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("May Center",'Randolph=' + Randolph.length); Milton[Milton.length] = createMarker(new GPoint(-71.07054000,42.25648000),"
Milton Academy
170 Centre Street
Milton, MA 02186
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Milton Academy",'Milton=' + Milton.length); Medfield[Medfield.length] = createMarker(new GPoint(-71.34338200,42.28438900),"
Montrose School
29 North Street
Medfield, MA 02052
All-girls school, 6-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Montrose School",'Medfield=' + Medfield.length); Brookline[Brookline.length] = createMarker(new GPoint(-71.11042400,42.34878400),"
New England Hebrew Academy
9 Prescott Street
Brookline, MA 02446
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New England Hebrew Academy",'Brookline=' + Brookline.length); Dedham[Dedham.length] = createMarker(new GPoint(-71.18403500,42.26201300),"
Noble And Greenough School
10 Campus Drive
Dedham, MA 02026
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Noble And Greenough School",'Dedham=' + Dedham.length); Brookline[Brookline.length] = createMarker(new GPoint(-71.13363200,42.31499500),"
The Park School
171 Goddard Avenue
Brookline, MA 02445
Co-ed school, PK-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Park School",'Brookline=' + Brookline.length); Braintree[Braintree.length] = createMarker(new GPoint(-70.98955900,42.22454400),"
Pilgrim Center
140 Adams
Braintree, MA 02185
All-boys school, 7-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Pilgrim Center",'Braintree=' + Braintree.length); Needham[Needham.length] = createMarker(new GPoint(-71.20567800,42.26916000),"
St. Sebastians School
1191 Greendale Avenue
Needham, MA 02492
All-boys school, 7-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("St. Sebastians School",'Needham=' + Needham.length); Weymouth[Weymouth.length] = createMarker(new GPoint(-70.96511800,42.21528100),"
South Shore Christian Academy
45 Broad Street
Weymouth, MA 02188
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("South Shore Christian Academy",'Weymouth=' + Weymouth.length); Brookline[Brookline.length] = createMarker(new GPoint(-71.13472000,42.30923600),"
Southfield School
10 Newton Street
Brookline, MA 02445
All-girls school, PK-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Southfield School",'Brookline=' + Brookline.length); Braintree[Braintree.length] = createMarker(new GPoint(-71.00397400,42.20869700),"
Thayer Academy
745 Washington Street
Braintree, MA 02184
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Thayer Academy",'Braintree=' + Braintree.length); Dedham[Dedham.length] = createMarker(new GPoint(-71.18461200,42.24486200),"
Ursuline Academy
85 Lowder Street
Dedham, MA 02026
All-girls school, 7-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ursuline Academy",'Dedham=' + Dedham.length); Sharon[Sharon.length] = createMarker(new GPoint(-71.23563600,42.11800800),"
Victory Christian Academy
1 Merchant Street
Sharon, MA 02067
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Victory Christian Academy",'Sharon=' + Sharon.length); Quincy[Quincy.length] = createMarker(new GPoint(-71.00585500,42.25484000),"
The Woodward School
1102 Hancock Street
Quincy, MA 02169
All-girls school, 6-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("The Woodward School",'Quincy=' + Quincy.length); Westwood[Westwood.length] = createMarker(new GPoint(-71.20022800,42.21542300),"
Xaverian Brothers High School
800 Clapboardtree Street
Westwood, MA 02090
All-boys school, 9-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Xaverian Brothers High School",'Westwood=' + Westwood.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(Braintree); map.removeOverlays(Brookline); map.removeOverlays(Canton); map.removeOverlays(Dedham); map.removeOverlays(East_Walpole); map.removeOverlays(Holbrook); map.removeOverlays(Mansfield); map.removeOverlays(Medfield); map.removeOverlays(Milton); map.removeOverlays(Needham); map.removeOverlays(Quincy); map.removeOverlays(Randolph); map.removeOverlays(Sharon); map.removeOverlays(Walpole); map.removeOverlays(Wapole); map.removeOverlays(Wellesley); map.removeOverlays(Westwood); map.removeOverlays(Weymouth); 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(Mansfield);map.removeOverlays(Braintree); map.removeOverlays(Brookline); map.removeOverlays(Canton); map.removeOverlays(Dedham); map.removeOverlays(East_Walpole); map.removeOverlays(Holbrook); map.removeOverlays(Mansfield); map.removeOverlays(Medfield); map.removeOverlays(Milton); map.removeOverlays(Needham); map.removeOverlays(Quincy); map.removeOverlays(Randolph); map.removeOverlays(Sharon); map.removeOverlays(Walpole); map.removeOverlays(Wapole); map.removeOverlays(Wellesley); map.removeOverlays(Westwood); map.removeOverlays(Weymouth); map.addOverlays(Braintree); centerByArray(Braintree, false, false); cntMarker += Braintree.length; map.addOverlays(Brookline); centerByArray(Brookline, false, false); cntMarker += Brookline.length; map.addOverlays(Canton); centerByArray(Canton, false, false); cntMarker += Canton.length; map.addOverlays(Dedham); centerByArray(Dedham, false, false); cntMarker += Dedham.length; map.addOverlays(East_Walpole); centerByArray(East_Walpole, false, false); cntMarker += East_Walpole.length; map.addOverlays(Holbrook); centerByArray(Holbrook, false, false); cntMarker += Holbrook.length; map.addOverlays(Mansfield); centerByArray(Mansfield, false, false); cntMarker += Mansfield.length; map.addOverlays(Medfield); centerByArray(Medfield, false, false); cntMarker += Medfield.length; map.addOverlays(Milton); centerByArray(Milton, false, false); cntMarker += Milton.length; map.addOverlays(Needham); centerByArray(Needham, false, false); cntMarker += Needham.length; map.addOverlays(Quincy); centerByArray(Quincy, false, false); cntMarker += Quincy.length; map.addOverlays(Randolph); centerByArray(Randolph, false, false); cntMarker += Randolph.length; map.addOverlays(Sharon); centerByArray(Sharon, false, false); cntMarker += Sharon.length; map.addOverlays(Walpole); centerByArray(Walpole, false, false); cntMarker += Walpole.length; map.addOverlays(Wapole); centerByArray(Wapole, false, false); cntMarker += Wapole.length; map.addOverlays(Wellesley); centerByArray(Wellesley, false, false); cntMarker += Wellesley.length; map.addOverlays(Westwood); centerByArray(Westwood, false, false); cntMarker += Westwood.length; map.addOverlays(Weymouth); centerByArray(Weymouth, false, false); cntMarker += Weymouth.length; centerByArray(Mansfield,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; }