function addMarkers(){ mySelect = document.getElementById('selection'); Amherst = [];Andover = [];Arlington = [];Avon = [];Attleboro = [];Ashburnham = [];Amesbury = [];Acushnet = [];Ashland = [];Athol = [];Auburn = [];Allston = [];Abington = [];Ashby = [];Adams = [];Acton = [];mySelect.options[mySelect.options.length] = new Option("Abington schools",'all=Abington'); mySelect.options[mySelect.options.length] = new Option("Acton schools",'all=Acton'); mySelect.options[mySelect.options.length] = new Option("Acushnet schools",'all=Acushnet'); mySelect.options[mySelect.options.length] = new Option("Adams schools",'all=Adams'); mySelect.options[mySelect.options.length] = new Option("Allston schools",'all=Allston'); mySelect.options[mySelect.options.length] = new Option("Amesbury schools",'all=Amesbury'); mySelect.options[mySelect.options.length] = new Option("Amherst schools",'all=Amherst'); mySelect.options[mySelect.options.length] = new Option("Andover schools",'all=Andover'); mySelect.options[mySelect.options.length] = new Option("Arlington schools",'all=Arlington'); mySelect.options[mySelect.options.length] = new Option("Ashburnham schools",'all=Ashburnham'); mySelect.options[mySelect.options.length] = new Option("Ashby schools",'all=Ashby'); mySelect.options[mySelect.options.length] = new Option("Ashland schools",'all=Ashland'); mySelect.options[mySelect.options.length] = new Option("Athol schools",'all=Athol'); mySelect.options[mySelect.options.length] = new Option("Attleboro schools",'all=Attleboro'); mySelect.options[mySelect.options.length] = new Option("Auburn schools",'all=Auburn'); mySelect.options[mySelect.options.length] = new Option("Avon schools",'all=Avon'); Amherst[Amherst.length] = createMarker(new GPoint(-72.51873100,42.33989000),"
Amherst Montessori School
27 Pomeroy Lane
Amherst, MA 01002
Co-ed school, PK-4
[ View School Profile ]
",iconGr); Andover[Andover.length] = createMarker(new GPoint(-71.12565800,42.62192800),"
Andover School Of Montessori
400 S Main St
Andover, MA 01810
Co-ed school, PK-8
[ View School Profile ]
",iconGr); Arlington[Arlington.length] = createMarker(new GPoint(-71.15079700,42.41529400),"
Arlington Catholic High School
16 Medford Street
Arlington, MA 02474
Co-ed school, 9-12
[ View School Profile ]
",iconGr); Arlington[Arlington.length] = createMarker(new GPoint(-71.15874800,42.41202100),"
Arlington Children's Center Inc
17 Irving Street
Arlington, MA 02476
Co-ed school, NS-K
[ View School Profile ]
",iconGr); Avon[Avon.length] = createMarker(new GPoint(-71.05049700,42.12721500),"
Avon Childrens Center
152 Highland Street
Avon, MA 02322
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); Attleboro[Attleboro.length] = createMarker(new GPoint(-71.29283700,41.96583800),"
Bishop Feehan High School
70 Holcott Drive
Attleboro, MA 02703
Co-ed school, 9-12
[ View School Profile ]
",iconGr); Attleboro[Attleboro.length] = createMarker(new GPoint(-71.28503200,41.93572600),"
Busy Bees Learning Center Inc
209 South Main Street
Attleboro, MA 02703
Co-ed school, PK-K
[ View School Profile ]
",iconGr); Arlington[Arlington.length] = createMarker(new GPoint(-71.18224400,42.42642800),"
Covenant School
9 Westminster Avenue
Arlington, MA 02474
Co-ed school, K-8
[ View School Profile ]
",iconGr); Ashburnham[Ashburnham.length] = createMarker(new GPoint(-71.90835400,42.63580000),"
Cushing Academy
PO Box 8000, 39 School Street
Ashburnham, MA 01430
Co-ed school, 9-12
[ View School Profile ]
",iconGr); 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); Arlington[Arlington.length] = createMarker(new GPoint(-71.18560200,42.42167400),"
Germaine Lawrence
18 Claremont Avenue
Arlington, MA 02476
All-girls school, 6-12
[ View School Profile ]
",iconRd); Attleboro[Attleboro.length] = createMarker(new GPoint(-71.26334200,41.91209600),"
Grace Baptist Christian Academy
1000 Oakhill Avenue
Attleboro, MA 02703
Co-ed school, PK-12
[ View School Profile ]
",iconGr); 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); Andover[Andover.length] = createMarker(new GPoint(-71.18254300,42.64892600),"
The Kathy Herwood Child Care Center Inc
310 Lowell Street Stop 237
Andover, MA 01810
Co-ed school, PK-K
[ View School Profile ]
",iconGr); 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); Attleboro[Attleboro.length] = createMarker(new GPoint(-71.29102700,41.96775400),"
Little Blessings Preschool
841 N Main Street
Attleboro, MA 02703
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); Acushnet[Acushnet.length] = createMarker(new GPoint(-70.89377000,41.73725700),"
Long Plain Christian Nursery School
10 Robinson Road
Acushnet, MA 02743
school, PK-K
[ View School Profile ]
",iconGr); Ashland[Ashland.length] = createMarker(new GPoint(-71.43085700,42.24521900),"
MetroWest Christian Academy
PO Box 229
Ashland, MA 01721
Co-ed school, PK-5
[ View School Profile ]
",iconGr); Athol[Athol.length] = createMarker(new GPoint(-72.24270700,42.59035700),"
Miller's River Academy
250 S Main Street
Athol, MA 01331
All-boys school, 9-12
[ View School Profile ]
",iconBl); Auburn[Auburn.length] = createMarker(new GPoint(-71.84634700,42.20478600),"
Montessori Childrens House Of Auburn
135 Bryn Mawr Avenue
Auburn, MA 01501
Co-ed school, PK-K
[ View School Profile ]
",iconGr); 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); Ashland[Ashland.length] = createMarker(new GPoint(-71.43260300,42.23950300),"
Mulberry Child Care & Preschool
367 Pond Street
Ashland, MA 01721
Co-ed school, PK-K
[ View School Profile ]
",iconGr); Ashland[Ashland.length] = createMarker(new GPoint(-71.46120000,42.25540000),"
New Convenant Christian
Po Box 432
Ashland, MA 01121
Co-ed school, KG-8
[ View School Profile ]
",iconGr); Andover[Andover.length] = createMarker(new GPoint(-71.12254300,42.60766800),"
Next Generation Childrens Center
516 S Main Street
Andover, MA 01810
Co-ed school, PK-K
[ View School Profile ]
",iconGr); Andover[Andover.length] = createMarker(new GPoint(-71.13486800,42.64848600),"
Phillips Academy Andover
180 Main Street
Andover, MA 01810
Co-ed school, 9-12
[ View School Profile ]
",iconGr); Andover[Andover.length] = createMarker(new GPoint(-71.13504600,42.63190000),"
The Pike School
34 Sunset Rock Road
Andover, MA 01810
Co-ed school, PK-9
[ View School Profile ]
",iconGr); Ashland[Ashland.length] = createMarker(new GPoint(-71.45214000,42.26974400),"
Pincushion Hill Montessori School
30 Green Street
Ashland, MA 01721
Co-ed school, PK-5
[ View School Profile ]
",iconGr); Abington[Abington.length] = createMarker(new GPoint(-70.97440100,42.13498000),"
Preschool Playmates
Po Box 64
Abington, MA 02351
Co-ed school, PK-K
[ View School Profile ]
",iconGr); Avon[Avon.length] = createMarker(new GPoint(-71.03580600,42.12517800),"
Puddle Jumpers Preschool
227 East Main St.
Avon, MA 02322
Co-ed school, PK-2
[ View School Profile ]
",iconGr); Arlington[Arlington.length] = createMarker(new GPoint(-71.14957700,42.41587600),"
St. Agnes School
39 Medford Street
Arlington, MA 02474
Co-ed school, K-8
[ View School Profile ]
",iconGr); Allston[Allston.length] = createMarker(new GPoint(-71.13630000,42.36027100),"
St. Anthony Elementary School
57 Holton Street
Allston, MA 02134
Co-ed school, PK-8
[ View School Profile ]
",iconGr); Andover[Andover.length] = createMarker(new GPoint(-71.14169400,42.65501100),"
St. Augustine Elementary School
26 Central Street
Andover, MA 01810
Co-ed school, PK-8
[ View School Profile ]
",iconGr); Abington[Abington.length] = createMarker(new GPoint(-70.93661600,42.11635100),"
St. Bridget School
455 Plymouth Street
Abington, MA 02351
Co-ed school, PK-8
[ View School Profile ]
",iconGr); Acushnet[Acushnet.length] = createMarker(new GPoint(-70.90602500,41.68721100),"
St. Francis Xavier Elementary School
223 Main Street
Acushnet, MA 02743
Co-ed school, PK-8
[ View School Profile ]
",iconGr); Ashby[Ashby.length] = createMarker(new GPoint(-71.84873500,42.66480300),"
Shackleton Schools
250 Spring Hill Road
Ashby, MA 01431
All-girls school, 9-12
[ View School Profile ]
",iconRd); Amesbury[Amesbury.length] = createMarker(new GPoint(-70.91064300,42.84996300),"
Sparhawk School
259 Elm Street
Amesbury, MA 01913
Co-ed school, PK-12
[ View School Profile ]
",iconGr); Allston[Allston.length] = createMarker(new GPoint(-71.13217400,42.35400000),"
Sr. Herman Of Alaska Christian
64 Harvard Ave
Allston, MA 02134
Co-ed school, PK-8
[ View School Profile ]
",iconGr); Attleboro[Attleboro.length] = createMarker(new GPoint(-71.28961800,41.94655100),"
St John The Evangelist School
13 Hodges Street
Attleboro, MA 02703
Co-ed school, K-8
[ View School Profile ]
",iconGr); Adams[Adams.length] = createMarker(new GPoint(-73.11417700,42.62496300),"
St Stanislaus Kostka School
108 Summer Street
Adams, MA 01220
Co-ed school, PK-8
[ View School Profile ]
",iconGr); Acton[Acton.length] = createMarker(new GPoint(-71.44929100,42.47419800),"
The Victor School
380 Massachusetts Avenue
Acton, MA 01720
Co-ed school, 8-12
[ View School Profile ]
",iconGr); Amesbury[Amesbury.length] = createMarker(new GPoint(-70.93530000,42.85340000),"
Windmill Country Day School
Po Box 141
Amesbury, MA 01913
Co-ed school, PK-K
[ View School Profile ]
",iconGr); } // 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(Abington); map.removeOverlays(Acton); map.removeOverlays(Acushnet); map.removeOverlays(Adams); map.removeOverlays(Allston); map.removeOverlays(Amesbury); map.removeOverlays(Amherst); map.removeOverlays(Andover); map.removeOverlays(Arlington); map.removeOverlays(Ashburnham); map.removeOverlays(Ashby); map.removeOverlays(Ashland); map.removeOverlays(Athol); map.removeOverlays(Attleboro); map.removeOverlays(Auburn); map.removeOverlays(Avon); 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(Amherst);map.removeOverlays(Abington); map.removeOverlays(Acton); map.removeOverlays(Acushnet); map.removeOverlays(Adams); map.removeOverlays(Allston); map.removeOverlays(Amesbury); map.removeOverlays(Amherst); map.removeOverlays(Andover); map.removeOverlays(Arlington); map.removeOverlays(Ashburnham); map.removeOverlays(Ashby); map.removeOverlays(Ashland); map.removeOverlays(Athol); map.removeOverlays(Attleboro); map.removeOverlays(Auburn); map.removeOverlays(Avon); map.addOverlays(Abington); centerByArray(Abington, false, false); cntMarker += Abington.length; map.addOverlays(Acton); centerByArray(Acton, false, false); cntMarker += Acton.length; map.addOverlays(Acushnet); centerByArray(Acushnet, false, false); cntMarker += Acushnet.length; map.addOverlays(Adams); centerByArray(Adams, false, false); cntMarker += Adams.length; map.addOverlays(Allston); centerByArray(Allston, false, false); cntMarker += Allston.length; map.addOverlays(Amesbury); centerByArray(Amesbury, false, false); cntMarker += Amesbury.length; map.addOverlays(Amherst); centerByArray(Amherst, false, false); cntMarker += Amherst.length; map.addOverlays(Andover); centerByArray(Andover, false, false); cntMarker += Andover.length; map.addOverlays(Arlington); centerByArray(Arlington, false, false); cntMarker += Arlington.length; map.addOverlays(Ashburnham); centerByArray(Ashburnham, false, false); cntMarker += Ashburnham.length; map.addOverlays(Ashby); centerByArray(Ashby, false, false); cntMarker += Ashby.length; map.addOverlays(Ashland); centerByArray(Ashland, false, false); cntMarker += Ashland.length; map.addOverlays(Athol); centerByArray(Athol, false, false); cntMarker += Athol.length; map.addOverlays(Attleboro); centerByArray(Attleboro, false, false); cntMarker += Attleboro.length; map.addOverlays(Auburn); centerByArray(Auburn, false, false); cntMarker += Auburn.length; map.addOverlays(Avon); centerByArray(Avon, false, false); cntMarker += Avon.length; centerByArray(Amherst,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=&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; }