function addMarkers() { mySelect = document.getElementById('selection'); Mount_Vernon = [];Centerburg = [];Danville = [];Bladensburg = [];Howard = [];Fredericktown = [];Gambier = [];mySelect.options[mySelect.options.length] = new Option("Bladensburg schools",'all=Bladensburg'); mySelect.options[mySelect.options.length] = new Option("Centerburg schools",'all=Centerburg'); mySelect.options[mySelect.options.length] = new Option("Danville schools",'all=Danville'); mySelect.options[mySelect.options.length] = new Option("Fredericktown schools",'all=Fredericktown'); mySelect.options[mySelect.options.length] = new Option("Gambier schools",'all=Gambier'); mySelect.options[mySelect.options.length] = new Option("Howard schools",'all=Howard'); mySelect.options[mySelect.options.length] = new Option("Mount Vernon schools",'all=Mount_Vernon'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Mount_Vernon[Mount_Vernon.length] = createMarker(new GPoint(-82.48368073,40.39336395),"
Carthage Elementary School
110 E High St
Mount Vernon, OH 43050

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Carthage Elementary School",'Mount_Vernon=' + Mount_Vernon.length); Centerburg[Centerburg.length] = createMarker(new GPoint(-82.69607544,40.30059433),"
Centerburg Elementary School
207 S Preston St
Centerburg, OH 43011

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Centerburg Elementary School",'Centerburg=' + Centerburg.length); Centerburg[Centerburg.length] = createMarker(new GPoint(-82.69694519,40.30210114),"
Centerburg High School
119 S Preston St
Centerburg, OH 43011

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Centerburg High School",'Centerburg=' + Centerburg.length); Centerburg[Centerburg.length] = createMarker(new GPoint(-82.70787048,40.29508209),"
Centerburg Middle School
3782 Columbus Road
Centerburg, OH 43011

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Centerburg Middle School",'Centerburg=' + Centerburg.length); Mount_Vernon[Mount_Vernon.length] = createMarker(new GPoint(-82.48931100,40.38477500),"
Columbia Elementary School
150 Columbus Rd
Mount Vernon, OH 43050

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Columbia Elementary School",'Mount_Vernon=' + Mount_Vernon.length); Mount_Vernon[Mount_Vernon.length] = createMarker(new GPoint(-82.48701477,40.40714645),"
Dan Emmett Elementary School
108 Mansfield Ave
Mount Vernon, OH 43050

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Dan Emmett Elementary School",'Mount_Vernon=' + Mount_Vernon.length); Danville[Danville.length] = createMarker(new GPoint(-82.26149750,40.46369934),"
Danville Digital Academy
Po Box 30
Danville, OH 43014

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Danville Digital Academy",'Danville=' + Danville.length); Danville[Danville.length] = createMarker(new GPoint(-82.26149750,40.46369934),"
Danville Elementary School
Po Box 30
Danville, OH 43014

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Danville Elementary School",'Danville=' + Danville.length); Danville[Danville.length] = createMarker(new GPoint(-82.26149750,40.46369934),"
Danville High School
Po Box 30
Danville, OH 43014

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Danville High School",'Danville=' + Danville.length); Danville[Danville.length] = createMarker(new GPoint(-82.26149750,40.46369934),"
Danville Middle School
Po Box 30
Danville, OH 43014

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Danville Middle School",'Danville=' + Danville.length); Mount_Vernon[Mount_Vernon.length] = createMarker(new GPoint(-82.47254944,40.39184952),"
East Elementary School
714 E Vine St
Mount Vernon, OH 43050

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("East Elementary School",'Mount_Vernon=' + Mount_Vernon.length); Bladensburg[Bladensburg.length] = createMarker(new GPoint(-82.28025818,40.28459930),"
East Knox Elementary School
Po Box 97
Bladensburg, OH 43005

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("East Knox Elementary School",'Bladensburg=' + Bladensburg.length); Howard[Howard.length] = createMarker(new GPoint(-82.32919312,40.40847397),"
East Knox High School
23227 Coshocton Rd
Howard, OH 43028

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("East Knox High School",'Howard=' + Howard.length); Fredericktown[Fredericktown.length] = createMarker(new GPoint(-82.54648590,40.48209763),"
Fredericktown Digital Academy
134 W 2nd St
Fredericktown, OH 43019

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fredericktown Digital Academy",'Fredericktown=' + Fredericktown.length); Fredericktown[Fredericktown.length] = createMarker(new GPoint(-82.54645538,40.47581100),"
Fredericktown High School
117 Columbus Rd
Fredericktown, OH 43019

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fredericktown High School",'Fredericktown=' + Fredericktown.length); Fredericktown[Fredericktown.length] = createMarker(new GPoint(-82.54747772,40.48169327),"
Fredericktown Intermediate Middle School
31 Taylor St
Fredericktown, OH 43019

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Fredericktown Intermediate Middle School",'Fredericktown=' + Fredericktown.length); Fredericktown[Fredericktown.length] = createMarker(new GPoint(-82.54785919,40.47737122),"
Fredericktown Primary Elementary School
111 Stadium Drive
Fredericktown, OH 43019

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fredericktown Primary Elementary School",'Fredericktown=' + Fredericktown.length); Mount_Vernon[Mount_Vernon.length] = createMarker(new GPoint(-82.47801971,40.37679291),"
Knox County Career Center
306 Martinsburg Rd
Mount Vernon, OH 43050

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Knox County Career Center",'Mount_Vernon=' + Mount_Vernon.length); Mount_Vernon[Mount_Vernon.length] = createMarker(new GPoint(-82.47805786,40.37684250),"
Mt Vernon High School
300 Martinsburg Rd
Mount Vernon, OH 43050

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mt Vernon High School",'Mount_Vernon=' + Mount_Vernon.length); Mount_Vernon[Mount_Vernon.length] = createMarker(new GPoint(-82.47828674,40.37702560),"
Mt Vernon Middle School
298 Martinsburg Rd
Mount Vernon, OH 43050

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Mt Vernon Middle School",'Mount_Vernon=' + Mount_Vernon.length); Mount_Vernon[Mount_Vernon.length] = createMarker(new GPoint(-82.47716522,40.39811707),"
Pleasant Street Elementary School
305 E Pleasant St
Mount Vernon, OH 43050

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pleasant Street Elementary School",'Mount_Vernon=' + Mount_Vernon.length); Mount_Vernon[Mount_Vernon.length] = createMarker(new GPoint(-82.49669647,40.39308167),"
West Side Elementary School
900 W Vine St
Mount Vernon, OH 43050

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West Side Elementary School",'Mount_Vernon=' + Mount_Vernon.length); Gambier[Gambier.length] = createMarker(new GPoint(-82.36499786,40.35760117),"
Wiggin Street Elementary School
Po Box 352
Gambier, OH 43022

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wiggin Street Elementary School",'Gambier=' + Gambier.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(Bladensburg); map.removeOverlays(Centerburg); map.removeOverlays(Danville); map.removeOverlays(Fredericktown); map.removeOverlays(Gambier); map.removeOverlays(Howard); map.removeOverlays(Mount_Vernon); 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(Mount_Vernon);map.removeOverlays(Bladensburg); map.removeOverlays(Centerburg); map.removeOverlays(Danville); map.removeOverlays(Fredericktown); map.removeOverlays(Gambier); map.removeOverlays(Howard); map.removeOverlays(Mount_Vernon); map.addOverlays(Bladensburg); centerByArray(Bladensburg, false, false); cntMarker += Bladensburg.length; map.addOverlays(Centerburg); centerByArray(Centerburg, false, false); cntMarker += Centerburg.length; map.addOverlays(Danville); centerByArray(Danville, false, false); cntMarker += Danville.length; map.addOverlays(Fredericktown); centerByArray(Fredericktown, false, false); cntMarker += Fredericktown.length; map.addOverlays(Gambier); centerByArray(Gambier, false, false); cntMarker += Gambier.length; map.addOverlays(Howard); centerByArray(Howard, false, false); cntMarker += Howard.length; map.addOverlays(Mount_Vernon); centerByArray(Mount_Vernon, false, false); cntMarker += Mount_Vernon.length; centerByArray(Mount_Vernon,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'); } }