function addMarkers() { mySelect = document.getElementById('selection'); Graham = [];Elon = [];Burlington = [];Mebane = [];Haw_River = [];Saxapahaw = [];Snow_Camp = [];mySelect.options[mySelect.options.length] = new Option("Burlington schools",'all=Burlington'); mySelect.options[mySelect.options.length] = new Option("Elon schools",'all=Elon'); mySelect.options[mySelect.options.length] = new Option("Graham schools",'all=Graham'); mySelect.options[mySelect.options.length] = new Option("Haw River schools",'all=Haw_River'); mySelect.options[mySelect.options.length] = new Option("Mebane schools",'all=Mebane'); mySelect.options[mySelect.options.length] = new Option("Saxapahaw schools",'all=Saxapahaw'); mySelect.options[mySelect.options.length] = new Option("Snow Camp schools",'all=Snow_Camp'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Graham[Graham.length] = createMarker(new GPoint(-79.37480164,36.01969910),"
Alexander Wilson Elementary School
2518 Nc 54
Graham, NC 27253

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Alexander Wilson Elementary School",'Graham=' + Graham.length); Elon[Elon.length] = createMarker(new GPoint(-79.50559998,36.14569855),"
Altamahaw Ossipee Elementary School
2832 N Nc 87
Elon, NC 27244

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Altamahaw Ossipee Elementary School",'Elon=' + Elon.length); Graham[Graham.length] = createMarker(new GPoint(-79.32611847,35.93913651),"
B Everett Jordan Elementary School
5827 Church Road
Graham, NC 27253

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("B Everett Jordan Elementary School",'Graham=' + Graham.length); Burlington[Burlington.length] = createMarker(new GPoint(-79.39906311,36.08653641),"
Broadview Middle School
2229 Broadview Drive
Burlington, NC 27217

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Broadview Middle School",'Burlington=' + Burlington.length); Burlington[Burlington.length] = createMarker(new GPoint(-79.40850067,36.13479996),"
Clover Garden
2454 Altamhaw Union Ridge Road
Burlington, NC 27217

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Clover Garden",'Burlington=' + Burlington.length); Mebane[Mebane.length] = createMarker(new GPoint(-79.27388600,36.09963700),"
E M Yoder Elementary School
301 N Charles Street
Mebane, NC 27302

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("E M Yoder Elementary School",'Mebane=' + Mebane.length); Mebane[Mebane.length] = createMarker(new GPoint(-79.30433655,36.11346436),"
Eastern Alamance High School
4040 Mebane Rogers
Mebane, NC 27302

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Eastern Alamance High School",'Mebane=' + Mebane.length); Burlington[Burlington.length] = createMarker(new GPoint(-79.40603638,36.10145950),"
Eastlawn Elementary School
502 N Graham Hopedale Road
Burlington, NC 27217

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Eastlawn Elementary School",'Burlington=' + Burlington.length); Burlington[Burlington.length] = createMarker(new GPoint(-79.47250366,36.06510162),"
Edwin M Holt Elementary School
4751 S Nc 62
Burlington, NC 27215

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Edwin M Holt Elementary School",'Burlington=' + Burlington.length); Elon[Elon.length] = createMarker(new GPoint(-79.49887848,36.10339737),"
Elon Elementary School
510 E Haggard Avenue
Elon, NC 27244

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Elon Elementary School",'Elon=' + Elon.length); Mebane[Mebane.length] = createMarker(new GPoint(-79.29486084,36.05835342),"
Garrett Elementary School
3224 Old Hillsborough Road
Mebane, NC 27302

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Garrett Elementary School",'Mebane=' + Mebane.length); Graham[Graham.length] = createMarker(new GPoint(-79.38083649,36.07677841),"
Graham High School
903 Trollinger Road
Graham, NC 27253

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Graham High School",'Graham=' + Graham.length); Graham[Graham.length] = createMarker(new GPoint(-79.39679718,36.06783676),"
Graham Middle School
311 E Pine Street
Graham, NC 27253

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Graham Middle School",'Graham=' + Graham.length); Burlington[Burlington.length] = createMarker(new GPoint(-79.46146393,36.08094025),"
Grove Park Elementary School
141 Trail 1
Burlington, NC 27215

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Grove Park Elementary School",'Burlington=' + Burlington.length); Burlington[Burlington.length] = createMarker(new GPoint(-79.42070007,36.07387543),"
Harvey R Newlin Elementary School
316 Carden Street
Burlington, NC 27215

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Harvey R Newlin Elementary School",'Burlington=' + Burlington.length); Haw_River[Haw_River.length] = createMarker(new GPoint(-79.35881042,36.09465027),"
Haw River Elementary School
701 E Main Street
Haw River, NC 27258

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Haw River Elementary School",'Haw_River=' + Haw_River.length); Mebane[Mebane.length] = createMarker(new GPoint(-79.27200317,36.10049820),"
Hawfields Middle School
1948 S Nc 119
Mebane, NC 27302

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Hawfields Middle School",'Mebane=' + Mebane.length); Burlington[Burlington.length] = createMarker(new GPoint(-79.46238708,36.10413361),"
Hillcrest Elementary School
1714 W Davis Street
Burlington, NC 27215

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hillcrest Elementary School",'Burlington=' + Burlington.length); Burlington[Burlington.length] = createMarker(new GPoint(-79.39894104,36.09223557),"
Hugh M Cummings High School
2200 N Mebane Street
Burlington, NC 27217

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hugh M Cummings High School",'Burlington=' + Burlington.length); Elon[Elon.length] = createMarker(new GPoint(-79.50559998,36.14569855),"
Lakeside School
Po Box 157
Elon, NC 27244

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Lakeside School",'Elon=' + Elon.length); Burlington[Burlington.length] = createMarker(new GPoint(-79.47618866,36.07851791),"
Marvin B Smith Elementary School
2235 Delaney Drive
Burlington, NC 27215

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Marvin B Smith Elementary School",'Burlington=' + Burlington.length); Saxapahaw[Saxapahaw.length] = createMarker(new GPoint(-79.32159500,35.94726400),"
New Century Charter High School
Po Box 162
Saxapahaw, NC 27340

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Century Charter High School",'Saxapahaw=' + Saxapahaw.length); Graham[Graham.length] = createMarker(new GPoint(-79.37644196,36.07779312),"
North Graham Elementary School
1025 Trollinger Road
Graham, NC 27253

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Graham Elementary School",'Graham=' + Graham.length); Burlington[Burlington.length] = createMarker(new GPoint(-79.40850067,36.13479996),"
Pleasant Grove Elementary School
2847 Pleasant Grv Sch Road
Burlington, NC 27217

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pleasant Grove Elementary School",'Burlington=' + Burlington.length); Burlington[Burlington.length] = createMarker(new GPoint(-79.38519287,36.09329605),"
R Homer Andrews Elementary School
2630 Buckingham Road
Burlington, NC 27217

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("R Homer Andrews Elementary School",'Burlington=' + Burlington.length); Graham[Graham.length] = createMarker(new GPoint(-79.32219696,35.94720078),"
River Mill Academy
Po Box 1450
Graham, NC 27253

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("River Mill Academy",'Graham=' + Graham.length); Burlington[Burlington.length] = createMarker(new GPoint(-79.43182373,36.10402298),"
Sellars-gunn Alternative
612 Apple Street
Burlington, NC 27217

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sellars-gunn Alternative",'Burlington=' + Burlington.length); Graham[Graham.length] = createMarker(new GPoint(-79.39513397,36.05143738),"
South Graham Elementary School
320 Ivey Road
Graham, NC 27253

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("South Graham Elementary School",'Graham=' + Graham.length); Mebane[Mebane.length] = createMarker(new GPoint(-79.27269745,36.09011841),"
South Mebane Elementary School
600 S 3rd Street
Mebane, NC 27302

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("South Mebane Elementary School",'Mebane=' + Mebane.length); Graham[Graham.length] = createMarker(new GPoint(-79.37480164,36.01969910),"
Southern High School
631 Southern High Road
Graham, NC 27253

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Southern High School",'Graham=' + Graham.length); Graham[Graham.length] = createMarker(new GPoint(-79.37480164,36.01969910),"
Southern Middle School
771 Southern High Road
Graham, NC 27253

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Southern Middle School",'Graham=' + Graham.length); Snow_Camp[Snow_Camp.length] = createMarker(new GPoint(-79.41200256,35.90579987),"
Sylvan Elementary School
7718 Sylvan Road
Snow Camp, NC 27349

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sylvan Elementary School",'Snow_Camp=' + Snow_Camp.length); Burlington[Burlington.length] = createMarker(new GPoint(-79.46234131,36.09203339),"
Turrentine Middle School
1710 Edgewood Avenue
Burlington, NC 27215

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Turrentine Middle School",'Burlington=' + Burlington.length); Burlington[Burlington.length] = createMarker(new GPoint(-79.45140839,36.08712006),"
Walter M Williams High School
1307 S Church Street
Burlington, NC 27215

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Walter M Williams High School",'Burlington=' + Burlington.length); Elon[Elon.length] = createMarker(new GPoint(-79.50559998,36.14569855),"
Western Alamance High School
1731 N Nc 87
Elon, NC 27244

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Western Alamance High School",'Elon=' + Elon.length); Elon[Elon.length] = createMarker(new GPoint(-79.50646973,36.15987778),"
Western Middle School
2100 Eldon Drive
Elon, NC 27244

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Western Middle School",'Elon=' + Elon.length); Mebane[Mebane.length] = createMarker(new GPoint(-79.30604553,36.11460876),"
Woodlawn Middle School
3970 Mebane Rogers Road
Mebane, NC 27302

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Woodlawn Middle School",'Mebane=' + Mebane.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(Burlington); map.removeOverlays(Elon); map.removeOverlays(Graham); map.removeOverlays(Haw_River); map.removeOverlays(Mebane); map.removeOverlays(Saxapahaw); map.removeOverlays(Snow_Camp); 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(Graham);map.removeOverlays(Burlington); map.removeOverlays(Elon); map.removeOverlays(Graham); map.removeOverlays(Haw_River); map.removeOverlays(Mebane); map.removeOverlays(Saxapahaw); map.removeOverlays(Snow_Camp); map.addOverlays(Burlington); centerByArray(Burlington, false, false); cntMarker += Burlington.length; map.addOverlays(Elon); centerByArray(Elon, false, false); cntMarker += Elon.length; map.addOverlays(Graham); centerByArray(Graham, false, false); cntMarker += Graham.length; map.addOverlays(Haw_River); centerByArray(Haw_River, false, false); cntMarker += Haw_River.length; map.addOverlays(Mebane); centerByArray(Mebane, false, false); cntMarker += Mebane.length; map.addOverlays(Saxapahaw); centerByArray(Saxapahaw, false, false); cntMarker += Saxapahaw.length; map.addOverlays(Snow_Camp); centerByArray(Snow_Camp, false, false); cntMarker += Snow_Camp.length; centerByArray(Graham,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'); } }