function addMarkers() { mySelect = document.getElementById('selection'); Gastonia = [];Gastonia[Gastonia.length] = createMarker(new GPoint(-81.21225739,35.26499939),"
Arlington Elementary School
1621 N Webb Street
Gastonia, NC 28052

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Arlington Elementary School",'Gastonia=' + Gastonia.length); Gastonia[Gastonia.length] = createMarker(new GPoint(-81.12811279,35.24248123),"
Ashbrook High School
2222 S New Hope Road
Gastonia, NC 28054

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ashbrook High School",'Gastonia=' + Gastonia.length); Gastonia[Gastonia.length] = createMarker(new GPoint(-81.15364838,35.29298782),"
Brookside Elementary School
1950 Rhyne Carter Road
Gastonia, NC 28054

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Brookside Elementary School",'Gastonia=' + Gastonia.length); Gastonia[Gastonia.length] = createMarker(new GPoint(-81.24978638,35.20695114),"
Chapel Grove Elementary School
5201 Lewis Road
Gastonia, NC 28052

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Chapel Grove Elementary School",'Gastonia=' + Gastonia.length); Gastonia[Gastonia.length] = createMarker(new GPoint(-81.25972100,35.25668400),"
Edward D Sadler, Jr Elementary School
3950 West Franklin Boulevard
Gastonia, NC 28052

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Edward D Sadler, Jr Elementary School",'Gastonia=' + Gastonia.length); Gastonia[Gastonia.length] = createMarker(new GPoint(-81.18782043,35.26213074),"
Forest Heights Elementary School
1 Learning Place
Gastonia, NC 28052

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Forest Heights Elementary School",'Gastonia=' + Gastonia.length); Gastonia[Gastonia.length] = createMarker(new GPoint(-81.13629150,35.18282700),"
Forestview High School
5545 Union Road
Gastonia, NC 28056

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Forestview High School",'Gastonia=' + Gastonia.length); Gastonia[Gastonia.length] = createMarker(new GPoint(-81.13461304,35.25460815),"
Gardner Park Elementary School
738 Armstrong Park Road
Gastonia, NC 28054

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Gardner Park Elementary School",'Gastonia=' + Gastonia.length); Gastonia[Gastonia.length] = createMarker(new GPoint(-81.20217896,35.22243500),"
Hershal H Beam Elementary School
200 Davis Park Road
Gastonia, NC 28052

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hershal H Beam Elementary School",'Gastonia=' + Gastonia.length); Gastonia[Gastonia.length] = createMarker(new GPoint(-81.18609619,35.26330185),"
Highland Charter
Po Box 1653
Gastonia, NC 28053

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Highland Charter",'Gastonia=' + Gastonia.length); Gastonia[Gastonia.length] = createMarker(new GPoint(-81.18986511,35.27964020),"
Highland School Of Technology
1600 N Morris Street
Gastonia, NC 28052

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Highland School Of Technology",'Gastonia=' + Gastonia.length); Gastonia[Gastonia.length] = createMarker(new GPoint(-81.20658112,35.24126816),"
Hunter Huss High School
1518 Edgefield Avenue
Gastonia, NC 28052

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hunter Huss High School",'Gastonia=' + Gastonia.length); Gastonia[Gastonia.length] = createMarker(new GPoint(-81.19133759,35.24092865),"
Lingerfeldt Elementary School
1601 Madison Street
Gastonia, NC 28052

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lingerfeldt Elementary School",'Gastonia=' + Gastonia.length); Gastonia[Gastonia.length] = createMarker(new GPoint(-81.08328247,35.21129990),"
New Hope Elementary School
137 Stowe Road
Gastonia, NC 28056

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("New Hope Elementary School",'Gastonia=' + Gastonia.length); Gastonia[Gastonia.length] = createMarker(new GPoint(-81.15299988,35.26020050),"
Piedmont Community Charter
Po Box 3706
Gastonia, NC 28054

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Piedmont Community Charter",'Gastonia=' + Gastonia.length); Gastonia[Gastonia.length] = createMarker(new GPoint(-81.20403290,35.24923325),"
Pleasant Ridge Elementary School
937 S Miller Street
Gastonia, NC 28052

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pleasant Ridge Elementary School",'Gastonia=' + Gastonia.length); Gastonia[Gastonia.length] = createMarker(new GPoint(-81.20730591,35.27878189),"
Rhyne Elementary School
1900 W Davidson Avenue
Gastonia, NC 28052

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rhyne Elementary School",'Gastonia=' + Gastonia.length); Gastonia[Gastonia.length] = createMarker(new GPoint(-81.16570282,35.21337128),"
Robinson Elementary School
3122 S Union Road
Gastonia, NC 28056

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Robinson Elementary School",'Gastonia=' + Gastonia.length); Gastonia[Gastonia.length] = createMarker(new GPoint(-81.15388489,35.24919510),"
Sherwood Elementary School
1744 Dixon Road
Gastonia, NC 28054

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sherwood Elementary School",'Gastonia=' + Gastonia.length); Gastonia[Gastonia.length] = createMarker(new GPoint(-81.20614624,35.23055267),"
Southwest Middle School
1 Roadrunner Drive
Gastonia, NC 28052

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Southwest Middle School",'Gastonia=' + Gastonia.length); Gastonia[Gastonia.length] = createMarker(new GPoint(-81.13380432,35.18978119),"
W A Bess Elementary School
4340 Beaty Road
Gastonia, NC 28056

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("W A Bess Elementary School",'Gastonia=' + Gastonia.length); Gastonia[Gastonia.length] = createMarker(new GPoint(-81.15547943,35.25296021),"
W P Grier Middle School
1622 E Garrison Boulevard
Gastonia, NC 28054

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("W P Grier Middle School",'Gastonia=' + Gastonia.length); Gastonia[Gastonia.length] = createMarker(new GPoint(-81.13360596,35.28110123),"
Warlick School
1316 Spencer Mountain Road
Gastonia, NC 28054

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Warlick School",'Gastonia=' + Gastonia.length); Gastonia[Gastonia.length] = createMarker(new GPoint(-81.21226501,35.26499939),"
Webb St Special Education
1623 N Webb Street
Gastonia, NC 28052

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Webb St Special Education",'Gastonia=' + Gastonia.length); Gastonia[Gastonia.length] = createMarker(new GPoint(-81.17908478,35.27816772),"
Woodhill Elementary School
1027 Woodhill Drive
Gastonia, NC 28052

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Woodhill Elementary School",'Gastonia=' + Gastonia.length); Gastonia[Gastonia.length] = createMarker(new GPoint(-81.18638400,35.26217000),"
York Chester Middle School
601 S Clay Street
Gastonia, NC 28052

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("York Chester Middle School",'Gastonia=' + Gastonia.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,10); /* 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(Gastonia); 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(Gastonia);map.removeOverlays(Gastonia); map.addOverlays(Gastonia); centerByArray(Gastonia, false, false); cntMarker += Gastonia.length; centerByArray(Gastonia,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'); } }