function addMarkers() { mySelect = document.getElementById('selection'); Piqua = [];Tipp_City = [];Bradford = [];Troy = [];Covington = [];Casstown = [];Fletcher = [];West_Milton = [];Pleasant_Hill = [];mySelect.options[mySelect.options.length] = new Option("Bradford schools",'all=Bradford'); mySelect.options[mySelect.options.length] = new Option("Casstown schools",'all=Casstown'); mySelect.options[mySelect.options.length] = new Option("Covington schools",'all=Covington'); mySelect.options[mySelect.options.length] = new Option("Fletcher schools",'all=Fletcher'); mySelect.options[mySelect.options.length] = new Option("Piqua schools",'all=Piqua'); mySelect.options[mySelect.options.length] = new Option("Pleasant Hill schools",'all=Pleasant_Hill'); mySelect.options[mySelect.options.length] = new Option("Tipp City schools",'all=Tipp_City'); mySelect.options[mySelect.options.length] = new Option("Troy schools",'all=Troy'); mySelect.options[mySelect.options.length] = new Option("West Milton schools",'all=West_Milton'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Piqua[Piqua.length] = createMarker(new GPoint(-84.23912811,40.14028931),"
Bennett Intermediate Elementary School
625 S Main St
Piqua, OH 45356

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Bennett Intermediate Elementary School",'Piqua=' + Piqua.length); Tipp_City[Tipp_City.length] = createMarker(new GPoint(-84.08551788,39.91844940),"
Bethel Elementary School
7490 State Route 201
Tipp City, OH 45371

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bethel Elementary School",'Tipp_City=' + Tipp_City.length); Tipp_City[Tipp_City.length] = createMarker(new GPoint(-84.08551788,39.91844940),"
Bethel High School
7490 State Route 201
Tipp City, OH 45371

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bethel High School",'Tipp_City=' + Tipp_City.length); Tipp_City[Tipp_City.length] = createMarker(new GPoint(-84.08551788,39.91844940),"
Bethel Junior High School
7490 State Route 201
Tipp City, OH 45371

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Bethel Junior High School",'Tipp_City=' + Tipp_City.length); Bradford[Bradford.length] = createMarker(new GPoint(-84.48470306,40.16640091),"
Bradford Central Elementary School
740 Railroad Ave
Bradford, OH 45308

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bradford Central Elementary School",'Bradford=' + Bradford.length); Bradford[Bradford.length] = createMarker(new GPoint(-84.48470306,40.16640091),"
Bradford High School
750 Railroad Ave
Bradford, OH 45308

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bradford High School",'Bradford=' + Bradford.length); Tipp_City[Tipp_City.length] = createMarker(new GPoint(-84.17441559,39.95920563),"
Broadway Elementary School
223 W Broadway St
Tipp City, OH 45371

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Broadway Elementary School",'Tipp_City=' + Tipp_City.length); Troy[Troy.length] = createMarker(new GPoint(-84.26165009,40.03937149),"
Concord Elementary School
3145 State Route 718
Troy, OH 45373

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Concord Elementary School",'Troy=' + Troy.length); Troy[Troy.length] = createMarker(new GPoint(-84.18574524,40.04648972),"
Cookson Elementary School
921 Mystic Ln
Troy, OH 45373

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cookson Elementary School",'Troy=' + Troy.length); Covington[Covington.length] = createMarker(new GPoint(-84.34526825,40.12046432),"
Covington Elementary School
707 Chestnut St
Covington, OH 45318

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Covington Elementary School",'Covington=' + Covington.length); Covington[Covington.length] = createMarker(new GPoint(-84.34362030,40.12046432),"
Covington High School
807 Chestnut St
Covington, OH 45318

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Covington High School",'Covington=' + Covington.length); Covington[Covington.length] = createMarker(new GPoint(-84.35028076,40.11834335),"
Covington Middle School
25 N Grant St
Covington, OH 45318

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Covington Middle School",'Covington=' + Covington.length); Piqua[Piqua.length] = createMarker(new GPoint(-84.25424300,40.13893000),"
Favorite Hill Primary Elementary School
950 South St
Piqua, OH 45356

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Favorite Hill Primary Elementary School",'Piqua=' + Piqua.length); Troy[Troy.length] = createMarker(new GPoint(-84.20059967,40.03599548),"
Forest
413 E Canal St
Troy, OH 45373

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Forest",'Troy=' + Troy.length); Troy[Troy.length] = createMarker(new GPoint(-84.21807861,40.04126740),"
Heywood Elementary School
260 S Ridge Ave
Troy, OH 45373

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Heywood Elementary School",'Troy=' + Troy.length); Piqua[Piqua.length] = createMarker(new GPoint(-84.26102448,40.14780426),"
High Street Primary Elementary School
1249 W High St
Piqua, OH 45356

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("High Street Primary Elementary School",'Piqua=' + Piqua.length); Troy[Troy.length] = createMarker(new GPoint(-84.22171783,40.05581665),"
Hook Elementary School
729 Trade Sq W
Troy, OH 45373

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hook Elementary School",'Troy=' + Troy.length); Troy[Troy.length] = createMarker(new GPoint(-84.20874023,40.03540421),"
Kyle Elementary School
501 S Plum St
Troy, OH 45373

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Kyle Elementary School",'Troy=' + Troy.length); Tipp_City[Tipp_City.length] = createMarker(new GPoint(-84.17441559,39.95920563),"
L.t. Ball Intermediate School
575 N Hyatt St
Tipp City, OH 45371

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("L.t. Ball Intermediate School",'Tipp_City=' + Tipp_City.length); Casstown[Casstown.length] = createMarker(new GPoint(-84.11682129,40.08377457),"
Miami East High School
3825 N State Route 589
Casstown, OH 45312

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Miami East High School",'Casstown=' + Casstown.length); Casstown[Casstown.length] = createMarker(new GPoint(-84.12259674,40.05456161),"
Miami East Intermediate Middle School
4308 E State Route 55
Casstown, OH 45312

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Miami East Intermediate Middle School",'Casstown=' + Casstown.length); Casstown[Casstown.length] = createMarker(new GPoint(-84.19555664,40.07449722),"
Miami East Junior High School
4025 N State Route 589
Casstown, OH 45312

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Miami East Junior High School",'Casstown=' + Casstown.length); Fletcher[Fletcher.length] = createMarker(new GPoint(-84.11981964,40.14550018),"
Miami East North Elementary School
4045 State Route 36
Fletcher, OH 45326

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Miami East North Elementary School",'Fletcher=' + Fletcher.length); Casstown[Casstown.length] = createMarker(new GPoint(-84.09755707,39.99922562),"
Miami East South Elementary School
4025 North State Route 589
Casstown, OH 45312

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Miami East South Elementary School",'Casstown=' + Casstown.length); West_Milton[West_Milton.length] = createMarker(new GPoint(-84.33276367,39.95933533),"
Milton-union Elementary School
43 Wright Rd
West Milton, OH 45383

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Milton-union Elementary School",'West_Milton=' + West_Milton.length); West_Milton[West_Milton.length] = createMarker(new GPoint(-84.32932281,39.95974731),"
Milton-union High School
221 S Jefferson St
West Milton, OH 45383

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Milton-union High School",'West_Milton=' + West_Milton.length); West_Milton[West_Milton.length] = createMarker(new GPoint(-84.33451843,39.95755768),"
Milton-union Middle School
146 S Spring St
West Milton, OH 45383

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Milton-union Middle School",'West_Milton=' + West_Milton.length); Tipp_City[Tipp_City.length] = createMarker(new GPoint(-84.18155670,39.96768188),"
Nevin Coppock Elementary School
525 N Hyatt St
Tipp City, OH 45371

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Nevin Coppock Elementary School",'Tipp_City=' + Tipp_City.length); Pleasant_Hill[Pleasant_Hill.length] = createMarker(new GPoint(-84.34899902,40.05089951),"
Newton Elementary School
Po Box 803
Pleasant Hill, OH 45359

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Newton Elementary School",'Pleasant_Hill=' + Pleasant_Hill.length); Pleasant_Hill[Pleasant_Hill.length] = createMarker(new GPoint(-84.34899902,40.05089951),"
Newton High School
Po Box 803
Pleasant Hill, OH 45359

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Newton High School",'Pleasant_Hill=' + Pleasant_Hill.length); Piqua[Piqua.length] = createMarker(new GPoint(-84.24871063,40.15407181),"
Nicklin Learning Center Elementary School
818 Nicklin Ave
Piqua, OH 45356

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Nicklin Learning Center Elementary School",'Piqua=' + Piqua.length); Piqua[Piqua.length] = createMarker(new GPoint(-84.20584869,40.16337585),"
Piqua High School
1 Indian Trl
Piqua, OH 45356

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Piqua High School",'Piqua=' + Piqua.length); Piqua[Piqua.length] = createMarker(new GPoint(-84.20584869,40.16337585),"
Piqua Junior High School
1 Tomahawk Trl
Piqua, OH 45356

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Piqua Junior High School",'Piqua=' + Piqua.length); Piqua[Piqua.length] = createMarker(new GPoint(-84.19504547,40.14987183),"
Springcreek Primary Elementary School
145 E Us Route 36
Piqua, OH 45356

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Springcreek Primary Elementary School",'Piqua=' + Piqua.length); Tipp_City[Tipp_City.length] = createMarker(new GPoint(-84.18238068,39.96911621),"
Tippecanoe High School
615 E Kessler Cowlesville Rd
Tipp City, OH 45371

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tippecanoe High School",'Tipp_City=' + Tipp_City.length); Tipp_City[Tipp_City.length] = createMarker(new GPoint(-84.18292999,39.97007370),"
Tippecanoe Middle School
555 N Hyatt St
Tipp City, OH 45371

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Tippecanoe Middle School",'Tipp_City=' + Tipp_City.length); Troy[Troy.length] = createMarker(new GPoint(-84.19989777,40.04412460),"
Troy High School
151 Staunton Rd
Troy, OH 45373

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Troy High School",'Troy=' + Troy.length); Troy[Troy.length] = createMarker(new GPoint(-84.19956207,40.05116272),"
Troy Junior High School
556 Adams St
Troy, OH 45373

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Troy Junior High School",'Troy=' + Troy.length); Piqua[Piqua.length] = createMarker(new GPoint(-84.21446991,40.16240311),"
Upper Valley High School
8811 Career Dr
Piqua, OH 45356

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Upper Valley High School",'Piqua=' + Piqua.length); Troy[Troy.length] = createMarker(new GPoint(-84.19712830,40.03700638),"
Van Cleve Elementary School
617 E Main St
Troy, OH 45373

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Van Cleve Elementary School",'Troy=' + Troy.length); Piqua[Piqua.length] = createMarker(new GPoint(-84.26927948,40.15250397),"
Washington Intermediate Elementary School
800 N Sunset Dr
Piqua, OH 45356

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Washington Intermediate Elementary School",'Piqua=' + Piqua.length); Piqua[Piqua.length] = createMarker(new GPoint(-84.25000000,40.15687561),"
Wilder Intermediate Elementary School
1120 Nicklin Ave
Piqua, OH 45356

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Wilder Intermediate Elementary School",'Piqua=' + Piqua.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(Bradford); map.removeOverlays(Casstown); map.removeOverlays(Covington); map.removeOverlays(Fletcher); map.removeOverlays(Piqua); map.removeOverlays(Pleasant_Hill); map.removeOverlays(Tipp_City); map.removeOverlays(Troy); map.removeOverlays(West_Milton); 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(Piqua);map.removeOverlays(Bradford); map.removeOverlays(Casstown); map.removeOverlays(Covington); map.removeOverlays(Fletcher); map.removeOverlays(Piqua); map.removeOverlays(Pleasant_Hill); map.removeOverlays(Tipp_City); map.removeOverlays(Troy); map.removeOverlays(West_Milton); map.addOverlays(Bradford); centerByArray(Bradford, false, false); cntMarker += Bradford.length; map.addOverlays(Casstown); centerByArray(Casstown, false, false); cntMarker += Casstown.length; map.addOverlays(Covington); centerByArray(Covington, false, false); cntMarker += Covington.length; map.addOverlays(Fletcher); centerByArray(Fletcher, false, false); cntMarker += Fletcher.length; map.addOverlays(Piqua); centerByArray(Piqua, false, false); cntMarker += Piqua.length; map.addOverlays(Pleasant_Hill); centerByArray(Pleasant_Hill, false, false); cntMarker += Pleasant_Hill.length; map.addOverlays(Tipp_City); centerByArray(Tipp_City, false, false); cntMarker += Tipp_City.length; map.addOverlays(Troy); centerByArray(Troy, false, false); cntMarker += Troy.length; map.addOverlays(West_Milton); centerByArray(West_Milton, false, false); cntMarker += West_Milton.length; centerByArray(Piqua,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'); } }