function addMarkers(){ mySelect = document.getElementById('selection'); Brookline = [];Randolph = [];West_Springfield = [];Braintree = [];Hanover = [];West_Newton = [];Springfield = [];Arlington = [];Milford = [];Middleboro = [];Charlestown = [];East_Walpole = [];Cambridge = [];North_Chelmsford = [];Chatham = [];Worcester = [];N_Billerica = [];East_Sandwich = [];Hyannis = [];Easthampton = [];Dorchester = [];Middleton = [];mySelect.options[mySelect.options.length] = new Option("Arlington schools",'all=Arlington'); 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("Cambridge schools",'all=Cambridge'); mySelect.options[mySelect.options.length] = new Option("Charlestown schools",'all=Charlestown'); mySelect.options[mySelect.options.length] = new Option("Chatham schools",'all=Chatham'); mySelect.options[mySelect.options.length] = new Option("Dorchester schools",'all=Dorchester'); mySelect.options[mySelect.options.length] = new Option("East Sandwich schools",'all=East_Sandwich'); mySelect.options[mySelect.options.length] = new Option("East Walpole schools",'all=East_Walpole'); mySelect.options[mySelect.options.length] = new Option("Easthampton schools",'all=Easthampton'); mySelect.options[mySelect.options.length] = new Option("Hanover schools",'all=Hanover'); mySelect.options[mySelect.options.length] = new Option("Hyannis schools",'all=Hyannis'); mySelect.options[mySelect.options.length] = new Option("Middleboro schools",'all=Middleboro'); mySelect.options[mySelect.options.length] = new Option("Middleton schools",'all=Middleton'); mySelect.options[mySelect.options.length] = new Option("Milford schools",'all=Milford'); mySelect.options[mySelect.options.length] = new Option("N Billerica schools",'all=N_Billerica'); mySelect.options[mySelect.options.length] = new Option("North Chelmsford schools",'all=North_Chelmsford'); mySelect.options[mySelect.options.length] = new Option("Randolph schools",'all=Randolph'); mySelect.options[mySelect.options.length] = new Option("Springfield schools",'all=Springfield'); mySelect.options[mySelect.options.length] = new Option("West Newton schools",'all=West_Newton'); mySelect.options[mySelect.options.length] = new Option("West Springfield schools",'all=West_Springfield'); mySelect.options[mySelect.options.length] = new Option("Worcester schools",'all=Worcester'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); 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); Randolph[Randolph.length] = createMarker(new GPoint(-71.05367200,42.18313000),"
Boston Higashi School
800 North Main
Randolph, MA 02368
Co-ed school, 5-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Boston Higashi School",'Randolph=' + Randolph.length); West_Springfield[West_Springfield.length] = createMarker(new GPoint(-72.63338000,42.16047900),"
Brightside
2112 Riverdale Street
West Springfield, MA 01089
Co-ed school, 3-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Brightside",'West_Springfield=' + West_Springfield.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); Hanover[Hanover.length] = createMarker(new GPoint(-70.81952600,42.11668300),"
Cardinal Cushing Centers, Inc.
405 Washington Street
Hanover, MA 02339
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cardinal Cushing Centers, Inc.",'Hanover=' + Hanover.length); West_Newton[West_Newton.length] = createMarker(new GPoint(-71.22517100,42.34785200),"
Clearway School
61 Chestnut Street
West Newton, MA 02465
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Clearway School",'West_Newton=' + West_Newton.length); Springfield[Springfield.length] = createMarker(new GPoint(-72.55153500,42.07159500),"
Curtis Blake Day School
979 Dickinson Street
Springfield, MA 01108
Co-ed school, 1-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Curtis Blake Day School",'Springfield=' + Springfield.length); Arlington[Arlington.length] = createMarker(new GPoint(-71.14110800,42.40722400),"
Dearborn Academy
34 Winter St
Arlington, MA 02474
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Dearborn Academy",'Arlington=' + Arlington.length); Milford[Milford.length] = createMarker(new GPoint(-71.49525200,42.15812400),"
Evergreen Center
345 Fortune Blvd
Milford, MA 01757
Co-ed school, 3-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Evergreen Center",'Milford=' + Milford.length); Middleboro[Middleboro.length] = createMarker(new GPoint(-70.89460000,41.88850000),"
Fl Chamberlain School
Po Box 778 1 Pleasant Street
Middleboro, MA 02346
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fl Chamberlain School",'Middleboro=' + Middleboro.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); 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); Cambridge[Cambridge.length] = createMarker(new GPoint(-71.10457700,42.36308000),"
James F. Farr Academy
71 Pearl Street
Cambridge, MA 02139
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("James F. Farr Academy",'Cambridge=' + Cambridge.length); North_Chelmsford[North_Chelmsford.length] = createMarker(new GPoint(-71.38914200,42.64721600),"
Lighthouse School
25 Wellman Avenue
North Chelmsford, MA 01863
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lighthouse School",'North_Chelmsford=' + North_Chelmsford.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); Chatham[Chatham.length] = createMarker(new GPoint(-69.97930000,41.68500000),"
The May Center For Child Devel
P O Box 708 100 Sea View
Chatham, MA 02633
Co-ed school, Ungraded
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The May Center For Child Devel",'Chatham=' + Chatham.length); Worcester[Worcester.length] = createMarker(new GPoint(-71.82577000,42.30206300),"
Mercy Centre
25 West Chester Street
Worcester, MA 01605
Co-ed school, 3-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mercy Centre",'Worcester=' + Worcester.length); N_Billerica[N_Billerica.length] = createMarker(new GPoint(-71.29704800,42.59297100),"
New England Pediatric Care
78 Boston Rd
N Billerica, MA 01862
Co-ed school, PK-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New England Pediatric Care",'N_Billerica=' + N_Billerica.length); East_Sandwich[East_Sandwich.length] = createMarker(new GPoint(-70.43520000,41.73100000),"
Riverview School Inc
551 Route 6a
East Sandwich, MA 02537
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Riverview School Inc",'East_Sandwich=' + East_Sandwich.length); Hyannis[Hyannis.length] = createMarker(new GPoint(-70.29352100,41.68307500),"
Southeast Alternative School
270 Communication Way
Hyannis, MA 02601
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Southeast Alternative School",'Hyannis=' + Hyannis.length); Easthampton[Easthampton.length] = createMarker(new GPoint(-72.63706400,42.27814200),"
Tri-county Schools
201 East Street
Easthampton, MA 01027
Co-ed school, 3-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tri-county Schools",'Easthampton=' + Easthampton.length); Dorchester[Dorchester.length] = createMarker(new GPoint(-71.06976400,42.27438200),"
Wesley Child Care Center
1076 Washington Street
Dorchester, MA 02124
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wesley Child Care Center",'Dorchester=' + Dorchester.length); Middleton[Middleton.length] = createMarker(new GPoint(-71.01280000,42.59520000),"
Wreath School, Inc
Box 130
Middleton, MA 01949
All-boys school, Ungraded
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Wreath School, Inc",'Middleton=' + Middleton.length); map.removeOverlays(Arlington); map.removeOverlays(Braintree); map.removeOverlays(Brookline); map.removeOverlays(Cambridge); map.removeOverlays(Charlestown); map.removeOverlays(Chatham); map.removeOverlays(Dorchester); map.removeOverlays(East_Sandwich); map.removeOverlays(East_Walpole); map.removeOverlays(Easthampton); map.removeOverlays(Hanover); map.removeOverlays(Hyannis); map.removeOverlays(Middleboro); map.removeOverlays(Middleton); map.removeOverlays(Milford); map.removeOverlays(N_Billerica); map.removeOverlays(North_Chelmsford); map.removeOverlays(Randolph); map.removeOverlays(Springfield); map.removeOverlays(West_Newton); map.removeOverlays(West_Springfield); map.removeOverlays(Worcester); setTimeout(function(){map.addOverlays(Arlington)},1000); setTimeout(function(){map.addOverlays(Braintree)},1000); setTimeout(function(){map.addOverlays(Brookline)},1000); setTimeout(function(){map.addOverlays(Cambridge)},1000); setTimeout(function(){map.addOverlays(Charlestown)},1000); setTimeout(function(){map.addOverlays(Chatham)},1000); setTimeout(function(){map.addOverlays(Dorchester)},1000); setTimeout(function(){map.addOverlays(East_Sandwich)},1000); setTimeout(function(){map.addOverlays(East_Walpole)},1000); setTimeout(function(){map.addOverlays(Easthampton)},1000); setTimeout(function(){map.addOverlays(Hanover)},1000); setTimeout(function(){map.addOverlays(Hyannis)},1000); setTimeout(function(){map.addOverlays(Middleboro)},1000); setTimeout(function(){map.addOverlays(Middleton)},1000); setTimeout(function(){map.addOverlays(Milford)},1000); setTimeout(function(){map.addOverlays(N_Billerica)},1000); setTimeout(function(){map.addOverlays(North_Chelmsford)},1000); setTimeout(function(){map.addOverlays(Randolph)},1000); setTimeout(function(){map.addOverlays(Springfield)},1000); setTimeout(function(){map.addOverlays(West_Newton)},1000); setTimeout(function(){map.addOverlays(West_Springfield)},1000); setTimeout(function(){map.addOverlays(Worcester)},1000); maxLng = -69.97930000; maxLat = 42.64721600; minLng = -72.63706400; minLat = 41.68307500; 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(Arlington); map.removeOverlays(Braintree); map.removeOverlays(Brookline); map.removeOverlays(Cambridge); map.removeOverlays(Charlestown); map.removeOverlays(Chatham); map.removeOverlays(Dorchester); map.removeOverlays(East_Sandwich); map.removeOverlays(East_Walpole); map.removeOverlays(Easthampton); map.removeOverlays(Hanover); map.removeOverlays(Hyannis); map.removeOverlays(Middleboro); map.removeOverlays(Middleton); map.removeOverlays(Milford); map.removeOverlays(N_Billerica); map.removeOverlays(North_Chelmsford); map.removeOverlays(Randolph); map.removeOverlays(Springfield); map.removeOverlays(West_Newton); map.removeOverlays(West_Springfield); map.removeOverlays(Worcester); 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(Brookline);map.removeOverlays(Arlington); map.removeOverlays(Braintree); map.removeOverlays(Brookline); map.removeOverlays(Cambridge); map.removeOverlays(Charlestown); map.removeOverlays(Chatham); map.removeOverlays(Dorchester); map.removeOverlays(East_Sandwich); map.removeOverlays(East_Walpole); map.removeOverlays(Easthampton); map.removeOverlays(Hanover); map.removeOverlays(Hyannis); map.removeOverlays(Middleboro); map.removeOverlays(Middleton); map.removeOverlays(Milford); map.removeOverlays(N_Billerica); map.removeOverlays(North_Chelmsford); map.removeOverlays(Randolph); map.removeOverlays(Springfield); map.removeOverlays(West_Newton); map.removeOverlays(West_Springfield); map.removeOverlays(Worcester); map.addOverlays(Arlington); centerByArray(Arlington, false, false); cntMarker += Arlington.length; map.addOverlays(Braintree); centerByArray(Braintree, false, false); cntMarker += Braintree.length; map.addOverlays(Brookline); centerByArray(Brookline, false, false); cntMarker += Brookline.length; map.addOverlays(Cambridge); centerByArray(Cambridge, false, false); cntMarker += Cambridge.length; map.addOverlays(Charlestown); centerByArray(Charlestown, false, false); cntMarker += Charlestown.length; map.addOverlays(Chatham); centerByArray(Chatham, false, false); cntMarker += Chatham.length; map.addOverlays(Dorchester); centerByArray(Dorchester, false, false); cntMarker += Dorchester.length; map.addOverlays(East_Sandwich); centerByArray(East_Sandwich, false, false); cntMarker += East_Sandwich.length; map.addOverlays(East_Walpole); centerByArray(East_Walpole, false, false); cntMarker += East_Walpole.length; map.addOverlays(Easthampton); centerByArray(Easthampton, false, false); cntMarker += Easthampton.length; map.addOverlays(Hanover); centerByArray(Hanover, false, false); cntMarker += Hanover.length; map.addOverlays(Hyannis); centerByArray(Hyannis, false, false); cntMarker += Hyannis.length; map.addOverlays(Middleboro); centerByArray(Middleboro, false, false); cntMarker += Middleboro.length; map.addOverlays(Middleton); centerByArray(Middleton, false, false); cntMarker += Middleton.length; map.addOverlays(Milford); centerByArray(Milford, false, false); cntMarker += Milford.length; map.addOverlays(N_Billerica); centerByArray(N_Billerica, false, false); cntMarker += N_Billerica.length; map.addOverlays(North_Chelmsford); centerByArray(North_Chelmsford, false, false); cntMarker += North_Chelmsford.length; map.addOverlays(Randolph); centerByArray(Randolph, false, false); cntMarker += Randolph.length; map.addOverlays(Springfield); centerByArray(Springfield, false, false); cntMarker += Springfield.length; map.addOverlays(West_Newton); centerByArray(West_Newton, false, false); cntMarker += West_Newton.length; map.addOverlays(West_Springfield); centerByArray(West_Springfield, false, false); cntMarker += West_Springfield.length; map.addOverlays(Worcester); centerByArray(Worcester, false, false); cntMarker += Worcester.length; centerByArray(Brookline,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///13000,12933,12907,13091,13060,13484,13257,13475,13505,12953,12951,13031,13535,13019,13196,13119,13143,12975,12936,13152,13000,12933,13484,13704,13257,13475,13505,12953,13535,13019,13196,13119,12931,13143,12995,12936,13152,/all'); //window.open('/map.php?type=2&schools=13000,12933,12907,13091,13060,13484,13257,13475,13505,12953,12951,13031,13535,13019,13196,13119,13143,12975,12936,13152,13000,12933,13484,13704,13257,13475,13505,12953,13535,13019,13196,13119,12931,13143,12995,12936,13152,&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; }