function addMarkers() { mySelect = document.getElementById('selection'); Frankfort = [];Chillicothe = [];South_Salem = [];Bainbridge = [];Richmond_Dale = [];mySelect.options[mySelect.options.length] = new Option("Bainbridge schools",'all=Bainbridge'); mySelect.options[mySelect.options.length] = new Option("Chillicothe schools",'all=Chillicothe'); mySelect.options[mySelect.options.length] = new Option("Frankfort schools",'all=Frankfort'); mySelect.options[mySelect.options.length] = new Option("Richmond Dale schools",'all=Richmond_Dale'); mySelect.options[mySelect.options.length] = new Option("South Salem schools",'all=South_Salem'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Frankfort[Frankfort.length] = createMarker(new GPoint(-83.19474030,39.41341400),"
Adena Elementary School
3367 County Road 550
Frankfort, OH 45628

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Adena Elementary School",'Frankfort=' + Frankfort.length); Frankfort[Frankfort.length] = createMarker(new GPoint(-83.19474030,39.41341400),"
Adena High School
3367 County Road 550
Frankfort, OH 45628

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Adena High School",'Frankfort=' + Frankfort.length); Frankfort[Frankfort.length] = createMarker(new GPoint(-83.19474030,39.41341400),"
Adena Middle School
3367 County Road 550
Frankfort, OH 45628

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Adena Middle School",'Frankfort=' + Frankfort.length); Chillicothe[Chillicothe.length] = createMarker(new GPoint(-83.01428986,39.32974625),"
Allen Elementary School
174 Plyleys Ln
Chillicothe, OH 45601

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Allen Elementary School",'Chillicothe=' + Chillicothe.length); South_Salem[South_Salem.length] = createMarker(new GPoint(-83.26010132,39.30730057),"
Buckskin Elementary School
Po Box 69
South Salem, OH 45681

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Buckskin Elementary School",'South_Salem=' + South_Salem.length); Chillicothe[Chillicothe.length] = createMarker(new GPoint(-82.98236084,39.33025360),"
Central Elementary School
40 W 5th St
Chillicothe, OH 45601

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Central Elementary School",'Chillicothe=' + Chillicothe.length); Chillicothe[Chillicothe.length] = createMarker(new GPoint(-82.98881531,39.34130478),"
Chillicothe High School
381 Yoctangee Pkwy
Chillicothe, OH 45601

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Chillicothe High School",'Chillicothe=' + Chillicothe.length); Chillicothe[Chillicothe.length] = createMarker(new GPoint(-82.95887756,39.33815765),"
Hopewell Elementary School
77 Cutright Dr
Chillicothe, OH 45601

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hopewell Elementary School",'Chillicothe=' + Chillicothe.length); Chillicothe[Chillicothe.length] = createMarker(new GPoint(-83.05781555,39.24360657),"
Huntington Elementary School
188 Huntsman Rd
Chillicothe, OH 45601

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Huntington Elementary School",'Chillicothe=' + Chillicothe.length); Chillicothe[Chillicothe.length] = createMarker(new GPoint(-83.05781555,39.24360657),"
Huntington High School
188 Huntsman Rd
Chillicothe, OH 45601

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Huntington High School",'Chillicothe=' + Chillicothe.length); Chillicothe[Chillicothe.length] = createMarker(new GPoint(-83.05781555,39.24360657),"
Huntington Middle School
188 Huntsman Rd
Chillicothe, OH 45601

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Huntington Middle School",'Chillicothe=' + Chillicothe.length); Chillicothe[Chillicothe.length] = createMarker(new GPoint(-83.01883698,39.36857986),"
June V Cormany Learning Cente
1432 Egypt Pike
Chillicothe, OH 45601

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("June V Cormany Learning Cente",'Chillicothe=' + Chillicothe.length); Bainbridge[Bainbridge.length] = createMarker(new GPoint(-83.25235748,39.24323273),"
Light House Youth Center
1071 Tong Hollow Rd
Bainbridge, OH 45612

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Light House Youth Center",'Bainbridge=' + Bainbridge.length); Chillicothe[Chillicothe.length] = createMarker(new GPoint(-82.95078278,39.33097458),"
Mcarthur Elementary School
1049 Columbus St
Chillicothe, OH 45601

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mcarthur Elementary School",'Chillicothe=' + Chillicothe.length); Chillicothe[Chillicothe.length] = createMarker(new GPoint(-82.95917511,39.33672333),"
Mt Logan Elementary School
841 E Main St
Chillicothe, OH 45601

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mt Logan Elementary School",'Chillicothe=' + Chillicothe.length); Bainbridge[Bainbridge.length] = createMarker(new GPoint(-83.21543884,39.24398804),"
Paint Valley Elementary School
7454 Us Highway 50 W
Bainbridge, OH 45612

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Paint Valley Elementary School",'Bainbridge=' + Bainbridge.length); Bainbridge[Bainbridge.length] = createMarker(new GPoint(-83.21543884,39.24398804),"
Paint Valley High School
7454 Us Highway 50 W
Bainbridge, OH 45612

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Paint Valley High School",'Bainbridge=' + Bainbridge.length); Bainbridge[Bainbridge.length] = createMarker(new GPoint(-83.21543884,39.24398804),"
Paint Valley Middle School
7454 Us Highway 50 W
Bainbridge, OH 45612

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Paint Valley Middle School",'Bainbridge=' + Bainbridge.length); Chillicothe[Chillicothe.length] = createMarker(new GPoint(-82.96386719,39.43980026),"
Pickaway-ross Ctc High School
895 Crouse Chapel Rd
Chillicothe, OH 45601

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pickaway-ross Ctc High School",'Chillicothe=' + Chillicothe.length); Richmond_Dale[Richmond_Dale.length] = createMarker(new GPoint(-82.81439972,39.20370102),"
Scioto Valley Intermediate Elementary School
Po Box 108
Richmond Dale, OH 45673

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Scioto Valley Intermediate Elementary School",'Richmond_Dale=' + Richmond_Dale.length); Chillicothe[Chillicothe.length] = createMarker(new GPoint(-82.99393463,39.33913040),"
Smith Middle School
345 Arch St
Chillicothe, OH 45601

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Smith Middle School",'Chillicothe=' + Chillicothe.length); Chillicothe[Chillicothe.length] = createMarker(new GPoint(-82.75209808,39.26850128),"
Southeastern Elementary School
2003 Lancaster Rd
Chillicothe, OH 45601

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Southeastern Elementary School",'Chillicothe=' + Chillicothe.length); Chillicothe[Chillicothe.length] = createMarker(new GPoint(-82.81439972,39.20370102),"
Southeastern High School
2003 Lancaster Rd
Chillicothe, OH 45601

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Southeastern High School",'Chillicothe=' + Chillicothe.length); Chillicothe[Chillicothe.length] = createMarker(new GPoint(-82.86687469,39.19210815),"
Southeastern Middle School
3477 Higby Rd
Chillicothe, OH 45601

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Southeastern Middle School",'Chillicothe=' + Chillicothe.length); Chillicothe[Chillicothe.length] = createMarker(new GPoint(-82.97340393,39.33163452),"
Tiffin Elementary School
145 S Bridge St
Chillicothe, OH 45601

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Tiffin Elementary School",'Chillicothe=' + Chillicothe.length); Chillicothe[Chillicothe.length] = createMarker(new GPoint(-83.01883698,39.36857986),"
Unioto Elementary School
138 Sandusky Blvd
Chillicothe, OH 45601

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Unioto Elementary School",'Chillicothe=' + Chillicothe.length); Chillicothe[Chillicothe.length] = createMarker(new GPoint(-83.01883698,39.36857986),"
Unioto High School
14193 Pleasant Valley Rd
Chillicothe, OH 45601

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Unioto High School",'Chillicothe=' + Chillicothe.length); Chillicothe[Chillicothe.length] = createMarker(new GPoint(-83.01883698,39.36857986),"
Unioto Junior High School
160 Moundsville Rd
Chillicothe, OH 45601

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Unioto Junior High School",'Chillicothe=' + Chillicothe.length); Chillicothe[Chillicothe.length] = createMarker(new GPoint(-82.97740173,39.33089828),"
Western Annex
235 Cherry St
Chillicothe, OH 45601

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Western Annex",'Chillicothe=' + Chillicothe.length); Chillicothe[Chillicothe.length] = createMarker(new GPoint(-82.99701691,39.34207535),"
Worthington Elementary School
450 Allen Ave
Chillicothe, OH 45601

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Worthington Elementary School",'Chillicothe=' + Chillicothe.length); Chillicothe[Chillicothe.length] = createMarker(new GPoint(-82.93866730,39.42846680),"
Zane Trace Elementary School
946 State Route 180
Chillicothe, OH 45601

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Zane Trace Elementary School",'Chillicothe=' + Chillicothe.length); Chillicothe[Chillicothe.length] = createMarker(new GPoint(-82.97041600,39.33498300),"
Zane Trace High School
946 State Route 180
Chillicothe, OH 45601

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Zane Trace High School",'Chillicothe=' + Chillicothe.length); Chillicothe[Chillicothe.length] = createMarker(new GPoint(-82.93866730,39.42846680),"
Zane Trace Middle School
946 State Route 180
Chillicothe, OH 45601

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Zane Trace Middle School",'Chillicothe=' + Chillicothe.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(Bainbridge); map.removeOverlays(Chillicothe); map.removeOverlays(Frankfort); map.removeOverlays(Richmond_Dale); map.removeOverlays(South_Salem); 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(Frankfort);map.removeOverlays(Bainbridge); map.removeOverlays(Chillicothe); map.removeOverlays(Frankfort); map.removeOverlays(Richmond_Dale); map.removeOverlays(South_Salem); map.addOverlays(Bainbridge); centerByArray(Bainbridge, false, false); cntMarker += Bainbridge.length; map.addOverlays(Chillicothe); centerByArray(Chillicothe, false, false); cntMarker += Chillicothe.length; map.addOverlays(Frankfort); centerByArray(Frankfort, false, false); cntMarker += Frankfort.length; map.addOverlays(Richmond_Dale); centerByArray(Richmond_Dale, false, false); cntMarker += Richmond_Dale.length; map.addOverlays(South_Salem); centerByArray(South_Salem, false, false); cntMarker += South_Salem.length; centerByArray(Frankfort,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'); } }