function addMarkers() { mySelect = document.getElementById('selection'); Thomasville = [];Lexington = [];Denton = [];Winston_salem = [];mySelect.options[mySelect.options.length] = new Option("Denton schools",'all=Denton'); mySelect.options[mySelect.options.length] = new Option("Lexington schools",'all=Lexington'); mySelect.options[mySelect.options.length] = new Option("Thomasville schools",'all=Thomasville'); mySelect.options[mySelect.options.length] = new Option("Winston salem schools",'all=Winston_salem'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Thomasville[Thomasville.length] = createMarker(new GPoint(-80.08969879,35.86890030),"
Brier Creek Elementary School
175 Watford Road
Thomasville, NC 27360

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Brier Creek Elementary School",'Thomasville=' + Thomasville.length); Lexington[Lexington.length] = createMarker(new GPoint(-80.25072900,35.82624500),"
Central Davidson Middle School
2591 Nc Hwy 47
Lexington, NC 27292

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Central Davidson Middle School",'Lexington=' + Lexington.length); Lexington[Lexington.length] = createMarker(new GPoint(-80.22237396,35.73911667),"
Central Davidson Senior High School
2747 Nc Hwy 47
Lexington, NC 27292

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Central Davidson Senior High School",'Lexington=' + Lexington.length); Lexington[Lexington.length] = createMarker(new GPoint(-80.25799561,35.80337906),"
Charles England Intermediate
301 Smith Avenue
Lexington, NC 27292

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Charles England Intermediate",'Lexington=' + Lexington.length); Lexington[Lexington.length] = createMarker(new GPoint(-80.41681671,35.78506088),"
Churchland Elementary School
7571 S Nc Hwy 150
Lexington, NC 27295

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Churchland Elementary School",'Lexington=' + Lexington.length); Lexington[Lexington.length] = createMarker(new GPoint(-80.17475128,35.81776810),"
Davidson County Ext Day
2065 E Holly Grove Road
Lexington, NC 27292

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Davidson County Ext Day",'Lexington=' + Lexington.length); Lexington[Lexington.length] = createMarker(new GPoint(-10.00000000,10.00000000),"
Davidson Early College
297 Dccc Road
Lexington, NC 27295

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Davidson Early College",'Lexington=' + Lexington.length); Lexington[Lexington.length] = createMarker(new GPoint(-80.16388702,35.80606842),"
Davis-townsend Elementary School
975 Heath Church Road
Lexington, NC 27292

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Davis-townsend Elementary School",'Lexington=' + Lexington.length); Denton[Denton.length] = createMarker(new GPoint(-80.11830139,35.63357162),"
Denton Elementary School
305 W Salisbury Street
Denton, NC 27239

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Denton Elementary School",'Denton=' + Denton.length); Thomasville[Thomasville.length] = createMarker(new GPoint(-80.09945679,35.84980011),"
E Lawson Brown Middle School
1140 Kendall Mill Road
Thomasville, NC 27360

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("E Lawson Brown Middle School",'Thomasville=' + Thomasville.length); Thomasville[Thomasville.length] = createMarker(new GPoint(-80.10073090,35.85031891),"
East Davidson High School
1408 Lake Road
Thomasville, NC 27360

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("East Davidson High School",'Thomasville=' + Thomasville.length); Thomasville[Thomasville.length] = createMarker(new GPoint(-80.07936859,35.84957504),"
Fair Grove Elementary School
217 Cedar Lodge Road
Thomasville, NC 27360

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fair Grove Elementary School",'Thomasville=' + Thomasville.length); Winston_salem[Winston_salem.length] = createMarker(new GPoint(-80.28221130,35.99361038),"
Friedberg Elementary School
1131 Friedberg Church Road
Winston-salem, NC 27127

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Friedberg Elementary School",'Winston_salem=' + Winston_salem.length); Winston_salem[Winston_salem.length] = createMarker(new GPoint(-80.13996800,35.95490000),"
Friendship Elementary School
1490 Friendship-ledford Rd.
Winston-salem, NC 27107

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Friendship Elementary School",'Winston_salem=' + Winston_salem.length); Thomasville[Thomasville.length] = createMarker(new GPoint(-80.07995605,35.92176056),"
Hasty Elementary School
325 Hasty School Road
Thomasville, NC 27360

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hasty Elementary School",'Thomasville=' + Thomasville.length); Thomasville[Thomasville.length] = createMarker(new GPoint(-80.12133789,35.94804764),"
Ledford Middle School
3954 N Nc Hwy 109
Thomasville, NC 27360

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Ledford Middle School",'Thomasville=' + Thomasville.length); Thomasville[Thomasville.length] = createMarker(new GPoint(-80.13381195,35.96436310),"
Ledford Senior High School
140 Jesse Green Road
Thomasville, NC 27360

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ledford Senior High School",'Thomasville=' + Thomasville.length); Lexington[Lexington.length] = createMarker(new GPoint(-80.24647522,35.83099747),"
Lexington Middle School
100 W Hemstead Street
Lexington, NC 27292

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Lexington Middle School",'Lexington=' + Lexington.length); Lexington[Lexington.length] = createMarker(new GPoint(-80.25012207,35.83264923),"
Lexington Senior High School
26 Penry Street
Lexington, NC 27292

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lexington Senior High School",'Lexington=' + Lexington.length); Thomasville[Thomasville.length] = createMarker(new GPoint(-80.06582642,35.87920380),"
Liberty Drive Elementary School
401 Liberty Drive
Thomasville, NC 27360

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Liberty Drive Elementary School",'Thomasville=' + Thomasville.length); Lexington[Lexington.length] = createMarker(new GPoint(-80.21576691,35.95313263),"
Midway Elementary School
318 Midway School Road
Lexington, NC 27295

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Midway Elementary School",'Lexington=' + Lexington.length); Lexington[Lexington.length] = createMarker(new GPoint(-80.24507904,35.92596436),"
North Davidson Middle School
333 Critcher Drive
Lexington, NC 27295

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("North Davidson Middle School",'Lexington=' + Lexington.length); Lexington[Lexington.length] = createMarker(new GPoint(-80.24716949,35.92259979),"
North Davidson Senior High School
7227 Old Us Hwy 52
Lexington, NC 27295

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("North Davidson Senior High School",'Lexington=' + Lexington.length); Lexington[Lexington.length] = createMarker(new GPoint(-80.30201721,35.94252777),"
Northwest Elementary School
400 Northwest Elementary Road
Lexington, NC 27295

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Northwest Elementary School",'Lexington=' + Lexington.length); Lexington[Lexington.length] = createMarker(new GPoint(-80.26406860,35.84523773),"
Pickett Primary
200 Biesecker Road
Lexington, NC 27292

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pickett Primary",'Lexington=' + Lexington.length); Thomasville[Thomasville.length] = createMarker(new GPoint(-80.13504791,35.87786484),"
Pilot Elementary School
145 Pilot School Road
Thomasville, NC 27360

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pilot Elementary School",'Thomasville=' + Thomasville.length); Lexington[Lexington.length] = createMarker(new GPoint(-80.33338165,35.84329987),"
Reeds Elementary School
791 South Nc Hwy 150
Lexington, NC 27295

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Reeds Elementary School",'Lexington=' + Lexington.length); Lexington[Lexington.length] = createMarker(new GPoint(-80.25359344,35.82376862),"
Silver Valley Elementary School
11161 East Old Hwy 64
Lexington, NC 27292

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Silver Valley Elementary School",'Lexington=' + Lexington.length); Denton[Denton.length] = createMarker(new GPoint(-80.09994507,35.67672348),"
South Davidson High School
14956 South Nc Hwy 109
Denton, NC 27239

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("South Davidson High School",'Denton=' + Denton.length); Denton[Denton.length] = createMarker(new GPoint(-80.09763900,35.57810900),"
South Davidson Middle School
14954 Nc Hwy 109 South
Denton, NC 27239

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("South Davidson Middle School",'Denton=' + Denton.length); Lexington[Lexington.length] = createMarker(new GPoint(-80.26240800,35.79703900),"
South Lexington Dvlpmnt Center
1006 Cotton Grove Rd.
Lexington, NC 27292

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("South Lexington Dvlpmnt Center",'Lexington=' + Lexington.length); Lexington[Lexington.length] = createMarker(new GPoint(-80.26266479,35.79766464),"
South Lexington/develop Wing Elementary School
1000 Cotton Grove Road
Lexington, NC 27292

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("South Lexington/develop Wing Elementary School",'Lexington=' + Lexington.length); Lexington[Lexington.length] = createMarker(new GPoint(-80.28152400,35.81844500),"
Southwest Elementary School
434 Central Avenue
Lexington, NC 27292

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Southwest Elementary School",'Lexington=' + Lexington.length); Lexington[Lexington.length] = createMarker(new GPoint(-80.26652527,35.72159958),"
Southwood Elementary School
5850 Nc Hwy 8
Lexington, NC 27292

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Southwood Elementary School",'Lexington=' + Lexington.length); Lexington[Lexington.length] = createMarker(new GPoint(-80.19938660,35.81786346),"
Stoner-thomas School
215 County School Road
Lexington, NC 27292

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Stoner-thomas School",'Lexington=' + Lexington.length); Thomasville[Thomasville.length] = createMarker(new GPoint(-80.08029938,35.89865875),"
Thomasville High School
410 Unity Street
Thomasville, NC 27360

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Thomasville High School",'Thomasville=' + Thomasville.length); Thomasville[Thomasville.length] = createMarker(new GPoint(-80.08059692,35.89870834),"
Thomasville Middle School
400 Unity Street
Thomasville, NC 27360

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Thomasville Middle School",'Thomasville=' + Thomasville.length); Thomasville[Thomasville.length] = createMarker(new GPoint(-80.06108856,35.87804031),"
Thomasville Primary
915 E Sunrise Avenue
Thomasville, NC 27360

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Thomasville Primary",'Thomasville=' + Thomasville.length); Lexington[Lexington.length] = createMarker(new GPoint(-80.37215424,35.80434418),"
Tyro Middle School
2946 Michael Road
Lexington, NC 27295

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Tyro Middle School",'Lexington=' + Lexington.length); Winston_salem[Winston_salem.length] = createMarker(new GPoint(-80.14207458,36.00862503),"
Wallburg Elementary School
205 Motsinger Road
Winston-salem, NC 27107

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wallburg Elementary School",'Winston_salem=' + Winston_salem.length); Lexington[Lexington.length] = createMarker(new GPoint(-80.25359344,35.82376862),"
Welcome Elementary School
5701 Old Hwy 52
Lexington, NC 27295

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Welcome Elementary School",'Lexington=' + Lexington.length); Lexington[Lexington.length] = createMarker(new GPoint(-80.37062836,35.80689621),"
West Davidson High School
200 Dragon Drive
Lexington, NC 27295

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("West Davidson High School",'Lexington=' + Lexington.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(Denton); map.removeOverlays(Lexington); map.removeOverlays(Thomasville); map.removeOverlays(Winston_salem); 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(Thomasville);map.removeOverlays(Denton); map.removeOverlays(Lexington); map.removeOverlays(Thomasville); map.removeOverlays(Winston_salem); map.addOverlays(Denton); centerByArray(Denton, false, false); cntMarker += Denton.length; map.addOverlays(Lexington); centerByArray(Lexington, false, false); cntMarker += Lexington.length; map.addOverlays(Thomasville); centerByArray(Thomasville, false, false); cntMarker += Thomasville.length; map.addOverlays(Winston_salem); centerByArray(Winston_salem, false, false); cntMarker += Winston_salem.length; centerByArray(Thomasville,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'); } }