function addMarkers(){ mySelect = document.getElementById('selection'); Fall_River = [];Attleboro = [];North_Dartmouth = [];Taunton = [];New_Bedford = [];Swansea = [];Norton = [];Westport = [];East_Freetown = [];mySelect.options[mySelect.options.length] = new Option("Attleboro schools",'all=Attleboro'); mySelect.options[mySelect.options.length] = new Option("East Freetown schools",'all=East_Freetown'); mySelect.options[mySelect.options.length] = new Option("Fall River schools",'all=Fall_River'); mySelect.options[mySelect.options.length] = new Option("New Bedford schools",'all=New_Bedford'); mySelect.options[mySelect.options.length] = new Option("North Dartmouth schools",'all=North_Dartmouth'); mySelect.options[mySelect.options.length] = new Option("Norton schools",'all=Norton'); mySelect.options[mySelect.options.length] = new Option("Swansea schools",'all=Swansea'); mySelect.options[mySelect.options.length] = new Option("Taunton schools",'all=Taunton'); mySelect.options[mySelect.options.length] = new Option("Westport schools",'all=Westport'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Fall_River[Fall_River.length] = createMarker(new GPoint(-71.12779100,41.71431800),"
Bishop Connolly High School
373 Elsbree Street
Fall River, MA 02720
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bishop Connolly High School",'Fall_River=' + Fall_River.length); 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); mySelect.options[mySelect.options.length] = new Option("Bishop Feehan High School",'Attleboro=' + Attleboro.length); North_Dartmouth[North_Dartmouth.length] = createMarker(new GPoint(-70.96880800,41.63538800),"
Bishop Stang High School
500 Slocum Road
North Dartmouth, MA 02747
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bishop Stang High School",'North_Dartmouth=' + North_Dartmouth.length); Taunton[Taunton.length] = createMarker(new GPoint(-71.09485100,41.90934500),"
Coyle & Cassidy High School
2 Hamilton Street
Taunton, MA 02780
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Coyle & Cassidy High School",'Taunton=' + Taunton.length); Fall_River[Fall_River.length] = createMarker(new GPoint(-71.15480000,41.70110000),"
Deaconess Home
Po Box 2118
Fall River, MA 02722
All-girls school, 9-12
[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Deaconess Home",'Fall_River=' + Fall_River.length); Fall_River[Fall_River.length] = createMarker(new GPoint(-71.17656400,41.69462900),"
East Gate Christian Academy
397 Bay Street
Fall River, MA 02724
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("East Gate Christian Academy",'Fall_River=' + Fall_River.length); 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); mySelect.options[mySelect.options.length] = new Option("Grace Baptist Christian Academy",'Attleboro=' + Attleboro.length); New_Bedford[New_Bedford.length] = createMarker(new GPoint(-70.92973900,41.62968300),"
Kennedy-donovan Center School
19 Hawthorn Street
New Bedford, MA 02740
Co-ed school, 2-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kennedy-donovan Center School",'New_Bedford=' + New_Bedford.length); Swansea[Swansea.length] = createMarker(new GPoint(-71.18263700,41.74956100),"
Meadowridge Behavioral Health Center
664 Stevens Road
Swansea, MA 02777
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Meadowridge Behavioral Health Center",'Swansea=' + Swansea.length); Swansea[Swansea.length] = createMarker(new GPoint(-71.18263700,41.74956100),"
Merdowrige
664 Stevens Rd
Swansea, MA 02777
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Merdowrige",'Swansea=' + Swansea.length); New_Bedford[New_Bedford.length] = createMarker(new GPoint(-70.96511300,41.65040500),"
Nazarene Christian Academy
764 Hathaway Road
New Bedford, MA 02740
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Nazarene Christian Academy",'New_Bedford=' + New_Bedford.length); Swansea[Swansea.length] = createMarker(new GPoint(-71.17566000,41.75877500),"
New England Christian Academy
271 Sharps Lot Road
Swansea, MA 02777
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New England Christian Academy",'Swansea=' + Swansea.length); Norton[Norton.length] = createMarker(new GPoint(-71.17431600,41.94572600),"
New Testament Christian School
1 New Taunton Ave
Norton, MA 02766
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Testament Christian School",'Norton=' + Norton.length); Westport[Westport.length] = createMarker(new GPoint(-71.12395000,41.55816600),"
St. Vincent's
573 Adamsville Rd
Westport, MA 02790
All-boys school, 6-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("St. Vincent's",'Westport=' + Westport.length); North_Dartmouth[North_Dartmouth.length] = createMarker(new GPoint(-70.96603500,41.62821900),"
Schwartz Center For Children
1 Posa Place
North Dartmouth, MA 02747
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Schwartz Center For Children",'North_Dartmouth=' + North_Dartmouth.length); Fall_River[Fall_River.length] = createMarker(new GPoint(-71.12725400,41.73428100),"
St Vincent School
2425 Highland Avenue
Fall River, MA 02720
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Vincent School",'Fall_River=' + Fall_River.length); Swansea[Swansea.length] = createMarker(new GPoint(-71.18843300,41.74853900),"
Stevens Childrens Home
24 Main Street
Swansea, MA 02777
All-boys school, 7-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Stevens Childrens Home",'Swansea=' + Swansea.length); East_Freetown[East_Freetown.length] = createMarker(new GPoint(-70.96080000,41.76620000),"
Whitney Academy
P O Box 619 85 Dr Braley Rd
East Freetown, MA 02717
All-boys school, NS-NS
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Whitney Academy",'East_Freetown=' + East_Freetown.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(Attleboro); map.removeOverlays(East_Freetown); map.removeOverlays(Fall_River); map.removeOverlays(New_Bedford); map.removeOverlays(North_Dartmouth); map.removeOverlays(Norton); map.removeOverlays(Swansea); map.removeOverlays(Taunton); map.removeOverlays(Westport); 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(Fall_River);map.removeOverlays(Attleboro); map.removeOverlays(East_Freetown); map.removeOverlays(Fall_River); map.removeOverlays(New_Bedford); map.removeOverlays(North_Dartmouth); map.removeOverlays(Norton); map.removeOverlays(Swansea); map.removeOverlays(Taunton); map.removeOverlays(Westport); map.addOverlays(Attleboro); centerByArray(Attleboro, false, false); cntMarker += Attleboro.length; map.addOverlays(East_Freetown); centerByArray(East_Freetown, false, false); cntMarker += East_Freetown.length; map.addOverlays(Fall_River); centerByArray(Fall_River, false, false); cntMarker += Fall_River.length; map.addOverlays(New_Bedford); centerByArray(New_Bedford, false, false); cntMarker += New_Bedford.length; map.addOverlays(North_Dartmouth); centerByArray(North_Dartmouth, false, false); cntMarker += North_Dartmouth.length; map.addOverlays(Norton); centerByArray(Norton, false, false); cntMarker += Norton.length; map.addOverlays(Swansea); centerByArray(Swansea, false, false); cntMarker += Swansea.length; map.addOverlays(Taunton); centerByArray(Taunton, false, false); cntMarker += Taunton.length; map.addOverlays(Westport); centerByArray(Westport, false, false); cntMarker += Westport.length; centerByArray(Fall_River,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; }