function addMarkers() { mySelect = document.getElementById('selection'); Kings_Mountain = [];Shelby = [];Lawndale = [];Casar = [];Fallston = [];Shebly = [];Grover = [];mySelect.options[mySelect.options.length] = new Option("Casar schools",'all=Casar'); mySelect.options[mySelect.options.length] = new Option("Fallston schools",'all=Fallston'); mySelect.options[mySelect.options.length] = new Option("Grover schools",'all=Grover'); mySelect.options[mySelect.options.length] = new Option("Kings Mountain schools",'all=Kings_Mountain'); mySelect.options[mySelect.options.length] = new Option("Lawndale schools",'all=Lawndale'); mySelect.options[mySelect.options.length] = new Option("Shebly schools",'all=Shebly'); mySelect.options[mySelect.options.length] = new Option("Shelby schools",'all=Shelby'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Kings_Mountain[Kings_Mountain.length] = createMarker(new GPoint(-81.41339111,35.24705505),"
Bethware Elementary School
115 Bethware Drive
Kings Mountain, NC 28086

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bethware Elementary School",'Kings_Mountain=' + Kings_Mountain.length); Shelby[Shelby.length] = createMarker(new GPoint(-81.65317535,35.23895645),"
Boiling Springs Elementary School
1522 Patrick Avenue
Shelby, NC 28152

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Boiling Springs Elementary School",'Shelby=' + Shelby.length); Lawndale[Lawndale.length] = createMarker(new GPoint(-81.53305054,35.41867447),"
Burns High School
307 E Stagecoach Trail
Lawndale, NC 28090

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Burns High School",'Lawndale=' + Lawndale.length); Lawndale[Lawndale.length] = createMarker(new GPoint(-81.53919983,35.42564774),"
Burns Middle School
215 Shady Grove Road
Lawndale, NC 28090

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Burns Middle School",'Lawndale=' + Lawndale.length); Casar[Casar.length] = createMarker(new GPoint(-81.61940002,35.51979828),"
Casar Elementary School Of Arts
Po Box 128
Casar, NC 28020

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Casar Elementary School Of Arts",'Casar=' + Casar.length); Shelby[Shelby.length] = createMarker(new GPoint(-81.62333679,35.27647018),"
Crest Mid School Of Technology
315 Beaverdam Church Road
Shelby, NC 28150

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Crest Mid School Of Technology",'Shelby=' + Shelby.length); Shelby[Shelby.length] = createMarker(new GPoint(-81.60832977,35.27224350),"
Crest Senior High School
800 Old Boiling Springs
Shelby, NC 28152

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Crest Senior High School",'Shelby=' + Shelby.length); Kings_Mountain[Kings_Mountain.length] = createMarker(new GPoint(-81.35117400,35.24404800),"
Davidson School
500 W Parker Street
Kings Mountain, NC 28086

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Davidson School",'Kings_Mountain=' + Kings_Mountain.length); Kings_Mountain[Kings_Mountain.length] = createMarker(new GPoint(-81.32930756,35.24915695),"
East Elementary School
600 Cleveland Avenue
Kings Mountain, NC 28086

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("East Elementary School",'Kings_Mountain=' + Kings_Mountain.length); Shelby[Shelby.length] = createMarker(new GPoint(-81.49311066,35.28105164),"
Elizabeth Elementary School
220 S Post Road
Shelby, NC 28152

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Elizabeth Elementary School",'Shelby=' + Shelby.length); Fallston[Fallston.length] = createMarker(new GPoint(-81.50160217,35.42879868),"
Fallston Elementary School
Po Box 39
Fallston, NC 28042

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fallston Elementary School",'Fallston=' + Fallston.length); Shelby[Shelby.length] = createMarker(new GPoint(-81.55830383,35.28787613),"
Graham Elementary School
1100 Blanton Street
Shelby, NC 28150

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Graham Elementary School",'Shelby=' + Shelby.length); Shebly[Shebly.length] = createMarker(new GPoint(-81.55838500,35.28775100),"
Graham Elementary School
1100 Blanton Street
Shebly, NC 28105

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Graham Elementary School",'Shebly=' + Shebly.length); Grover[Grover.length] = createMarker(new GPoint(-81.44749451,35.17375946),"
Grover Elementary School
206 Carolina Avenue
Grover, NC 28073

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Grover Elementary School",'Grover=' + Grover.length); Shelby[Shelby.length] = createMarker(new GPoint(-81.56584930,35.26644897),"
James Love Elementary School
309 James Love Road
Shelby, NC 28152

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("James Love Elementary School",'Shelby=' + Shelby.length); Shelby[Shelby.length] = createMarker(new GPoint(-81.51330566,35.30312347),"
Jefferson Elementary School
1166 Wyke Road
Shelby, NC 28150

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jefferson Elementary School",'Shelby=' + Shelby.length); Kings_Mountain[Kings_Mountain.length] = createMarker(new GPoint(-81.36660004,35.24089813),"
Kings Mountain High School
Po Box 1489
Kings Mountain, NC 28086

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kings Mountain High School",'Kings_Mountain=' + Kings_Mountain.length); Kings_Mountain[Kings_Mountain.length] = createMarker(new GPoint(-81.37998962,35.23506165),"
Kings Mountain Intermediate
227 Kings Mountain Boulevard
Kings Mountain, NC 28086

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Kings Mountain Intermediate",'Kings_Mountain=' + Kings_Mountain.length); Kings_Mountain[Kings_Mountain.length] = createMarker(new GPoint(-81.37300873,35.22938919),"
Kings Mountain Middle School
1000 Phifer Road
Kings Mountain, NC 28086

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Kings Mountain Middle School",'Kings_Mountain=' + Kings_Mountain.length); Shelby[Shelby.length] = createMarker(new GPoint(-81.52585602,35.28926468),"
Marion Elementary School
410 Forest Hill Drive
Shelby, NC 28150

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Marion Elementary School",'Shelby=' + Shelby.length); Kings_Mountain[Kings_Mountain.length] = createMarker(new GPoint(-81.34117889,35.25387573),"
North Elementary School
900 N Ramseur Street
Kings Mountain, NC 28086

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Elementary School",'Kings_Mountain=' + Kings_Mountain.length); Shelby[Shelby.length] = createMarker(new GPoint(-81.53178406,35.31062698),"
North Shelby
1205 Northside Drive
Shelby, NC 28150

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("North Shelby",'Shelby=' + Shelby.length); Shelby[Shelby.length] = createMarker(new GPoint(-81.53862000,35.27741623),"
Shelby High School
230 E Dixon Boulevard
Shelby, NC 28152

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Shelby High School",'Shelby=' + Shelby.length); Shelby[Shelby.length] = createMarker(new GPoint(-81.54455566,35.29224777),"
Shelby Middle School
400 W Marion Street
Shelby, NC 28150

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Shelby Middle School",'Shelby=' + Shelby.length); Shelby[Shelby.length] = createMarker(new GPoint(-81.66575623,35.27564621),"
Springmore Elementary School
616 Mcbrayer Homestead Road
Shelby, NC 28152

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Springmore Elementary School",'Shelby=' + Shelby.length); Shelby[Shelby.length] = createMarker(new GPoint(-81.53419495,35.21968460),"
Township Three Elementary School
526 Davis Road
Shelby, NC 28152

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Township Three Elementary School",'Shelby=' + Shelby.length); Shelby[Shelby.length] = createMarker(new GPoint(-81.61953735,35.38829422),"
Union Elementary School
1440 Union Church Road
Shelby, NC 28150

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Union Elementary School",'Shelby=' + Shelby.length); Shelby[Shelby.length] = createMarker(new GPoint(-81.42166901,35.33201981),"
Washington Math And Science Elementary School
1907 Stony Point Road
Shelby, NC 28150

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Washington Math And Science Elementary School",'Shelby=' + Shelby.length); Kings_Mountain[Kings_Mountain.length] = createMarker(new GPoint(-81.35126495,35.23943710),"
West Elementary School
500 W Mountain Street
Kings Mountain, NC 28086

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West Elementary School",'Kings_Mountain=' + Kings_Mountain.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(Casar); map.removeOverlays(Fallston); map.removeOverlays(Grover); map.removeOverlays(Kings_Mountain); map.removeOverlays(Lawndale); map.removeOverlays(Shebly); map.removeOverlays(Shelby); 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(Kings_Mountain);map.removeOverlays(Casar); map.removeOverlays(Fallston); map.removeOverlays(Grover); map.removeOverlays(Kings_Mountain); map.removeOverlays(Lawndale); map.removeOverlays(Shebly); map.removeOverlays(Shelby); map.addOverlays(Casar); centerByArray(Casar, false, false); cntMarker += Casar.length; map.addOverlays(Fallston); centerByArray(Fallston, false, false); cntMarker += Fallston.length; map.addOverlays(Grover); centerByArray(Grover, false, false); cntMarker += Grover.length; map.addOverlays(Kings_Mountain); centerByArray(Kings_Mountain, false, false); cntMarker += Kings_Mountain.length; map.addOverlays(Lawndale); centerByArray(Lawndale, false, false); cntMarker += Lawndale.length; map.addOverlays(Shebly); centerByArray(Shebly, false, false); cntMarker += Shebly.length; map.addOverlays(Shelby); centerByArray(Shelby, false, false); cntMarker += Shelby.length; centerByArray(Kings_Mountain,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'); } }