function addMarkers(){ mySelect = document.getElementById('selection'); Woonsocket = [];Pawtucket = [];Providence = [];Cranston = [];North_Providence = [];Smithfield = [];East_Providence = [];Riverside = [];Lincoln = [];Johnston = [];mySelect.options[mySelect.options.length] = new Option("Cranston schools",'all=Cranston'); mySelect.options[mySelect.options.length] = new Option("East Providence schools",'all=East_Providence'); mySelect.options[mySelect.options.length] = new Option("Johnston schools",'all=Johnston'); mySelect.options[mySelect.options.length] = new Option("Lincoln schools",'all=Lincoln'); mySelect.options[mySelect.options.length] = new Option("North Providence schools",'all=North_Providence'); mySelect.options[mySelect.options.length] = new Option("Pawtucket schools",'all=Pawtucket'); mySelect.options[mySelect.options.length] = new Option("Providence schools",'all=Providence'); mySelect.options[mySelect.options.length] = new Option("Riverside schools",'all=Riverside'); mySelect.options[mySelect.options.length] = new Option("Smithfield schools",'all=Smithfield'); mySelect.options[mySelect.options.length] = new Option("Woonsocket schools",'all=Woonsocket'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Woonsocket[Woonsocket.length] = createMarker(new GPoint(-71.52097800,41.98663700),"
The Arc Of Northern R I
80 Fabien Street
Woonsocket, RI 02895
Co-ed school, Ungraded
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Arc Of Northern R I",'Woonsocket=' + Woonsocket.length); Pawtucket[Pawtucket.length] = createMarker(new GPoint(-71.41354700,41.86465600),"
Bishop Francis P Keough High School
145 Power Road
Pawtucket, RI 02860
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bishop Francis P Keough High School",'Pawtucket=' + Pawtucket.length); Providence[Providence.length] = createMarker(new GPoint(-71.44210800,41.81638500),"
Center For Individualized Training & Educ
15 Bough Street
Providence, RI 02909
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Center For Individualized Training & Educ",'Providence=' + Providence.length); Cranston[Cranston.length] = createMarker(new GPoint(-71.42223900,41.79071500),"
Elmwood Community School
801 Elmwood Avenue
Cranston, RI 02907
Co-ed school, 8-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Elmwood Community School",'Cranston=' + Cranston.length); Providence[Providence.length] = createMarker(new GPoint(-71.39699400,41.82172900),"
French-american School Of Ri
75 John St
Providence, RI 02906
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("French-american School Of Ri",'Providence=' + Providence.length); North_Providence[North_Providence.length] = createMarker(new GPoint(-71.46484000,41.84965900),"
George N Hunt Campus School
420 Fruit Hill Avenue
North Providence, RI 02911
Co-ed school, 2-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("George N Hunt Campus School",'North_Providence=' + North_Providence.length); Providence[Providence.length] = createMarker(new GPoint(-71.39994300,41.84053700),"
The Groden Center Inc
86 Mount Hope Avenue
Providence, RI 02906
Co-ed school, NS-NS
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Groden Center Inc",'Providence=' + Providence.length); Woonsocket[Woonsocket.length] = createMarker(new GPoint(-71.48467800,42.00342500),"
Hillside Alternative Program
115 Ricard Street
Woonsocket, RI 02895
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hillside Alternative Program",'Woonsocket=' + Woonsocket.length); Providence[Providence.length] = createMarker(new GPoint(-71.44532600,41.84162400),"
La Salle Academy
612 Academy Avenue
Providence, RI 02908
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("La Salle Academy",'Providence=' + Providence.length); Providence[Providence.length] = createMarker(new GPoint(-71.38382400,41.83255700),"
Lincoln School
301 Butler Avenue
Providence, RI 02906
All-girls school, PK-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln School",'Providence=' + Providence.length); Smithfield[Smithfield.length] = createMarker(new GPoint(-71.51646500,41.91316000),"
Masters Regional Academy
915 Douglas Pike
Smithfield, RI 02917
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Masters Regional Academy",'Smithfield=' + Smithfield.length); East_Providence[East_Providence.length] = createMarker(new GPoint(-71.35589500,41.81580100),"
Meeting Street School
667 Waterman Ave
East Providence, RI 02914
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Meeting Street School",'East_Providence=' + East_Providence.length); Providence[Providence.length] = createMarker(new GPoint(-71.39741800,41.83250700),"
Moses Brown School
250 Lloyd Ave
Providence, RI 02906
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Moses Brown School",'Providence=' + Providence.length); Woonsocket[Woonsocket.length] = createMarker(new GPoint(-71.50097900,41.99465200),"
Mount St Charles Academy
800 Logee Street
Woonsocket, RI 02895
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mount St Charles Academy",'Woonsocket=' + Woonsocket.length); Providence[Providence.length] = createMarker(new GPoint(-71.39450000,41.83730000),"
Nafi Alternatives
Butler Campus 350 Duncan Dr
Providence, RI 02906
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Nafi Alternatives",'Providence=' + Providence.length); Providence[Providence.length] = createMarker(new GPoint(-71.39927000,41.84084700),"
The Providence Center School
520 Hope Street
Providence, RI 02906
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Providence Center School",'Providence=' + Providence.length); East_Providence[East_Providence.length] = createMarker(new GPoint(-71.35586000,41.81611100),"
Providence Country Day School
660 Waterman Avenue
East Providence, RI 02914
Co-ed school, 5-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Providence Country Day School",'East_Providence=' + East_Providence.length); Riverside[Riverside.length] = createMarker(new GPoint(-71.36515700,41.79098200),"
St. Mary Academy-bay View
3070 Pawtucket Avenue
Riverside, RI 02915
All-girls school, PK-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("St. Mary Academy-bay View",'Riverside=' + Riverside.length); Pawtucket[Pawtucket.length] = createMarker(new GPoint(-71.37658400,41.87696100),"
St. Raphael Academy
123 Walcott Street
Pawtucket, RI 02860
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Raphael Academy",'Pawtucket=' + Pawtucket.length); Providence[Providence.length] = createMarker(new GPoint(-71.38518500,41.83471100),"
School One
220 University Avenue
Providence, RI 02906
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("School One",'Providence=' + Providence.length); Lincoln[Lincoln.length] = createMarker(new GPoint(-71.41590500,41.91290700),"
The Spurwink School Ii
365 River Road
Lincoln, RI 02865
Co-ed school, PK-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Spurwink School Ii",'Lincoln=' + Lincoln.length); Providence[Providence.length] = createMarker(new GPoint(-71.41257100,41.81349900),"
Tavares Education Center
101 Plain Street
Providence, RI 02903
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tavares Education Center",'Providence=' + Providence.length); Pawtucket[Pawtucket.length] = createMarker(new GPoint(-71.39140600,41.88169600),"
Tides School
242 Dexter Street
Pawtucket, RI 02860
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tides School",'Pawtucket=' + Pawtucket.length); Johnston[Johnston.length] = createMarker(new GPoint(-71.51216700,41.82748900),"
Trinity Christian Academy
2119 Hartford Avenue
Johnston, RI 02919
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Trinity Christian Academy",'Johnston=' + Johnston.length); Cranston[Cranston.length] = createMarker(new GPoint(-71.43697900,41.77587100),"
Valley Community School
83 Rolfe Square
Cranston, RI 02910
Co-ed school, 2-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Valley Community School",'Cranston=' + Cranston.length); Pawtucket[Pawtucket.length] = createMarker(new GPoint(-71.38221600,41.88018700),"
Valley Community School And Valley Day Program
249 Roosevelt Avenue
Pawtucket, RI 02860
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Valley Community School And Valley Day Program",'Pawtucket=' + Pawtucket.length); Woonsocket[Woonsocket.length] = createMarker(new GPoint(-71.51200900,42.01409000),"
Viola M. Berard School
Po Box 1700
Woonsocket, RI 02895
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Viola M. Berard School",'Woonsocket=' + Woonsocket.length); Providence[Providence.length] = createMarker(new GPoint(-71.43512600,41.85691800),"
Vocational Resources
100 Houghton St
Providence, RI 02904
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Vocational Resources",'Providence=' + Providence.length); Providence[Providence.length] = createMarker(new GPoint(-71.39817100,41.82910700),"
Wheeler School
216 Hope Street
Providence, RI 02906
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wheeler School",'Providence=' + Providence.length); Providence[Providence.length] = createMarker(new GPoint(-71.39817200,41.82911000),"
The Wheeler School
216 Hope Street
Providence, RI 02906
Co-ed school, NS-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Wheeler School",'Providence=' + Providence.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(Cranston); map.removeOverlays(East_Providence); map.removeOverlays(Johnston); map.removeOverlays(Lincoln); map.removeOverlays(North_Providence); map.removeOverlays(Pawtucket); map.removeOverlays(Providence); map.removeOverlays(Riverside); map.removeOverlays(Smithfield); map.removeOverlays(Woonsocket); 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(Woonsocket);map.removeOverlays(Cranston); map.removeOverlays(East_Providence); map.removeOverlays(Johnston); map.removeOverlays(Lincoln); map.removeOverlays(North_Providence); map.removeOverlays(Pawtucket); map.removeOverlays(Providence); map.removeOverlays(Riverside); map.removeOverlays(Smithfield); map.removeOverlays(Woonsocket); map.addOverlays(Cranston); centerByArray(Cranston, false, false); cntMarker += Cranston.length; map.addOverlays(East_Providence); centerByArray(East_Providence, false, false); cntMarker += East_Providence.length; map.addOverlays(Johnston); centerByArray(Johnston, false, false); cntMarker += Johnston.length; map.addOverlays(Lincoln); centerByArray(Lincoln, false, false); cntMarker += Lincoln.length; map.addOverlays(North_Providence); centerByArray(North_Providence, false, false); cntMarker += North_Providence.length; map.addOverlays(Pawtucket); centerByArray(Pawtucket, false, false); cntMarker += Pawtucket.length; map.addOverlays(Providence); centerByArray(Providence, false, false); cntMarker += Providence.length; map.addOverlays(Riverside); centerByArray(Riverside, false, false); cntMarker += Riverside.length; map.addOverlays(Smithfield); centerByArray(Smithfield, false, false); cntMarker += Smithfield.length; map.addOverlays(Woonsocket); centerByArray(Woonsocket, false, false); cntMarker += Woonsocket.length; centerByArray(Woonsocket,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; }