function addMarkers() { mySelect = document.getElementById('selection'); Hendersonville = [];Dana = [];East_Flat_Rock = [];Etowah = [];Fletcher = [];Horse_Shoe = [];Flat_Rock = [];mySelect.options[mySelect.options.length] = new Option("Dana schools",'all=Dana'); mySelect.options[mySelect.options.length] = new Option("East Flat Rock schools",'all=East_Flat_Rock'); mySelect.options[mySelect.options.length] = new Option("Etowah schools",'all=Etowah'); mySelect.options[mySelect.options.length] = new Option("Flat Rock schools",'all=Flat_Rock'); mySelect.options[mySelect.options.length] = new Option("Fletcher schools",'all=Fletcher'); mySelect.options[mySelect.options.length] = new Option("Hendersonville schools",'all=Hendersonville'); mySelect.options[mySelect.options.length] = new Option("Horse Shoe schools",'all=Horse_Shoe'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Hendersonville[Hendersonville.length] = createMarker(new GPoint(-82.42009735,35.36197662),"
Apple Valley Middle School
43 Fruitland Rd
Hendersonville, NC 28792

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Apple Valley Middle School",'Hendersonville=' + Hendersonville.length); Hendersonville[Hendersonville.length] = createMarker(new GPoint(-82.49491882,35.28393173),"
Atkinson Elementary School
2510 Old Kanuga Road
Hendersonville, NC 28739

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Atkinson Elementary School",'Hendersonville=' + Hendersonville.length); Hendersonville[Hendersonville.length] = createMarker(new GPoint(-82.47431946,35.34811020),"
Balfour Elementary School
2529 Asheville Hwy
Hendersonville, NC 28791

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Balfour Elementary School",'Hendersonville=' + Hendersonville.length); Hendersonville[Hendersonville.length] = createMarker(new GPoint(-82.46187592,35.32210159),"
Bruce Drysdale Elementary School
834 N Main St
Hendersonville, NC 28792

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bruce Drysdale Elementary School",'Hendersonville=' + Hendersonville.length); Hendersonville[Hendersonville.length] = createMarker(new GPoint(-82.40149689,35.38891983),"
Clear Creek Elementary School
737 N Clear Creek Road
Hendersonville, NC 28792

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Clear Creek Elementary School",'Hendersonville=' + Hendersonville.length); Dana[Dana.length] = createMarker(new GPoint(-82.38905334,35.28514862),"
Dana Elementary School
690 Ridge Road
Dana, NC 28724

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Dana Elementary School",'Dana=' + Dana.length); East_Flat_Rock[East_Flat_Rock.length] = createMarker(new GPoint(-82.41660309,35.29370117),"
East Henderson High School
110 Old Upward Road
East Flat Rock, NC 28726

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("East Henderson High School",'East_Flat_Rock=' + East_Flat_Rock.length); Hendersonville[Hendersonville.length] = createMarker(new GPoint(-82.39025879,35.34590149),"
Edneyville Elementary School
2875 Pace Road
Hendersonville, NC 28792

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Edneyville Elementary School",'Hendersonville=' + Hendersonville.length); Etowah[Etowah.length] = createMarker(new GPoint(-82.58866119,35.31440353),"
Etowah Elementary School
320 Etowah School Road
Etowah, NC 28729

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Etowah Elementary School",'Etowah=' + Etowah.length); East_Flat_Rock[East_Flat_Rock.length] = createMarker(new GPoint(-82.40820312,35.28319931),"
Flat Rock Middle School
191 Preston Lane
East Flat Rock, NC 28726

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Flat Rock Middle School",'East_Flat_Rock=' + East_Flat_Rock.length); Fletcher[Fletcher.length] = createMarker(new GPoint(-82.49526978,35.40917969),"
Fletcher Elementary School
500 Howard Gap Road
Fletcher, NC 28732

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fletcher Elementary School",'Fletcher=' + Fletcher.length); Fletcher[Fletcher.length] = createMarker(new GPoint(-82.55523682,35.40869904),"
Glenn C Marlow Elementary School
1985 Butler Bridge Road
Fletcher, NC 28732

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Glenn C Marlow Elementary School",'Fletcher=' + Fletcher.length); Hendersonville[Hendersonville.length] = createMarker(new GPoint(-82.47468567,35.32236862),"
Hendersonville Elementary School
1039 Randall Circle
Hendersonville, NC 28791

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hendersonville Elementary School",'Hendersonville=' + Hendersonville.length); Hendersonville[Hendersonville.length] = createMarker(new GPoint(-82.46389008,35.32111359),"
Hendersonville High School
311 8th Avenue W
Hendersonville, NC 28791

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hendersonville High School",'Hendersonville=' + Hendersonville.length); Hendersonville[Hendersonville.length] = createMarker(new GPoint(-82.47203400,35.32196100),"
Hendersonville Middle School
825 North Whitted Street
Hendersonville, NC 28791

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Hendersonville Middle School",'Hendersonville=' + Hendersonville.length); East_Flat_Rock[East_Flat_Rock.length] = createMarker(new GPoint(-82.40820312,35.28319931),"
Hillandale Elementary School
504 Preston Lane
East Flat Rock, NC 28726

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hillandale Elementary School",'East_Flat_Rock=' + East_Flat_Rock.length); Horse_Shoe[Horse_Shoe.length] = createMarker(new GPoint(-82.56434631,35.37755203),"
Mills River Elementary School
96 School House Road
Horse Shoe, NC 28742

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mills River Elementary School",'Horse_Shoe=' + Horse_Shoe.length); Hendersonville[Hendersonville.length] = createMarker(new GPoint(-82.41179657,35.36080170),"
Mountain Community School
613 Glover Street
Hendersonville, NC 28792

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mountain Community School",'Hendersonville=' + Hendersonville.length); Hendersonville[Hendersonville.length] = createMarker(new GPoint(-82.42016602,35.36143112),"
North Henderson High School
35 Fruitland Road
Hendersonville, NC 28792

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("North Henderson High School",'Hendersonville=' + Hendersonville.length); Hendersonville[Hendersonville.length] = createMarker(new GPoint(-82.50917053,35.35717392),"
Rugby Middle School
3345 Haywood Road
Hendersonville, NC 28791

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Rugby Middle School",'Hendersonville=' + Hendersonville.length); Hendersonville[Hendersonville.length] = createMarker(new GPoint(-82.42189789,35.22919846),"
Tuxedo Extended Day
2529 Asheville Highway
Hendersonville, NC 28792

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tuxedo Extended Day",'Hendersonville=' + Hendersonville.length); Flat_Rock[Flat_Rock.length] = createMarker(new GPoint(-82.41500092,35.29719925),"
Upward Elementary School
45 Education Drive
Flat Rock, NC 28731

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Upward Elementary School",'Flat_Rock=' + Flat_Rock.length); Hendersonville[Hendersonville.length] = createMarker(new GPoint(-82.50576019,35.35526276),"
West Henderson High School
3600 Haywood Road
Hendersonville, NC 28791

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("West Henderson High School",'Hendersonville=' + Hendersonville.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(Dana); map.removeOverlays(East_Flat_Rock); map.removeOverlays(Etowah); map.removeOverlays(Flat_Rock); map.removeOverlays(Fletcher); map.removeOverlays(Hendersonville); map.removeOverlays(Horse_Shoe); 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(Hendersonville);map.removeOverlays(Dana); map.removeOverlays(East_Flat_Rock); map.removeOverlays(Etowah); map.removeOverlays(Flat_Rock); map.removeOverlays(Fletcher); map.removeOverlays(Hendersonville); map.removeOverlays(Horse_Shoe); map.addOverlays(Dana); centerByArray(Dana, false, false); cntMarker += Dana.length; map.addOverlays(East_Flat_Rock); centerByArray(East_Flat_Rock, false, false); cntMarker += East_Flat_Rock.length; map.addOverlays(Etowah); centerByArray(Etowah, false, false); cntMarker += Etowah.length; map.addOverlays(Flat_Rock); centerByArray(Flat_Rock, false, false); cntMarker += Flat_Rock.length; map.addOverlays(Fletcher); centerByArray(Fletcher, false, false); cntMarker += Fletcher.length; map.addOverlays(Hendersonville); centerByArray(Hendersonville, false, false); cntMarker += Hendersonville.length; map.addOverlays(Horse_Shoe); centerByArray(Horse_Shoe, false, false); cntMarker += Horse_Shoe.length; centerByArray(Hendersonville,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'); } }