function addMarkers() { mySelect = document.getElementById('selection'); Xenia = [];Fairborn = [];Beavercreek = [];Bellbrook = [];Cedarville = [];Jamestown = [];Yellow_Springs = [];mySelect.options[mySelect.options.length] = new Option("Beavercreek schools",'all=Beavercreek'); mySelect.options[mySelect.options.length] = new Option("Bellbrook schools",'all=Bellbrook'); mySelect.options[mySelect.options.length] = new Option("Cedarville schools",'all=Cedarville'); mySelect.options[mySelect.options.length] = new Option("Fairborn schools",'all=Fairborn'); mySelect.options[mySelect.options.length] = new Option("Jamestown schools",'all=Jamestown'); mySelect.options[mySelect.options.length] = new Option("Xenia schools",'all=Xenia'); mySelect.options[mySelect.options.length] = new Option("Yellow Springs schools",'all=Yellow_Springs'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Xenia[Xenia.length] = createMarker(new GPoint(-83.95820618,39.67556000),"
Arrowood Elementary School
1694 Pawnee Dr
Xenia, OH 45385

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Arrowood Elementary School",'Xenia=' + Xenia.length); Fairborn[Fairborn.length] = createMarker(new GPoint(-84.01365662,39.82754898),"
Baker Junior High School
200 Lincoln Dr
Fairborn, OH 45324

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Baker Junior High School",'Fairborn=' + Fairborn.length); Beavercreek[Beavercreek.length] = createMarker(new GPoint(-84.03238678,39.71898651),"
Beavercreek High School
2660 Dayton Xenia Rd
Beavercreek, OH 45434

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Beavercreek High School",'Beavercreek=' + Beavercreek.length); Bellbrook[Bellbrook.length] = createMarker(new GPoint(-84.06941223,39.65161133),"
Bell Creek Elementary School
3757 Upper Bellbrook Rd
Bellbrook, OH 45305

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Bell Creek Elementary School",'Bellbrook=' + Bellbrook.length); Bellbrook[Bellbrook.length] = createMarker(new GPoint(-84.06924438,39.65374756),"
Bellbrook High School
3737 Upper Bellbrook Rd
Bellbrook, OH 45305

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bellbrook High School",'Bellbrook=' + Bellbrook.length); Bellbrook[Bellbrook.length] = createMarker(new GPoint(-84.06954193,39.64989471),"
Bellbrook Junior High School
3777 Upper Bellbrook Rd
Bellbrook, OH 45305

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Bellbrook Junior High School",'Bellbrook=' + Bellbrook.length); Fairborn[Fairborn.length] = createMarker(new GPoint(-83.98833466,39.83086014),"
Black Lane Elementary School
700 Black Ln
Fairborn, OH 45324

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Black Lane Elementary School",'Fairborn=' + Fairborn.length); Cedarville[Cedarville.length] = createMarker(new GPoint(-83.79799652,39.74570084),"
Cedarville Elementary School
248 N. Main St
Cedarville, OH 45314

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cedarville Elementary School",'Cedarville=' + Cedarville.length); Cedarville[Cedarville.length] = createMarker(new GPoint(-83.79799652,39.74570084),"
Cedarville High School
Po Box 45
Cedarville, OH 45314

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cedarville High School",'Cedarville=' + Cedarville.length); Xenia[Xenia.length] = createMarker(new GPoint(-83.92711639,39.69040680),"
Central Middle School
425 Edison Blvd
Xenia, OH 45385

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Central Middle School",'Xenia=' + Xenia.length); Xenia[Xenia.length] = createMarker(new GPoint(-83.94442749,39.68787003),"
Cox Elementary School
506 Dayton Ave
Xenia, OH 45385

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cox Elementary School",'Xenia=' + Xenia.length); Fairborn[Fairborn.length] = createMarker(new GPoint(-84.01353455,39.82835770),"
East Sixth School
100 Lincoln Dr
Fairborn, OH 45324

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("East Sixth School",'Fairborn=' + Fairborn.length); Fairborn[Fairborn.length] = createMarker(new GPoint(-84.02517700,39.81779861),"
Fairborn Digital Academy
306 E Whittier Ave
Fairborn, OH 45324

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fairborn Digital Academy",'Fairborn=' + Fairborn.length); Fairborn[Fairborn.length] = createMarker(new GPoint(-83.95919800,39.78971863),"
Fairborn High School
900 E Dayton Yellow Springs Rd
Fairborn, OH 45324

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fairborn High School",'Fairborn=' + Fairborn.length); Fairborn[Fairborn.length] = createMarker(new GPoint(-84.01557159,39.80917740),"
Fairborn Intermediate School
25 Dellwood Dr
Fairborn, OH 45324

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fairborn Intermediate School",'Fairborn=' + Fairborn.length); Fairborn[Fairborn.length] = createMarker(new GPoint(-84.02635193,39.79256821),"
Fairborn Primary School
4 W Dayton Yellow Springs Rd
Fairborn, OH 45324

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fairborn Primary School",'Fairborn=' + Fairborn.length); Beavercreek[Beavercreek.length] = createMarker(new GPoint(-84.06590271,39.69800186),"
Fairbrook Elementary School
260 N Fairfield Rd
Beavercreek, OH 45430

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fairbrook Elementary School",'Beavercreek=' + Beavercreek.length); Beavercreek[Beavercreek.length] = createMarker(new GPoint(-84.03365326,39.71948624),"
Ferguson Middle School
2680 Dayton Xenia Rd
Beavercreek, OH 45434

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Ferguson Middle School",'Beavercreek=' + Beavercreek.length); Xenia[Xenia.length] = createMarker(new GPoint(-83.94720459,39.76972580),"
Greene County Career Center
2960 W Enon Rd
Xenia, OH 45385

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Greene County Career Center",'Xenia=' + Xenia.length); Jamestown[Jamestown.length] = createMarker(new GPoint(-83.75881195,39.65563583),"
Greeneview High School
4710 Cottonville Rd
Jamestown, OH 45335

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Greeneview High School",'Jamestown=' + Jamestown.length); Jamestown[Jamestown.length] = createMarker(new GPoint(-83.73474121,39.66326904),"
Greeneview Intermediate School
53 N Limestone St
Jamestown, OH 45335

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Greeneview Intermediate School",'Jamestown=' + Jamestown.length); Jamestown[Jamestown.length] = createMarker(new GPoint(-83.69673157,39.72172546),"
Greeneview North Elementary School
1795 S Charleston Rd
Jamestown, OH 45335

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Greeneview North Elementary School",'Jamestown=' + Jamestown.length); Jamestown[Jamestown.length] = createMarker(new GPoint(-83.73464203,39.66304016),"
Greeneview Primary School
51 N Limestone St
Jamestown, OH 45335

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Greeneview Primary School",'Jamestown=' + Jamestown.length); Jamestown[Jamestown.length] = createMarker(new GPoint(-83.72907257,39.58061981),"
Greeneview South Elementary School
5619 Hussey Rd
Jamestown, OH 45335

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Greeneview South Elementary School",'Jamestown=' + Jamestown.length); Beavercreek[Beavercreek.length] = createMarker(new GPoint(-84.09051514,39.71417999),"
Herman K Ankeney Middle School
4085 Shakertown Rd
Beavercreek, OH 45430

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Herman K Ankeney Middle School",'Beavercreek=' + Beavercreek.length); Beavercreek[Beavercreek.length] = createMarker(new GPoint(-84.04430389,39.72353745),"
Main Elementary School
2942 Dayton Xenia Rd
Beavercreek, OH 45434

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Main Elementary School",'Beavercreek=' + Beavercreek.length); Xenia[Xenia.length] = createMarker(new GPoint(-83.97040558,39.67148590),"
Mckinley Elementary School
819 Colorado Dr
Xenia, OH 45385

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mckinley Elementary School",'Xenia=' + Xenia.length); Yellow_Springs[Yellow_Springs.length] = createMarker(new GPoint(-83.89041138,39.80519104),"
Mills Lawn Elementary School
200 S Walnut St
Yellow Springs, OH 45387

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mills Lawn Elementary School",'Yellow_Springs=' + Yellow_Springs.length); Beavercreek[Beavercreek.length] = createMarker(new GPoint(-84.09834290,39.74456787),"
Parkwood Elementary School
1791 Wilene Dr
Beavercreek, OH 45432

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Parkwood Elementary School",'Beavercreek=' + Beavercreek.length); Beavercreek[Beavercreek.length] = createMarker(new GPoint(-84.06404877,39.75602341),"
Shaw Elementary School
3560 Kemp Rd
Beavercreek, OH 45431

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Shaw Elementary School",'Beavercreek=' + Beavercreek.length); Xenia[Xenia.length] = createMarker(new GPoint(-83.92973328,39.69500351),"
Shawnee Elementary School
92 E Ankeney Mill Rd
Xenia, OH 45385

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Shawnee Elementary School",'Xenia=' + Xenia.length); Xenia[Xenia.length] = createMarker(new GPoint(-83.94889069,39.68178558),"
Simon Kenton Elementary School
1087 W 2nd St
Xenia, OH 45385

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Simon Kenton Elementary School",'Xenia=' + Xenia.length); Xenia[Xenia.length] = createMarker(new GPoint(-83.92774200,39.67499161),"
Spring Hill Elementary School
860 Ormsby Dr
Xenia, OH 45385

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Spring Hill Elementary School",'Xenia=' + Xenia.length); Bellbrook[Bellbrook.length] = createMarker(new GPoint(-84.09386444,39.64080811),"
Stephen Bell Elementary School
4122 N Linda Dr
Bellbrook, OH 45305

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Stephen Bell Elementary School",'Bellbrook=' + Bellbrook.length); Bellbrook[Bellbrook.length] = createMarker(new GPoint(-84.06932068,39.63454056),"
Sugarcreek Elementary School
51 S East St
Bellbrook, OH 45305

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sugarcreek Elementary School",'Bellbrook=' + Bellbrook.length); Xenia[Xenia.length] = createMarker(new GPoint(-83.93144226,39.67336273),"
Summit Academy-xenia Elementary School
870 S Detroit St
Xenia, OH 45385

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Summit Academy-xenia Elementary School",'Xenia=' + Xenia.length); Xenia[Xenia.length] = createMarker(new GPoint(-83.93441010,39.71369171),"
Tecumseh Elementary School
1058 Old Springfield Pike
Xenia, OH 45385

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Tecumseh Elementary School",'Xenia=' + Xenia.length); Beavercreek[Beavercreek.length] = createMarker(new GPoint(-84.07028961,39.71766663),"
Valley Elementary School
3601 Jonathon Dr
Beavercreek, OH 45434

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Valley Elementary School",'Beavercreek=' + Beavercreek.length); Xenia[Xenia.length] = createMarker(new GPoint(-83.95623016,39.67890549),"
Warner Middle School
600 Buckskin Trl
Xenia, OH 45385

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Warner Middle School",'Xenia=' + Xenia.length); Fairborn[Fairborn.length] = createMarker(new GPoint(-84.03272247,39.79018784),"
Wright Elementary School
480 W Funderburg Rd
Fairborn, OH 45324

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wright Elementary School",'Fairborn=' + Fairborn.length); Xenia[Xenia.length] = createMarker(new GPoint(-83.92254639,39.71327972),"
Xenia High School
303 Kinsey Rd
Xenia, OH 45385

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Xenia High School",'Xenia=' + Xenia.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(Beavercreek); map.removeOverlays(Bellbrook); map.removeOverlays(Cedarville); map.removeOverlays(Fairborn); map.removeOverlays(Jamestown); map.removeOverlays(Xenia); map.removeOverlays(Yellow_Springs); 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(Xenia);map.removeOverlays(Beavercreek); map.removeOverlays(Bellbrook); map.removeOverlays(Cedarville); map.removeOverlays(Fairborn); map.removeOverlays(Jamestown); map.removeOverlays(Xenia); map.removeOverlays(Yellow_Springs); map.addOverlays(Beavercreek); centerByArray(Beavercreek, false, false); cntMarker += Beavercreek.length; map.addOverlays(Bellbrook); centerByArray(Bellbrook, false, false); cntMarker += Bellbrook.length; map.addOverlays(Cedarville); centerByArray(Cedarville, false, false); cntMarker += Cedarville.length; map.addOverlays(Fairborn); centerByArray(Fairborn, false, false); cntMarker += Fairborn.length; map.addOverlays(Jamestown); centerByArray(Jamestown, false, false); cntMarker += Jamestown.length; map.addOverlays(Xenia); centerByArray(Xenia, false, false); cntMarker += Xenia.length; map.addOverlays(Yellow_Springs); centerByArray(Yellow_Springs, false, false); cntMarker += Yellow_Springs.length; centerByArray(Xenia,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'); } }