function addMarkers() { mySelect = document.getElementById('selection'); Lumberton = [];Fairmont = [];Orrum = [];Maxton = [];Parkton = [];Pembroke = [];Red_Springs = [];Shannon = [];Rowland = [];Saint_Pauls = [];mySelect.options[mySelect.options.length] = new Option("Fairmont schools",'all=Fairmont'); mySelect.options[mySelect.options.length] = new Option("Lumberton schools",'all=Lumberton'); mySelect.options[mySelect.options.length] = new Option("Maxton schools",'all=Maxton'); mySelect.options[mySelect.options.length] = new Option("Orrum schools",'all=Orrum'); mySelect.options[mySelect.options.length] = new Option("Parkton schools",'all=Parkton'); mySelect.options[mySelect.options.length] = new Option("Pembroke schools",'all=Pembroke'); mySelect.options[mySelect.options.length] = new Option("Red Springs schools",'all=Red_Springs'); mySelect.options[mySelect.options.length] = new Option("Rowland schools",'all=Rowland'); mySelect.options[mySelect.options.length] = new Option("Saint Pauls schools",'all=Saint_Pauls'); mySelect.options[mySelect.options.length] = new Option("Shannon schools",'all=Shannon'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Lumberton[Lumberton.length] = createMarker(new GPoint(-79.00440216,34.62129974),"
Cis Academy
Po Box 706
Lumberton, NC 28359

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Cis Academy",'Lumberton=' + Lumberton.length); Lumberton[Lumberton.length] = createMarker(new GPoint(-79.12226868,34.62281036),"
Deep Branch Elementary School
4045 Deep Branch Road
Lumberton, NC 28360

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Deep Branch Elementary School",'Lumberton=' + Lumberton.length); Lumberton[Lumberton.length] = createMarker(new GPoint(-78.93138885,34.62623978),"
East Robeson Primary
4840 7th Street Road
Lumberton, NC 28358

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("East Robeson Primary",'Lumberton=' + Lumberton.length); Fairmont[Fairmont.length] = createMarker(new GPoint(-79.11422729,34.49657822),"
Fairgrove Middle School
1953 Fairgrove Sch Road
Fairmont, NC 28340

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Fairgrove Middle School",'Fairmont=' + Fairmont.length); Fairmont[Fairmont.length] = createMarker(new GPoint(-79.09721375,34.47927094),"
Fairmont High School
5419 Old Stage Road
Fairmont, NC 28340

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fairmont High School",'Fairmont=' + Fairmont.length); Fairmont[Fairmont.length] = createMarker(new GPoint(-79.11775208,34.49695206),"
Fairmont Middle School
402 Iona St
Fairmont, NC 28340

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Fairmont Middle School",'Fairmont=' + Fairmont.length); Fairmont[Fairmont.length] = createMarker(new GPoint(-79.13821411,34.53287888),"
Green Grove Elementary School
1850 School Road
Fairmont, NC 28340

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Green Grove Elementary School",'Fairmont=' + Fairmont.length); Lumberton[Lumberton.length] = createMarker(new GPoint(-78.98667908,34.61353683),"
Janie C Hargrave Elementary School
100 Hargrave St
Lumberton, NC 28358

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Janie C Hargrave Elementary School",'Lumberton=' + Lumberton.length); Lumberton[Lumberton.length] = createMarker(new GPoint(-79.00814056,34.65887070),"
L Gilbert Carroll Middle School
300 Bailey Rd
Lumberton, NC 28358

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("L Gilbert Carroll Middle School",'Lumberton=' + Lumberton.length); Lumberton[Lumberton.length] = createMarker(new GPoint(-78.91575623,34.64576721),"
Littlefield Middle School
9674 Nc Hwy 41 N
Lumberton, NC 28358

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Littlefield Middle School",'Lumberton=' + Lumberton.length); Lumberton[Lumberton.length] = createMarker(new GPoint(-79.00871277,34.61791992),"
Long Branch Elementary School
10218 Nc 72 East
Lumberton, NC 28358

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Long Branch Elementary School",'Lumberton=' + Lumberton.length); Lumberton[Lumberton.length] = createMarker(new GPoint(-79.03230286,34.60363770),"
Lumberton Junior High School
82 Marion Rd
Lumberton, NC 28358

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Lumberton Junior High School",'Lumberton=' + Lumberton.length); Lumberton[Lumberton.length] = createMarker(new GPoint(-78.99983215,34.64554977),"
Lumberton Senior High School
3901 Fayetteville Rd
Lumberton, NC 28358

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lumberton Senior High School",'Lumberton=' + Lumberton.length); Lumberton[Lumberton.length] = createMarker(new GPoint(-79.00871277,34.61791992),"
Magnolia Elementary School
10928 Us 301 North
Lumberton, NC 28360

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Magnolia Elementary School",'Lumberton=' + Lumberton.length); Orrum[Orrum.length] = createMarker(new GPoint(-79.00876900,34.46336500),"
Orrum Middle School
Po Box 129
Orrum, NC 28369

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Orrum Middle School",'Orrum=' + Orrum.length); Maxton[Maxton.length] = createMarker(new GPoint(-79.26318359,34.81010818),"
Oxendine Elementary School
5599 Oxendine School Rd
Maxton, NC 28364

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Oxendine Elementary School",'Maxton=' + Maxton.length); Parkton[Parkton.length] = createMarker(new GPoint(-78.99900055,34.90439987),"
Parkton Elementary School
Po Box 189
Parkton, NC 28371

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Parkton Elementary School",'Parkton=' + Parkton.length); Pembroke[Pembroke.length] = createMarker(new GPoint(-79.18119812,34.69300079),"
Pembroke Elementary School
Po Box 878
Pembroke, NC 28372

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pembroke Elementary School",'Pembroke=' + Pembroke.length); Pembroke[Pembroke.length] = createMarker(new GPoint(-79.18119812,34.69300079),"
Pembroke Middle School
Po Box 1148
Pembroke, NC 28372

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Pembroke Middle School",'Pembroke=' + Pembroke.length); Red_Springs[Red_Springs.length] = createMarker(new GPoint(-79.18897247,34.81269073),"
Peterson Elementary School
102 Phillips Ave
Red Springs, NC 28377

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Peterson Elementary School",'Red_Springs=' + Red_Springs.length); Lumberton[Lumberton.length] = createMarker(new GPoint(-79.03690338,34.68777466),"
Piney Grove Elementary School
1680 Piney Grove Road
Lumberton, NC 28358

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Piney Grove Elementary School",'Lumberton=' + Lumberton.length); Maxton[Maxton.length] = createMarker(new GPoint(-79.29500580,34.73314285),"
Prospect Elementary School
4024 Missouri Road
Maxton, NC 28364

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Prospect Elementary School",'Maxton=' + Maxton.length); Lumberton[Lumberton.length] = createMarker(new GPoint(-79.00395200,34.66800300),"
Psrc Early College At Rcc
5160 Fayetteville Road
Lumberton, NC 28360

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Psrc Early College At Rcc",'Lumberton=' + Lumberton.length); Pembroke[Pembroke.length] = createMarker(new GPoint(-79.18119812,34.69300079),"
Purnell Swett High School
Po Box 1210
Pembroke, NC 28372

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Purnell Swett High School",'Pembroke=' + Pembroke.length); Maxton[Maxton.length] = createMarker(new GPoint(-79.34385681,34.73231888),"
R B Dean Elementary School
202 S Hooper St
Maxton, NC 28364

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("R B Dean Elementary School",'Maxton=' + Maxton.length); Red_Springs[Red_Springs.length] = createMarker(new GPoint(-79.18449402,34.82337570),"
Red Springs High School
509 N Vance Street
Red Springs, NC 28377

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Red Springs High School",'Red_Springs=' + Red_Springs.length); Red_Springs[Red_Springs.length] = createMarker(new GPoint(-79.18532562,34.81887817),"
Red Springs Middle School
302 W Second Avenue
Red Springs, NC 28377

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Red Springs Middle School",'Red_Springs=' + Red_Springs.length); Shannon[Shannon.length] = createMarker(new GPoint(-79.08940125,34.84388351),"
Rex-rennert Elementary School
11780 Rennert Road
Shannon, NC 28386

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rex-rennert Elementary School",'Shannon=' + Shannon.length); Lumberton[Lumberton.length] = createMarker(new GPoint(-79.00440216,34.62129974),"
Robeson Co Career Center
Po Box 2909
Lumberton, NC 28359

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Robeson Co Career Center",'Lumberton=' + Lumberton.length); Fairmont[Fairmont.length] = createMarker(new GPoint(-79.11897278,34.50346375),"
Rosenwald Elementary School
301 Martin L King Dr
Fairmont, NC 28340

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rosenwald Elementary School",'Fairmont=' + Fairmont.length); Rowland[Rowland.length] = createMarker(new GPoint(-79.29419708,34.53923035),"
Rowland Middle School
408 W Chapel St
Rowland, NC 28383

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Rowland Middle School",'Rowland=' + Rowland.length); Lumberton[Lumberton.length] = createMarker(new GPoint(-78.99545288,34.62144852),"
Rowland Norment Elementary School
701 Godwin Ave
Lumberton, NC 28358

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rowland Norment Elementary School",'Lumberton=' + Lumberton.length); Saint_Pauls[Saint_Pauls.length] = createMarker(new GPoint(-78.97139740,34.80479813),"
Saint Pauls Elementary School
Po Box 398
Saint Pauls, NC 28384

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Saint Pauls Elementary School",'Saint_Pauls=' + Saint_Pauls.length); Saint_Pauls[Saint_Pauls.length] = createMarker(new GPoint(-78.97132111,34.80664063),"
Saint Pauls High School
648 North Stage Rd
Saint Pauls, NC 28384

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Saint Pauls High School",'Saint_Pauls=' + Saint_Pauls.length); Saint_Pauls[Saint_Pauls.length] = createMarker(new GPoint(-78.97746277,34.81111145),"
Saint Pauls Middle School
526 W Shaw St
Saint Pauls, NC 28384

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Saint Pauls Middle School",'Saint_Pauls=' + Saint_Pauls.length); Rowland[Rowland.length] = createMarker(new GPoint(-79.24285126,34.54586792),"
South Robeson High School
3268 South Robeson Rd
Rowland, NC 28383

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("South Robeson High School",'Rowland=' + Rowland.length); Rowland[Rowland.length] = createMarker(new GPoint(-79.29843140,34.53293228),"
Southside/ashpole Elementary School
607 S Martin L King Jr St
Rowland, NC 28383

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Southside/ashpole Elementary School",'Rowland=' + Rowland.length); Lumberton[Lumberton.length] = createMarker(new GPoint(-79.01055145,34.63805389),"
Tanglewood Elementary School
400 West 29th Street
Lumberton, NC 28358

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Tanglewood Elementary School",'Lumberton=' + Lumberton.length); Maxton[Maxton.length] = createMarker(new GPoint(-79.35047150,34.73371124),"
Townsend Middle School
105 Carolina Street
Maxton, NC 28364

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Townsend Middle School",'Maxton=' + Maxton.length); Pembroke[Pembroke.length] = createMarker(new GPoint(-79.17117310,34.70024490),"
Union Chapel Elementary School
4271 Union Chapel Road
Pembroke, NC 28372

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Union Chapel Elementary School",'Pembroke=' + Pembroke.length); Rowland[Rowland.length] = createMarker(new GPoint(-79.24639893,34.63847733),"
Union Elementary School
2547 Nc Hwy 710 South
Rowland, NC 28383

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Union Elementary School",'Rowland=' + Rowland.length); Lumberton[Lumberton.length] = createMarker(new GPoint(-79.00871277,34.61791992),"
W H Knuckles Montessori
1520 Martin L King Dr
Lumberton, NC 28358

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("W H Knuckles Montessori",'Lumberton=' + Lumberton.length); Lumberton[Lumberton.length] = createMarker(new GPoint(-79.03515625,34.62375641),"
West Lumberton Elementary School
451 School Street
Lumberton, NC 28358

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West Lumberton Elementary School",'Lumberton=' + Lumberton.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(Fairmont); map.removeOverlays(Lumberton); map.removeOverlays(Maxton); map.removeOverlays(Orrum); map.removeOverlays(Parkton); map.removeOverlays(Pembroke); map.removeOverlays(Red_Springs); map.removeOverlays(Rowland); map.removeOverlays(Saint_Pauls); map.removeOverlays(Shannon); 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(Lumberton);map.removeOverlays(Fairmont); map.removeOverlays(Lumberton); map.removeOverlays(Maxton); map.removeOverlays(Orrum); map.removeOverlays(Parkton); map.removeOverlays(Pembroke); map.removeOverlays(Red_Springs); map.removeOverlays(Rowland); map.removeOverlays(Saint_Pauls); map.removeOverlays(Shannon); map.addOverlays(Fairmont); centerByArray(Fairmont, false, false); cntMarker += Fairmont.length; map.addOverlays(Lumberton); centerByArray(Lumberton, false, false); cntMarker += Lumberton.length; map.addOverlays(Maxton); centerByArray(Maxton, false, false); cntMarker += Maxton.length; map.addOverlays(Orrum); centerByArray(Orrum, false, false); cntMarker += Orrum.length; map.addOverlays(Parkton); centerByArray(Parkton, false, false); cntMarker += Parkton.length; map.addOverlays(Pembroke); centerByArray(Pembroke, false, false); cntMarker += Pembroke.length; map.addOverlays(Red_Springs); centerByArray(Red_Springs, false, false); cntMarker += Red_Springs.length; map.addOverlays(Rowland); centerByArray(Rowland, false, false); cntMarker += Rowland.length; map.addOverlays(Saint_Pauls); centerByArray(Saint_Pauls, false, false); cntMarker += Saint_Pauls.length; map.addOverlays(Shannon); centerByArray(Shannon, false, false); cntMarker += Shannon.length; centerByArray(Lumberton,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'); } }