function addMarkers() { mySelect = document.getElementById('selection'); Archdale = [];Trinity = [];Asheboro = [];Coleridge = [];Ramseur = [];Franklinville = [];Randleman = [];Liberty = [];Sophia = [];Seagrove = [];High_Point = [];mySelect.options[mySelect.options.length] = new Option("Archdale schools",'all=Archdale'); mySelect.options[mySelect.options.length] = new Option("Asheboro schools",'all=Asheboro'); mySelect.options[mySelect.options.length] = new Option("Coleridge schools",'all=Coleridge'); mySelect.options[mySelect.options.length] = new Option("Franklinville schools",'all=Franklinville'); mySelect.options[mySelect.options.length] = new Option("High Point schools",'all=High_Point'); mySelect.options[mySelect.options.length] = new Option("Liberty schools",'all=Liberty'); mySelect.options[mySelect.options.length] = new Option("Ramseur schools",'all=Ramseur'); mySelect.options[mySelect.options.length] = new Option("Randleman schools",'all=Randleman'); mySelect.options[mySelect.options.length] = new Option("Seagrove schools",'all=Seagrove'); mySelect.options[mySelect.options.length] = new Option("Sophia schools",'all=Sophia'); mySelect.options[mySelect.options.length] = new Option("Trinity schools",'all=Trinity'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Archdale[Archdale.length] = createMarker(new GPoint(-79.97588348,35.91330719),"
Archdale Elementary School
207 Trindale Rd
Archdale, NC 27263

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Archdale Elementary School",'Archdale=' + Archdale.length); Trinity[Trinity.length] = createMarker(new GPoint(-79.98390198,35.84429932),"
Archdale-trinity Middle School
Po Box 232
Trinity, NC 27370

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Archdale-trinity Middle School",'Trinity=' + Trinity.length); Asheboro[Asheboro.length] = createMarker(new GPoint(-79.82026672,35.69067383),"
Asheboro High School
1221 S Park St
Asheboro, NC 27203

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Asheboro High School",'Asheboro=' + Asheboro.length); Asheboro[Asheboro.length] = createMarker(new GPoint(-79.82080078,35.74753952),"
Balfour Elementary School
2097 N Asheboro School Rd
Asheboro, NC 27203

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Balfour Elementary School",'Asheboro=' + Asheboro.length); Trinity[Trinity.length] = createMarker(new GPoint(-79.99152374,35.89328766),"
Braxton Craven Middle School
7037 Nc Highway 62
Trinity, NC 27370

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Braxton Craven Middle School",'Trinity=' + Trinity.length); Asheboro[Asheboro.length] = createMarker(new GPoint(-79.81877136,35.71208954),"
Charles W Mccrary Elementary School
400 Ross St
Asheboro, NC 27203

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Charles W Mccrary Elementary School",'Asheboro=' + Asheboro.length); Coleridge[Coleridge.length] = createMarker(new GPoint(-79.61654663,35.64749146),"
Coleridge Elementary School
4528 Nc Hwy 22 South
Coleridge, NC 27316

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Coleridge Elementary School",'Coleridge=' + Coleridge.length); Asheboro[Asheboro.length] = createMarker(new GPoint(-79.82038116,35.70223618),"
Donna L Loflin Elementary School
405 S Park St
Asheboro, NC 27203

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Donna L Loflin Elementary School",'Asheboro=' + Asheboro.length); Ramseur[Ramseur.length] = createMarker(new GPoint(-79.65273285,35.73366165),"
Eastern Randolph High School
390 E Randolph Rd
Ramseur, NC 27316

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Eastern Randolph High School",'Ramseur=' + Ramseur.length); Asheboro[Asheboro.length] = createMarker(new GPoint(-79.97243500,35.64175797),"
Farmer Elementary School
3557 Grange Hall Rd
Asheboro, NC 27205

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Farmer Elementary School",'Asheboro=' + Asheboro.length); Franklinville[Franklinville.length] = createMarker(new GPoint(-79.70459747,35.77170181),"
Franklinville Elementary School
Po Box 258
Franklinville, NC 27248

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Franklinville Elementary School",'Franklinville=' + Franklinville.length); Franklinville[Franklinville.length] = createMarker(new GPoint(-79.69984436,35.82111359),"
Grays Chapel Elementary School
5322 Nc Hwy 22 N
Franklinville, NC 27248

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Grays Chapel Elementary School",'Franklinville=' + Franklinville.length); Asheboro[Asheboro.length] = createMarker(new GPoint(-79.80705261,35.67467117),"
Guy B Teachey Elementary School
294 Newbern Ave
Asheboro, NC 27205

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Guy B Teachey Elementary School",'Asheboro=' + Asheboro.length); Trinity[Trinity.length] = createMarker(new GPoint(-80.00835419,35.86151123),"
Hopewell Elementary School
6294 Welborn Road
Trinity, NC 27370

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hopewell Elementary School",'Trinity=' + Trinity.length); Archdale[Archdale.length] = createMarker(new GPoint(-79.92387390,35.89075851),"
John R Lawrence Elementary School
6068 Suits Rd
Archdale, NC 27263

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("John R Lawrence Elementary School",'Archdale=' + Archdale.length); Randleman[Randleman.length] = createMarker(new GPoint(-79.78926849,35.85832214),"
Level Cross Elementary School
5417 Old Greensboro Road
Randleman, NC 27317

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Level Cross Elementary School",'Randleman=' + Randleman.length); Liberty[Liberty.length] = createMarker(new GPoint(-79.56629944,35.87699890),"
Liberty Elementary School
Po Box 1009
Liberty, NC 27298

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Liberty Elementary School",'Liberty=' + Liberty.length); Asheboro[Asheboro.length] = createMarker(new GPoint(-79.80632782,35.70230103),"
Lindley Park Elementary School
312 Cliff Rd
Asheboro, NC 27203

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lindley Park Elementary School",'Asheboro=' + Asheboro.length); Sophia[Sophia.length] = createMarker(new GPoint(-79.85896301,35.82212067),"
New Market Elementary School
6096 Hwy 311
Sophia, NC 27350

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("New Market Elementary School",'Sophia=' + Sophia.length); Asheboro[Asheboro.length] = createMarker(new GPoint(-79.82167053,35.74419022),"
North Asheboro Middle School
1861 N Asheboro School Rd
Asheboro, NC 27203

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("North Asheboro Middle School",'Asheboro=' + Asheboro.length); Liberty[Liberty.length] = createMarker(new GPoint(-79.64376068,35.82266617),"
Northeastern Randolph Middle School
3493 Ramseur Julian Road
Liberty, NC 27298

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Northeastern Randolph Middle School",'Liberty=' + Liberty.length); Ramseur[Ramseur.length] = createMarker(new GPoint(-79.64649963,35.74061966),"
Ramseur Elementary School
146 Jordan Rd
Ramseur, NC 27316

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ramseur Elementary School",'Ramseur=' + Ramseur.length); Randleman[Randleman.length] = createMarker(new GPoint(-79.80354309,35.81015396),"
Randleman Elementary School
100 Swaim St
Randleman, NC 27317

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Randleman Elementary School",'Randleman=' + Randleman.length); Randleman[Randleman.length] = createMarker(new GPoint(-79.82256317,35.82422638),"
Randleman High School
4396 Tigers Den Rd
Randleman, NC 27317

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Randleman High School",'Randleman=' + Randleman.length); Randleman[Randleman.length] = createMarker(new GPoint(-79.80059814,35.83069992),"
Randleman Middle School
Po Box 625
Randleman, NC 27317

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Randleman Middle School",'Randleman=' + Randleman.length); Seagrove[Seagrove.length] = createMarker(new GPoint(-79.70670319,35.53179932),"
Seagrove Elementary School
Po Box 540
Seagrove, NC 27341

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Seagrove Elementary School",'Seagrove=' + Seagrove.length); Asheboro[Asheboro.length] = createMarker(new GPoint(-79.82215118,35.69103622),"
South Asheboro Middle School
523 W Walker Ave
Asheboro, NC 27203

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("South Asheboro Middle School",'Asheboro=' + Asheboro.length); Ramseur[Ramseur.length] = createMarker(new GPoint(-79.63369751,35.73002625),"
Southeastern Randolph Middle School
5302 Foushee Rd
Ramseur, NC 27316

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Southeastern Randolph Middle School",'Ramseur=' + Ramseur.length); Asheboro[Asheboro.length] = createMarker(new GPoint(-79.84794617,35.64626694),"
Southmont Elementary School
2497 Southmont Drive
Asheboro, NC 27205

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Southmont Elementary School",'Asheboro=' + Asheboro.length); Asheboro[Asheboro.length] = createMarker(new GPoint(-79.86975098,35.62732315),"
Southwestern Randolph High School
1641 Hopewell Friends Rd
Asheboro, NC 27205

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Southwestern Randolph High School",'Asheboro=' + Asheboro.length); Asheboro[Asheboro.length] = createMarker(new GPoint(-79.86605072,35.62486267),"
Southwestern Randolph Middle School
1509 Hopewell Friends Rd
Asheboro, NC 27205

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Southwestern Randolph Middle School",'Asheboro=' + Asheboro.length); Asheboro[Asheboro.length] = createMarker(new GPoint(-79.96609497,35.73368454),"
Tabernacle Elementary School
4901 Tabernacle School Rd
Asheboro, NC 27205

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Tabernacle Elementary School",'Asheboro=' + Asheboro.length); High_Point[High_Point.length] = createMarker(new GPoint(-79.96321869,35.89973450),"
Trindale Elementary School
400 Balfour Dr
High Point, NC 27263

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Trindale Elementary School",'High_Point=' + High_Point.length); Trinity[Trinity.length] = createMarker(new GPoint(-79.98638916,35.89466476),"
Trinity Elementary School
5457 Braxton Craven Rd
Trinity, NC 27370

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Trinity Elementary School",'Trinity=' + Trinity.length); Trinity[Trinity.length] = createMarker(new GPoint(-79.98390198,35.84429932),"
Trinity High School
Po Box 131
Trinity, NC 27370

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Trinity High School",'Trinity=' + Trinity.length); Trinity[Trinity.length] = createMarker(new GPoint(-79.99227142,35.71687317),"
Uwharrie Middle School
1463 Pleasant Union Road
Trinity, NC 27370

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Uwharrie Middle School",'Trinity=' + Trinity.length); Seagrove[Seagrove.length] = createMarker(new GPoint(-79.73897552,35.51850128),"
Westmoore Elementary School
2159 Nc Hwy 705
Seagrove, NC 27341

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Westmoore Elementary School",'Seagrove=' + Seagrove.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(Archdale); map.removeOverlays(Asheboro); map.removeOverlays(Coleridge); map.removeOverlays(Franklinville); map.removeOverlays(High_Point); map.removeOverlays(Liberty); map.removeOverlays(Ramseur); map.removeOverlays(Randleman); map.removeOverlays(Seagrove); map.removeOverlays(Sophia); map.removeOverlays(Trinity); 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(Archdale);map.removeOverlays(Archdale); map.removeOverlays(Asheboro); map.removeOverlays(Coleridge); map.removeOverlays(Franklinville); map.removeOverlays(High_Point); map.removeOverlays(Liberty); map.removeOverlays(Ramseur); map.removeOverlays(Randleman); map.removeOverlays(Seagrove); map.removeOverlays(Sophia); map.removeOverlays(Trinity); map.addOverlays(Archdale); centerByArray(Archdale, false, false); cntMarker += Archdale.length; map.addOverlays(Asheboro); centerByArray(Asheboro, false, false); cntMarker += Asheboro.length; map.addOverlays(Coleridge); centerByArray(Coleridge, false, false); cntMarker += Coleridge.length; map.addOverlays(Franklinville); centerByArray(Franklinville, false, false); cntMarker += Franklinville.length; map.addOverlays(High_Point); centerByArray(High_Point, false, false); cntMarker += High_Point.length; map.addOverlays(Liberty); centerByArray(Liberty, false, false); cntMarker += Liberty.length; map.addOverlays(Ramseur); centerByArray(Ramseur, false, false); cntMarker += Ramseur.length; map.addOverlays(Randleman); centerByArray(Randleman, false, false); cntMarker += Randleman.length; map.addOverlays(Seagrove); centerByArray(Seagrove, false, false); cntMarker += Seagrove.length; map.addOverlays(Sophia); centerByArray(Sophia, false, false); cntMarker += Sophia.length; map.addOverlays(Trinity); centerByArray(Trinity, false, false); cntMarker += Trinity.length; centerByArray(Archdale,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'); } }