function addMarkers(){ mySelect = document.getElementById('selection'); Charlemont = [];Tyngsboro = [];Fitchburg = [];Sheffield = [];Boston = [];North_Andover = [];Williamstown = [];Braintree = [];Lincoln = [];Waltham = [];Concord = [];Dedham = [];Natick = [];Lancaster = [];Byfield = [];Amesbury = [];Marlborough = [];Watertown = [];Wapole = [];Arlington = [];Salem = [];Weston = [];Foxboro = [];Roslindale = [];Danvers = [];Barnstable = [];Wilbraham = [];mySelect.options[mySelect.options.length] = new Option("Amesbury schools",'all=Amesbury'); mySelect.options[mySelect.options.length] = new Option("Arlington schools",'all=Arlington'); mySelect.options[mySelect.options.length] = new Option("Barnstable schools",'all=Barnstable'); mySelect.options[mySelect.options.length] = new Option("Boston schools",'all=Boston'); mySelect.options[mySelect.options.length] = new Option("Braintree schools",'all=Braintree'); mySelect.options[mySelect.options.length] = new Option("Byfield schools",'all=Byfield'); mySelect.options[mySelect.options.length] = new Option("Charlemont schools",'all=Charlemont'); mySelect.options[mySelect.options.length] = new Option("Concord schools",'all=Concord'); mySelect.options[mySelect.options.length] = new Option("Danvers schools",'all=Danvers'); mySelect.options[mySelect.options.length] = new Option("Dedham schools",'all=Dedham'); mySelect.options[mySelect.options.length] = new Option("Fitchburg schools",'all=Fitchburg'); mySelect.options[mySelect.options.length] = new Option("Foxboro schools",'all=Foxboro'); mySelect.options[mySelect.options.length] = new Option("Lancaster schools",'all=Lancaster'); mySelect.options[mySelect.options.length] = new Option("Lincoln schools",'all=Lincoln'); mySelect.options[mySelect.options.length] = new Option("Marlborough schools",'all=Marlborough'); mySelect.options[mySelect.options.length] = new Option("Natick schools",'all=Natick'); mySelect.options[mySelect.options.length] = new Option("North Andover schools",'all=North_Andover'); mySelect.options[mySelect.options.length] = new Option("Roslindale schools",'all=Roslindale'); mySelect.options[mySelect.options.length] = new Option("Salem schools",'all=Salem'); mySelect.options[mySelect.options.length] = new Option("Sheffield schools",'all=Sheffield'); mySelect.options[mySelect.options.length] = new Option("Tyngsboro schools",'all=Tyngsboro'); mySelect.options[mySelect.options.length] = new Option("Waltham schools",'all=Waltham'); mySelect.options[mySelect.options.length] = new Option("Wapole schools",'all=Wapole'); mySelect.options[mySelect.options.length] = new Option("Watertown schools",'all=Watertown'); mySelect.options[mySelect.options.length] = new Option("Weston schools",'all=Weston'); mySelect.options[mySelect.options.length] = new Option("Wilbraham schools",'all=Wilbraham'); mySelect.options[mySelect.options.length] = new Option("Williamstown schools",'all=Williamstown'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Charlemont[Charlemont.length] = createMarker(new GPoint(-72.82645700,42.61862000),"
The Academy At Charlemont
1359 Route 2 The Mohawk Trail
Charlemont, MA 01339
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Academy At Charlemont",'Charlemont=' + Charlemont.length); Tyngsboro[Tyngsboro.length] = createMarker(new GPoint(-71.42179400,42.67242000),"
Academy Of Notre Dame High School
180 Middlesex Road
Tyngsboro, MA 01879
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Academy Of Notre Dame High School",'Tyngsboro=' + Tyngsboro.length); Fitchburg[Fitchburg.length] = createMarker(new GPoint(-71.80739900,42.59178400),"
Applewild School
120 Prospect St
Fitchburg, MA 01420
Co-ed school, K-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Applewild School",'Fitchburg=' + Fitchburg.length); Sheffield[Sheffield.length] = createMarker(new GPoint(-73.40824800,42.11578700),"
Berkshire School
245 N. Undermountain Rd.
Sheffield, MA 01257
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Berkshire School",'Sheffield=' + Sheffield.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); North_Andover[North_Andover.length] = createMarker(new GPoint(-71.08288000,42.70741800),"
Brooks School
1160 Great Pond Road
North Andover, MA 01845
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Brooks School",'North_Andover=' + North_Andover.length); Williamstown[Williamstown.length] = createMarker(new GPoint(-73.21329100,42.70462800),"
Buxton School
291 South Street
Williamstown, MA 01267
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Buxton School",'Williamstown=' + Williamstown.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); Lincoln[Lincoln.length] = createMarker(new GPoint(-71.31942200,42.42739900),"
The Carroll School
25 Baker Bridge Road
Lincoln, MA 01773
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Carroll School",'Lincoln=' + Lincoln.length); Waltham[Waltham.length] = createMarker(new GPoint(-71.23410300,42.38601600),"
Chapel Hill Chauncy Hall School
785 Beaver Street
Waltham, MA 02452
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Chapel Hill Chauncy Hall School",'Waltham=' + Waltham.length); Concord[Concord.length] = createMarker(new GPoint(-71.35420100,42.45927200),"
Concord Academy
166 Main Street
Concord, MA 01742
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Concord Academy",'Concord=' + Concord.length); Dedham[Dedham.length] = createMarker(new GPoint(-71.18685500,42.23917600),"
Dedham Country Day School
90 Sandy Valley Road
Dedham, MA 02026
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Dedham Country Day School",'Dedham=' + Dedham.length); Natick[Natick.length] = createMarker(new GPoint(-71.31415000,42.27415000),"
The Eliot Montessori School
6 Auburn Street
Natick, MA 01760
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Eliot Montessori School",'Natick=' + Natick.length); Concord[Concord.length] = createMarker(new GPoint(-71.35052000,42.47462100),"
The Fenn School
516 Monument Street
Concord, MA 01742
All-boys school, 4-9
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("The Fenn School",'Concord=' + Concord.length); Lancaster[Lancaster.length] = createMarker(new GPoint(-71.67380400,42.46186700),"
Franklin Perkins School
971 Main St
Lancaster, MA 01523
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Franklin Perkins School",'Lancaster=' + Lancaster.length); Byfield[Byfield.length] = createMarker(new GPoint(-70.89574900,42.75081000),"
The Governor's Academy
1 Elm
Byfield, MA 01922
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Governor's Academy",'Byfield=' + Byfield.length); Amesbury[Amesbury.length] = createMarker(new GPoint(-70.93540000,42.85380000),"
Harbor Schools Family Servies
194 R Main Street
Amesbury, MA 01913
Co-ed school, Ungraded
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Harbor Schools Family Servies",'Amesbury=' + Amesbury.length); Marlborough[Marlborough.length] = createMarker(new GPoint(-71.54799100,42.34680600),"
Hillside School
Robin Hill Road
Marlborough, MA 01752
All-boys school, 5-9
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Hillside School",'Marlborough=' + Marlborough.length); Watertown[Watertown.length] = createMarker(new GPoint(-71.19137000,42.38077900),"
The Home For Little Wandekrs-o
917 Belmont Street
Watertown, MA 02472
Co-ed school, 11-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Home For Little Wandekrs-o",'Watertown=' + Watertown.length); Boston[Boston.length] = createMarker(new GPoint(-71.08230300,42.35034700),"
Kingsley Montessori School
30 Fairfield Street Early Childhood 26 Exeter Street El
Boston, MA 02116
Co-ed school, NS-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kingsley Montessori School",'Boston=' + Boston.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); Arlington[Arlington.length] = createMarker(new GPoint(-71.14556200,42.41055800),"
Lesley Ellis School
41 Foster St
Arlington, MA 02474
Co-ed school, NS-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lesley Ellis School",'Arlington=' + Arlington.length); Salem[Salem.length] = createMarker(new GPoint(-70.89633300,42.51711300),"
The Phoenix School
89 Margin Street
Salem, MA 01970
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Phoenix School",'Salem=' + Salem.length); Weston[Weston.length] = createMarker(new GPoint(-99.19999700,19.46670000),"
The Rivers School
333 Winter St
Weston, MA 02193
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Rivers School",'Weston=' + Weston.length); Foxboro[Foxboro.length] = createMarker(new GPoint(-71.23190500,42.08111900),"
The Sage School
171 Mechanic Street
Foxboro, MA 02035
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Sage School",'Foxboro=' + Foxboro.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); Danvers[Danvers.length] = createMarker(new GPoint(-70.95355600,42.58197700),"
St. John's Preparatory School
72 Spring Street
Danvers, MA 01923
All-boys school, 9-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("St. John's Preparatory School",'Danvers=' + Danvers.length); Barnstable[Barnstable.length] = createMarker(new GPoint(-70.28112000,41.68533100),"
Trinity Christian Academy
979 Mary Dunn Road
Barnstable, MA 02630
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Trinity Christian Academy",'Barnstable=' + Barnstable.length); Wilbraham[Wilbraham.length] = createMarker(new GPoint(-72.43129700,42.12520700),"
Wilbraham And Monson Academy
423 Main Street
Wilbraham, MA 01095
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wilbraham And Monson Academy",'Wilbraham=' + Wilbraham.length); map.removeOverlays(Amesbury); map.removeOverlays(Arlington); map.removeOverlays(Barnstable); map.removeOverlays(Boston); map.removeOverlays(Braintree); map.removeOverlays(Byfield); map.removeOverlays(Charlemont); map.removeOverlays(Concord); map.removeOverlays(Danvers); map.removeOverlays(Dedham); map.removeOverlays(Fitchburg); map.removeOverlays(Foxboro); map.removeOverlays(Lancaster); map.removeOverlays(Lincoln); map.removeOverlays(Marlborough); map.removeOverlays(Natick); map.removeOverlays(North_Andover); map.removeOverlays(Roslindale); map.removeOverlays(Salem); map.removeOverlays(Sheffield); map.removeOverlays(Tyngsboro); map.removeOverlays(Waltham); map.removeOverlays(Wapole); map.removeOverlays(Watertown); map.removeOverlays(Weston); map.removeOverlays(Wilbraham); map.removeOverlays(Williamstown); setTimeout(function(){map.addOverlays(Amesbury)},1000); setTimeout(function(){map.addOverlays(Arlington)},1000); setTimeout(function(){map.addOverlays(Barnstable)},1000); setTimeout(function(){map.addOverlays(Boston)},1000); setTimeout(function(){map.addOverlays(Braintree)},1000); setTimeout(function(){map.addOverlays(Byfield)},1000); setTimeout(function(){map.addOverlays(Charlemont)},1000); setTimeout(function(){map.addOverlays(Concord)},1000); setTimeout(function(){map.addOverlays(Danvers)},1000); setTimeout(function(){map.addOverlays(Dedham)},1000); setTimeout(function(){map.addOverlays(Fitchburg)},1000); setTimeout(function(){map.addOverlays(Foxboro)},1000); setTimeout(function(){map.addOverlays(Lancaster)},1000); setTimeout(function(){map.addOverlays(Lincoln)},1000); setTimeout(function(){map.addOverlays(Marlborough)},1000); setTimeout(function(){map.addOverlays(Natick)},1000); setTimeout(function(){map.addOverlays(North_Andover)},1000); setTimeout(function(){map.addOverlays(Roslindale)},1000); setTimeout(function(){map.addOverlays(Salem)},1000); setTimeout(function(){map.addOverlays(Sheffield)},1000); setTimeout(function(){map.addOverlays(Tyngsboro)},1000); setTimeout(function(){map.addOverlays(Waltham)},1000); setTimeout(function(){map.addOverlays(Wapole)},1000); setTimeout(function(){map.addOverlays(Watertown)},1000); setTimeout(function(){map.addOverlays(Weston)},1000); setTimeout(function(){map.addOverlays(Wilbraham)},1000); setTimeout(function(){map.addOverlays(Williamstown)},1000); maxLng = -70.28112000; maxLat = 42.85380000; minLng = -99.19999700; minLat = 19.46670000; reCenterMap(); } // 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//////' + showArray); map.removeOverlays(Amesbury); map.removeOverlays(Arlington); map.removeOverlays(Barnstable); map.removeOverlays(Boston); map.removeOverlays(Braintree); map.removeOverlays(Byfield); map.removeOverlays(Charlemont); map.removeOverlays(Concord); map.removeOverlays(Danvers); map.removeOverlays(Dedham); map.removeOverlays(Fitchburg); map.removeOverlays(Foxboro); map.removeOverlays(Lancaster); map.removeOverlays(Lincoln); map.removeOverlays(Marlborough); map.removeOverlays(Natick); map.removeOverlays(North_Andover); map.removeOverlays(Roslindale); map.removeOverlays(Salem); map.removeOverlays(Sheffield); map.removeOverlays(Tyngsboro); map.removeOverlays(Waltham); map.removeOverlays(Wapole); map.removeOverlays(Watertown); map.removeOverlays(Weston); map.removeOverlays(Wilbraham); map.removeOverlays(Williamstown); 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(Charlemont);map.removeOverlays(Amesbury); map.removeOverlays(Arlington); map.removeOverlays(Barnstable); map.removeOverlays(Boston); map.removeOverlays(Braintree); map.removeOverlays(Byfield); map.removeOverlays(Charlemont); map.removeOverlays(Concord); map.removeOverlays(Danvers); map.removeOverlays(Dedham); map.removeOverlays(Fitchburg); map.removeOverlays(Foxboro); map.removeOverlays(Lancaster); map.removeOverlays(Lincoln); map.removeOverlays(Marlborough); map.removeOverlays(Natick); map.removeOverlays(North_Andover); map.removeOverlays(Roslindale); map.removeOverlays(Salem); map.removeOverlays(Sheffield); map.removeOverlays(Tyngsboro); map.removeOverlays(Waltham); map.removeOverlays(Wapole); map.removeOverlays(Watertown); map.removeOverlays(Weston); map.removeOverlays(Wilbraham); map.removeOverlays(Williamstown); map.addOverlays(Amesbury); centerByArray(Amesbury, false, false); cntMarker += Amesbury.length; map.addOverlays(Arlington); centerByArray(Arlington, false, false); cntMarker += Arlington.length; map.addOverlays(Barnstable); centerByArray(Barnstable, false, false); cntMarker += Barnstable.length; map.addOverlays(Boston); centerByArray(Boston, false, false); cntMarker += Boston.length; map.addOverlays(Braintree); centerByArray(Braintree, false, false); cntMarker += Braintree.length; map.addOverlays(Byfield); centerByArray(Byfield, false, false); cntMarker += Byfield.length; map.addOverlays(Charlemont); centerByArray(Charlemont, false, false); cntMarker += Charlemont.length; map.addOverlays(Concord); centerByArray(Concord, false, false); cntMarker += Concord.length; map.addOverlays(Danvers); centerByArray(Danvers, false, false); cntMarker += Danvers.length; map.addOverlays(Dedham); centerByArray(Dedham, false, false); cntMarker += Dedham.length; map.addOverlays(Fitchburg); centerByArray(Fitchburg, false, false); cntMarker += Fitchburg.length; map.addOverlays(Foxboro); centerByArray(Foxboro, false, false); cntMarker += Foxboro.length; map.addOverlays(Lancaster); centerByArray(Lancaster, false, false); cntMarker += Lancaster.length; map.addOverlays(Lincoln); centerByArray(Lincoln, false, false); cntMarker += Lincoln.length; map.addOverlays(Marlborough); centerByArray(Marlborough, false, false); cntMarker += Marlborough.length; map.addOverlays(Natick); centerByArray(Natick, false, false); cntMarker += Natick.length; map.addOverlays(North_Andover); centerByArray(North_Andover, false, false); cntMarker += North_Andover.length; map.addOverlays(Roslindale); centerByArray(Roslindale, false, false); cntMarker += Roslindale.length; map.addOverlays(Salem); centerByArray(Salem, false, false); cntMarker += Salem.length; map.addOverlays(Sheffield); centerByArray(Sheffield, false, false); cntMarker += Sheffield.length; map.addOverlays(Tyngsboro); centerByArray(Tyngsboro, false, false); cntMarker += Tyngsboro.length; map.addOverlays(Waltham); centerByArray(Waltham, false, false); cntMarker += Waltham.length; map.addOverlays(Wapole); centerByArray(Wapole, false, false); cntMarker += Wapole.length; map.addOverlays(Watertown); centerByArray(Watertown, false, false); cntMarker += Watertown.length; map.addOverlays(Weston); centerByArray(Weston, false, false); cntMarker += Weston.length; map.addOverlays(Wilbraham); centerByArray(Wilbraham, false, false); cntMarker += Wilbraham.length; map.addOverlays(Williamstown); centerByArray(Williamstown, false, false); cntMarker += Williamstown.length; centerByArray(Charlemont,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///13048,13508,30435,12933,13042,12876,12981,13471,13363,12892,13034,13462,13058,12940,13339,12917,12880,12963,13113,13195,13491,13528,12944,13048,13115,13508,13104,12933,13471,13001,12892,13492,13034,13462,13058,13468,30418,13113,13528,/all'); //window.open('/map.php?type=2&schools=13048,13508,30435,12933,13042,12876,12981,13471,13363,12892,13034,13462,13058,12940,13339,12917,12880,12963,13113,13195,13491,13528,12944,13048,13115,13508,13104,12933,13471,13001,12892,13492,13034,13462,13058,13468,30418,13113,13528,&school_level=&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; }