function addMarkers() { mySelect = document.getElementById('selection'); Reidsville = [];Eden = [];Mayodan = [];Madison = [];Ruffin = [];Wentworth = [];Stoneville = [];mySelect.options[mySelect.options.length] = new Option("Eden schools",'all=Eden'); mySelect.options[mySelect.options.length] = new Option("Madison schools",'all=Madison'); mySelect.options[mySelect.options.length] = new Option("Mayodan schools",'all=Mayodan'); mySelect.options[mySelect.options.length] = new Option("Reidsville schools",'all=Reidsville'); mySelect.options[mySelect.options.length] = new Option("Ruffin schools",'all=Ruffin'); mySelect.options[mySelect.options.length] = new Option("Stoneville schools",'all=Stoneville'); mySelect.options[mySelect.options.length] = new Option("Wentworth schools",'all=Wentworth'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Reidsville[Reidsville.length] = createMarker(new GPoint(-79.86029816,36.31014252),"
Bethany Community Middle School
181 Bethany Road
Reidsville, NC 27320

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Bethany Community Middle School",'Reidsville=' + Reidsville.length); Reidsville[Reidsville.length] = createMarker(new GPoint(-79.85649872,36.30834961),"
Bethany Elementary School
6371 Nc 65
Reidsville, NC 27320

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bethany Elementary School",'Reidsville=' + Reidsville.length); Eden[Eden.length] = createMarker(new GPoint(-79.73257446,36.50339890),"
Central Elementary School
435 E Stadium Dr
Eden, NC 27288

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Central Elementary School",'Eden=' + Eden.length); Mayodan[Mayodan.length] = createMarker(new GPoint(-79.96708679,36.41136169),"
Dalton Mcmichael High School
6845 Hwy 135
Mayodan, NC 27027

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Dalton Mcmichael High School",'Mayodan=' + Mayodan.length); Eden[Eden.length] = createMarker(new GPoint(-79.77821350,36.49501801),"
Douglass Elementary School
1130 Center Church Rd
Eden, NC 27288

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Douglass Elementary School",'Eden=' + Eden.length); Eden[Eden.length] = createMarker(new GPoint(-79.68966675,36.51631165),"
Draper Elementary School
1719 E Stadium Dr
Eden, NC 27288

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Draper Elementary School",'Eden=' + Eden.length); Madison[Madison.length] = createMarker(new GPoint(-79.97650146,36.38000107),"
Huntsville Elementary School
2020 Sardis Church Road
Madison, NC 27025

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Huntsville Elementary School",'Madison=' + Madison.length); Eden[Eden.length] = createMarker(new GPoint(-79.73731995,36.50542831),"
J E Holmes Middle School
211 N Pierce St
Eden, NC 27288

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("J E Holmes Middle School",'Eden=' + Eden.length); Eden[Eden.length] = createMarker(new GPoint(-79.73641968,36.50342560),"
John M Morehead High School
134 N Pierce St
Eden, NC 27288

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("John M Morehead High School",'Eden=' + Eden.length); Madison[Madison.length] = createMarker(new GPoint(-79.97726440,36.39694214),"
John W Dillard Elementary School
810 Cure Dr
Madison, NC 27025

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("John W Dillard Elementary School",'Madison=' + Madison.length); Reidsville[Reidsville.length] = createMarker(new GPoint(-79.66045380,36.35799789),"
Lawsonville Ave Elementary School
212 Lawsonville Ave
Reidsville, NC 27320

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lawsonville Ave Elementary School",'Reidsville=' + Reidsville.length); Eden[Eden.length] = createMarker(new GPoint(-79.75768280,36.49393845),"
Leaksville-spray Elementary School
415 Highland Dr
Eden, NC 27288

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Leaksville-spray Elementary School",'Eden=' + Eden.length); Ruffin[Ruffin.length] = createMarker(new GPoint(-79.63627625,36.44731903),"
Lincoln Elementary School
2660 Oregon Hill Road
Ruffin, NC 27326

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Ruffin=' + Ruffin.length); Reidsville[Reidsville.length] = createMarker(new GPoint(-79.73810577,36.31019211),"
Monroeton Elementary School
8081 Us Highway 158
Reidsville, NC 27320

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Monroeton Elementary School",'Reidsville=' + Reidsville.length); Reidsville[Reidsville.length] = createMarker(new GPoint(-79.68114471,36.36378479),"
Moss Street Elementary School
419 Moss St
Reidsville, NC 27320

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Moss Street Elementary School",'Reidsville=' + Reidsville.length); Madison[Madison.length] = createMarker(new GPoint(-79.97296143,36.39964676),"
New Vision Sch.of Math/sci/tec Elementary School
705 Nw Ayersville Rd
Madison, NC 27025

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("New Vision Sch.of Math/sci/tec Elementary School",'Madison=' + Madison.length); Reidsville[Reidsville.length] = createMarker(new GPoint(-79.67591095,36.33116913),"
Reidsville High School
1901 S Park Dr
Reidsville, NC 27320

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Reidsville High School",'Reidsville=' + Reidsville.length); Reidsville[Reidsville.length] = createMarker(new GPoint(-79.67990112,36.36303711),"
Reidsville Intermediate
401 Moss St
Reidsville, NC 27320

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Reidsville Intermediate",'Reidsville=' + Reidsville.length); Reidsville[Reidsville.length] = createMarker(new GPoint(-79.67599487,36.33108521),"
Reidsville Middle School
1903 S Park Dr
Reidsville, NC 27320

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Reidsville Middle School",'Reidsville=' + Reidsville.length); Wentworth[Wentworth.length] = createMarker(new GPoint(-79.77469635,36.40000153),"
Rockingham County High School
Po Box 98
Wentworth, NC 27375

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Rockingham County High School",'Wentworth=' + Wentworth.length); Wentworth[Wentworth.length] = createMarker(new GPoint(-79.77469635,36.40000153),"
Rockingham County Middle School
Po Box 182
Wentworth, NC 27375

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Rockingham County Middle School",'Wentworth=' + Wentworth.length); Eden[Eden.length] = createMarker(new GPoint(-79.73602295,36.47172546),"
Score Center
511 Harrington Hwy
Eden, NC 27288

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Score Center",'Eden=' + Eden.length); Reidsville[Reidsville.length] = createMarker(new GPoint(-79.66800690,36.34422684),"
South End Elementary School
1307 South Park Drive
Reidsville, NC 27320

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("South End Elementary School",'Reidsville=' + Reidsville.length); Stoneville[Stoneville.length] = createMarker(new GPoint(-79.90100098,36.46810150),"
Stoneville Elementary School
Po Box 7
Stoneville, NC 27048

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Stoneville Elementary School",'Stoneville=' + Stoneville.length); Wentworth[Wentworth.length] = createMarker(new GPoint(-79.77469635,36.40000153),"
Wentworth Elementary School
Po Box 37
Wentworth, NC 27375

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wentworth Elementary School",'Wentworth=' + Wentworth.length); Madison[Madison.length] = createMarker(new GPoint(-79.98069000,36.40443420),"
Western Rockingham Middle School
915 Nw Ayersville Rd
Madison, NC 27025

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Western Rockingham Middle School",'Madison=' + Madison.length); Reidsville[Reidsville.length] = createMarker(new GPoint(-79.62467957,36.28009033),"
Williamsburg Elementary School
2830 Hwy 87
Reidsville, NC 27320

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Williamsburg Elementary School",'Reidsville=' + Reidsville.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(Eden); map.removeOverlays(Madison); map.removeOverlays(Mayodan); map.removeOverlays(Reidsville); map.removeOverlays(Ruffin); map.removeOverlays(Stoneville); map.removeOverlays(Wentworth); 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(Reidsville);map.removeOverlays(Eden); map.removeOverlays(Madison); map.removeOverlays(Mayodan); map.removeOverlays(Reidsville); map.removeOverlays(Ruffin); map.removeOverlays(Stoneville); map.removeOverlays(Wentworth); map.addOverlays(Eden); centerByArray(Eden, false, false); cntMarker += Eden.length; map.addOverlays(Madison); centerByArray(Madison, false, false); cntMarker += Madison.length; map.addOverlays(Mayodan); centerByArray(Mayodan, false, false); cntMarker += Mayodan.length; map.addOverlays(Reidsville); centerByArray(Reidsville, false, false); cntMarker += Reidsville.length; map.addOverlays(Ruffin); centerByArray(Ruffin, false, false); cntMarker += Ruffin.length; map.addOverlays(Stoneville); centerByArray(Stoneville, false, false); cntMarker += Stoneville.length; map.addOverlays(Wentworth); centerByArray(Wentworth, false, false); cntMarker += Wentworth.length; centerByArray(Reidsville,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'); } }