function addMarkers() { mySelect = document.getElementById('selection'); Spindale = [];Forest_City = [];Cliffside = [];Bostic = [];Ellenboro = [];Rutherfordton = [];Mooresboro = [];mySelect.options[mySelect.options.length] = new Option("Bostic schools",'all=Bostic'); mySelect.options[mySelect.options.length] = new Option("Cliffside schools",'all=Cliffside'); mySelect.options[mySelect.options.length] = new Option("Ellenboro schools",'all=Ellenboro'); mySelect.options[mySelect.options.length] = new Option("Forest City schools",'all=Forest_City'); mySelect.options[mySelect.options.length] = new Option("Mooresboro schools",'all=Mooresboro'); mySelect.options[mySelect.options.length] = new Option("Rutherfordton schools",'all=Rutherfordton'); mySelect.options[mySelect.options.length] = new Option("Spindale schools",'all=Spindale'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Spindale[Spindale.length] = createMarker(new GPoint(-81.91900635,35.35968781),"
Carver Center
900 Carver St
Spindale, NC 28160

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Carver Center",'Spindale=' + Spindale.length); Forest_City[Forest_City.length] = createMarker(new GPoint(-81.84482574,35.24975586),"
Chase High School
1603 Chase High Road
Forest City, NC 28043

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Chase High School",'Forest_City=' + Forest_City.length); Forest_City[Forest_City.length] = createMarker(new GPoint(-81.84446716,35.27038956),"
Chase Middle School
840 Chase High Road
Forest City, NC 28043

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Chase Middle School",'Forest_City=' + Forest_City.length); Cliffside[Cliffside.length] = createMarker(new GPoint(-81.76999664,35.23799896),"
Cliffside Elementary School
Po Box 338
Cliffside, NC 28024

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cliffside Elementary School",'Cliffside=' + Cliffside.length); Forest_City[Forest_City.length] = createMarker(new GPoint(-81.85749817,35.30270004),"
East Rutherford High School
Po Box 668
Forest City, NC 28043

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("East Rutherford High School",'Forest_City=' + Forest_City.length); Bostic[Bostic.length] = createMarker(new GPoint(-81.80580139,35.43360138),"
East Rutherford Middle School
Po Box 189
Bostic, NC 28018

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("East Rutherford Middle School",'Bostic=' + Bostic.length); Ellenboro[Ellenboro.length] = createMarker(new GPoint(-81.76170349,35.33300018),"
Ellenboro Elementary School
Po Box 1419
Ellenboro, NC 28040

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ellenboro Elementary School",'Ellenboro=' + Ellenboro.length); Forest_City[Forest_City.length] = createMarker(new GPoint(-81.85749054,35.33048630),"
Forest City Elementary School
140 Old Carolean Road
Forest City, NC 28043

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Forest City Elementary School",'Forest_City=' + Forest_City.length); Forest_City[Forest_City.length] = createMarker(new GPoint(-81.85223389,35.29994965),"
Forrest W Hunt Elementary School
100 Forrest Hunt Drive
Forest City, NC 28043

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Forrest W Hunt Elementary School",'Forest_City=' + Forest_City.length); Forest_City[Forest_City.length] = createMarker(new GPoint(-81.86514282,35.33388138),"
Harris Elementary School
3330 Us 221 S Hwy
Forest City, NC 28043

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Harris Elementary School",'Forest_City=' + Forest_City.length); Forest_City[Forest_City.length] = createMarker(new GPoint(-81.90126801,35.40517044),"
Mt Vernon-ruth Elementary School
2785 Hudlow Road
Forest City, NC 28043

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mt Vernon-ruth Elementary School",'Forest_City=' + Forest_City.length); Forest_City[Forest_City.length] = createMarker(new GPoint(-81.86209869,35.40840149),"
Paul L Dunbar School
286 Learning Parkway
Forest City, NC 28043

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Paul L Dunbar School",'Forest_City=' + Forest_City.length); Rutherfordton[Rutherfordton.length] = createMarker(new GPoint(-82.00672150,35.46107101),"
Pinnacle Elementary School
1204 Painters Gap Road
Rutherfordton, NC 28139

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pinnacle Elementary School",'Rutherfordton=' + Rutherfordton.length); Rutherfordton[Rutherfordton.length] = createMarker(new GPoint(-81.97119904,35.35749817),"
R S Central High School
Po Box 1119
Rutherfordton, NC 28139

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("R S Central High School",'Rutherfordton=' + Rutherfordton.length); Rutherfordton[Rutherfordton.length] = createMarker(new GPoint(-81.97119904,35.35749817),"
R S Middle School
Po Box 1209
Rutherfordton, NC 28139

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("R S Middle School",'Rutherfordton=' + Rutherfordton.length); Spindale[Spindale.length] = createMarker(new GPoint(-81.92917400,35.36284900),"
Rutherford Co Early College High School
Po Box 804
Spindale, NC 28160

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Rutherford Co Early College High School",'Spindale=' + Spindale.length); Ellenboro[Ellenboro.length] = createMarker(new GPoint(-81.95171356,35.38246918),"
Rutherford Opportunity Center
171 Cherry Mt Street
Ellenboro, NC 28040

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Rutherford Opportunity Center",'Ellenboro=' + Ellenboro.length); Rutherfordton[Rutherfordton.length] = createMarker(new GPoint(-81.96117401,35.36545181),"
Rutherfordton Elementary School
134 Maple Street
Rutherfordton, NC 28139

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rutherfordton Elementary School",'Rutherfordton=' + Rutherfordton.length); Spindale[Spindale.length] = createMarker(new GPoint(-81.93161011,35.36000443),"
Spindale Elementary School
201 N Oak St
Spindale, NC 28160

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Spindale Elementary School",'Spindale=' + Spindale.length); Bostic[Bostic.length] = createMarker(new GPoint(-81.80996704,35.45187759),"
Sunshine Elementary School
231 Toney Road
Bostic, NC 28018

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sunshine Elementary School",'Bostic=' + Bostic.length); Mooresboro[Mooresboro.length] = createMarker(new GPoint(-81.75659943,35.24440002),"
Thomas Jefferson Class Academy
2527 Us 221a Hwy
Mooresboro, NC 28114

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Thomas Jefferson Class Academy",'Mooresboro=' + Mooresboro.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(Bostic); map.removeOverlays(Cliffside); map.removeOverlays(Ellenboro); map.removeOverlays(Forest_City); map.removeOverlays(Mooresboro); map.removeOverlays(Rutherfordton); map.removeOverlays(Spindale); 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(Spindale);map.removeOverlays(Bostic); map.removeOverlays(Cliffside); map.removeOverlays(Ellenboro); map.removeOverlays(Forest_City); map.removeOverlays(Mooresboro); map.removeOverlays(Rutherfordton); map.removeOverlays(Spindale); map.addOverlays(Bostic); centerByArray(Bostic, false, false); cntMarker += Bostic.length; map.addOverlays(Cliffside); centerByArray(Cliffside, false, false); cntMarker += Cliffside.length; map.addOverlays(Ellenboro); centerByArray(Ellenboro, false, false); cntMarker += Ellenboro.length; map.addOverlays(Forest_City); centerByArray(Forest_City, false, false); cntMarker += Forest_City.length; map.addOverlays(Mooresboro); centerByArray(Mooresboro, false, false); cntMarker += Mooresboro.length; map.addOverlays(Rutherfordton); centerByArray(Rutherfordton, false, false); cntMarker += Rutherfordton.length; map.addOverlays(Spindale); centerByArray(Spindale, false, false); cntMarker += Spindale.length; centerByArray(Spindale,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'); } }