function addMarkers() { mySelect = document.getElementById('selection'); Peachtree_City = [];Brooks = [];Fayetteville = [];Tyrone = [];mySelect.options[mySelect.options.length] = new Option("Brooks schools",'all=Brooks'); mySelect.options[mySelect.options.length] = new Option("Fayetteville schools",'all=Fayetteville'); mySelect.options[mySelect.options.length] = new Option("Peachtree City schools",'all=Peachtree_City'); mySelect.options[mySelect.options.length] = new Option("Tyrone schools",'all=Tyrone'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Peachtree_City[Peachtree_City.length] = createMarker(new GPoint(-84.56784058,33.40629578),"
Booth Middle School
250 Peachtree Parkway South
Peachtree City, GA 30269

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Booth Middle School",'Peachtree_City=' + Peachtree_City.length); Peachtree_City[Peachtree_City.length] = createMarker(new GPoint(-84.54632568,33.38907242),"
Braelinn Elementary School
975 Robinson Road
Peachtree City, GA 30269

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Braelinn Elementary School",'Peachtree_City=' + Peachtree_City.length); Brooks[Brooks.length] = createMarker(new GPoint(-84.46468353,33.29053879),"
Brooks Elementary School
Price Road , Box 1
Brooks, GA 30205

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Brooks Elementary School",'Brooks=' + Brooks.length); Fayetteville[Fayetteville.length] = createMarker(new GPoint(-84.50904846,33.44042206),"
Cleveland Elementary School
190 Lester Road
Fayetteville, GA 30215

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cleveland Elementary School",'Fayetteville=' + Fayetteville.length); Peachtree_City[Peachtree_City.length] = createMarker(new GPoint(-84.55734253,33.38869858),"
Crabapple Lane Elementary School
450 Crabapple Lane
Peachtree City, GA 30269

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Crabapple Lane Elementary School",'Peachtree_City=' + Peachtree_City.length); Fayetteville[Fayetteville.length] = createMarker(new GPoint(-84.44499207,33.44791412),"
East Fayette Elementary School
245 Booker Avenue
Fayetteville, GA 30214

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("East Fayette Elementary School",'Fayetteville=' + Fayetteville.length); Fayetteville[Fayetteville.length] = createMarker(new GPoint(-84.46032715,33.45073318),"
Evening School
205 Lafayette Ave.
Fayetteville, GA 30214

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Evening School",'Fayetteville=' + Fayetteville.length); Fayetteville[Fayetteville.length] = createMarker(new GPoint(-84.55713654,33.38858032),"
Fayette County High School
One Tiger Trail
Fayetteville, GA 30214

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fayette County High School",'Fayetteville=' + Fayetteville.length); Fayetteville[Fayetteville.length] = createMarker(new GPoint(-84.46559143,33.44330215),"
Fayette Middle School
450 Grady Avenue
Fayetteville, GA 30214

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Fayette Middle School",'Fayetteville=' + Fayetteville.length); Fayetteville[Fayetteville.length] = createMarker(new GPoint(-84.46376038,33.45673752),"
Fayetteville Intermediate Elementary School
440 Hood Avenue
Fayetteville, GA 30214

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fayetteville Intermediate Elementary School",'Fayetteville=' + Fayetteville.length); Tyrone[Tyrone.length] = createMarker(new GPoint(-84.57205200,33.49528885),"
Flat Rock Middle School
325 Jenkins Road
Tyrone, GA 30290

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Flat Rock Middle School",'Tyrone=' + Tyrone.length); Fayetteville[Fayetteville.length] = createMarker(new GPoint(-84.46508789,33.45676041),"
Hood Avenue Primary Elementary School
490 Hood Avenue
Fayetteville, GA 30214

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hood Avenue Primary Elementary School",'Fayetteville=' + Fayetteville.length); Peachtree_City[Peachtree_City.length] = createMarker(new GPoint(-84.57104492,33.38423920),"
Huddleston Elementary School
200 Mcintosh Trail
Peachtree City, GA 30269

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Huddleston Elementary School",'Peachtree_City=' + Peachtree_City.length); Peachtree_City[Peachtree_City.length] = createMarker(new GPoint(-84.59999084,33.42955780),"
Kedron Elementary School
200 Kedron Drive
Peachtree City, GA 30269

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Kedron Elementary School",'Peachtree_City=' + Peachtree_City.length); Peachtree_City[Peachtree_City.length] = createMarker(new GPoint(-84.56099701,33.41825485),"
Mcintosh High School
201 Walt Banks Road
Peachtree City, GA 30269

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mcintosh High School",'Peachtree_City=' + Peachtree_City.length); Fayetteville[Fayetteville.length] = createMarker(new GPoint(-84.47042847,33.51094055),"
North Fayette Elementary School
609 Kenwood Road
Fayetteville, GA 30214

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Fayette Elementary School",'Fayetteville=' + Fayetteville.length); Peachtree_City[Peachtree_City.length] = createMarker(new GPoint(-84.54010010,33.38415527),"
Oak Grove Elementary School
101 Crosstown Road
Peachtree City, GA 30269

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Oak Grove Elementary School",'Peachtree_City=' + Peachtree_City.length); Peachtree_City[Peachtree_City.length] = createMarker(new GPoint(-84.59788513,33.40905380),"
Peachtree City Elementary School
201 Wisdom Road
Peachtree City, GA 30269

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Peachtree City Elementary School",'Peachtree_City=' + Peachtree_City.length); Fayetteville[Fayetteville.length] = createMarker(new GPoint(-84.51776123,33.34192657),"
Peeples Elementary School
153 Panther Path
Fayetteville, GA 30215

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Peeples Elementary School",'Fayetteville=' + Fayetteville.length); Fayetteville[Fayetteville.length] = createMarker(new GPoint(-84.51899719,33.34044266),"
Rising Starr Middle School
183 Panther Path
Fayetteville, GA 30215

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Rising Starr Middle School",'Fayetteville=' + Fayetteville.length); Tyrone[Tyrone.length] = createMarker(new GPoint(-84.57231140,33.49504852),"
Robert J. Burch Elementary School
330 Jenkins Road
Tyrone, GA 30290

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Robert J. Burch Elementary School",'Tyrone=' + Tyrone.length); Tyrone[Tyrone.length] = createMarker(new GPoint(-84.57434845,33.49506378),"
Sandy Creek High School
360 Jenkins Road
Tyrone, GA 30290

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sandy Creek High School",'Tyrone=' + Tyrone.length); Fayetteville[Fayetteville.length] = createMarker(new GPoint(-84.47701263,33.37965393),"
Sara Harp Minter Elementary School
1650 Highway 85 South
Fayetteville, GA 30215

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sara Harp Minter Elementary School",'Fayetteville=' + Fayetteville.length); Fayetteville[Fayetteville.length] = createMarker(new GPoint(-84.46883392,33.44447327),"
Spring Hill Elementary School
100 Bradford Square
Fayetteville, GA 30214

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Spring Hill Elementary School",'Fayetteville=' + Fayetteville.length); Fayetteville[Fayetteville.length] = createMarker(new GPoint(-84.52056122,33.34002686),"
Starrs Mill High School
193 Panther Path
Fayetteville, GA 30215

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Starrs Mill High School",'Fayetteville=' + Fayetteville.length); Tyrone[Tyrone.length] = createMarker(new GPoint(-84.59709167,33.47543335),"
Tyrone Elementary School
876 Senoia Road
Tyrone, GA 30290

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Tyrone Elementary School",'Tyrone=' + Tyrone.length); Fayetteville[Fayetteville.length] = createMarker(new GPoint(-84.47081700,33.37674000),"
Whitewater High School
100 Wildcat Way
Fayetteville, GA 30215

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Whitewater High School",'Fayetteville=' + Fayetteville.length); Fayetteville[Fayetteville.length] = createMarker(new GPoint(-84.47166443,33.38781357),"
Whitewater Middle School
1533 Highway 85 South
Fayetteville, GA 30214

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Whitewater Middle School",'Fayetteville=' + Fayetteville.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(Brooks); map.removeOverlays(Fayetteville); map.removeOverlays(Peachtree_City); map.removeOverlays(Tyrone); 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(Peachtree_City);map.removeOverlays(Brooks); map.removeOverlays(Fayetteville); map.removeOverlays(Peachtree_City); map.removeOverlays(Tyrone); map.addOverlays(Brooks); centerByArray(Brooks, false, false); cntMarker += Brooks.length; map.addOverlays(Fayetteville); centerByArray(Fayetteville, false, false); cntMarker += Fayetteville.length; map.addOverlays(Peachtree_City); centerByArray(Peachtree_City, false, false); cntMarker += Peachtree_City.length; map.addOverlays(Tyrone); centerByArray(Tyrone, false, false); cntMarker += Tyrone.length; centerByArray(Peachtree_City,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'); } }