function addMarkers() { mySelect = document.getElementById('selection'); Eaton = [];Camden = [];College_Corner = [];New_Paris = [];Lewisburg = [];West_Alexandria = [];West_Elkton = [];mySelect.options[mySelect.options.length] = new Option("Camden schools",'all=Camden'); mySelect.options[mySelect.options.length] = new Option("College Corner schools",'all=College_Corner'); mySelect.options[mySelect.options.length] = new Option("Eaton schools",'all=Eaton'); mySelect.options[mySelect.options.length] = new Option("Lewisburg schools",'all=Lewisburg'); mySelect.options[mySelect.options.length] = new Option("New Paris schools",'all=New_Paris'); mySelect.options[mySelect.options.length] = new Option("West Alexandria schools",'all=West_Alexandria'); mySelect.options[mySelect.options.length] = new Option("West Elkton schools",'all=West_Elkton'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Eaton[Eaton.length] = createMarker(new GPoint(-84.63410187,39.73976135),"
Bruce Elementary School
201 E Saint Clair St
Eaton, OH 45320

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bruce Elementary School",'Eaton=' + Eaton.length); Camden[Camden.length] = createMarker(new GPoint(-84.65084839,39.63143539),"
Camden Elementary School
120 Bloomfield St
Camden, OH 45311

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Camden Elementary School",'Camden=' + Camden.length); College_Corner[College_Corner.length] = createMarker(new GPoint(-84.81389700,39.56657600),"
College Corner Union Elementary School
230 Ramsey St
College Corner, OH 45003

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("College Corner Union Elementary School",'College_Corner=' + College_Corner.length); Eaton[Eaton.length] = createMarker(new GPoint(-84.63475800,39.74678040),"
Eaton High School
600 Hillcrest Dr
Eaton, OH 45320

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Eaton High School",'Eaton=' + Eaton.length); Eaton[Eaton.length] = createMarker(new GPoint(-84.75419617,39.69963837),"
Eaton Middle School
311 N Cherry St
Eaton, OH 45320

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Eaton Middle School",'Eaton=' + Eaton.length); Eaton[Eaton.length] = createMarker(new GPoint(-84.62953949,39.74892044),"
Hollingsworth East Elementary School
506 Aukerman St
Eaton, OH 45320

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hollingsworth East Elementary School",'Eaton=' + Eaton.length); New_Paris[New_Paris.length] = createMarker(new GPoint(-84.72290039,39.82981873),"
National Trail Elementary School
6940 Oxford Gettysburg Rd
New Paris, OH 45347

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("National Trail Elementary School",'New_Paris=' + New_Paris.length); New_Paris[New_Paris.length] = createMarker(new GPoint(-84.72290039,39.82981873),"
National Trail High School
6940 Oxford Gettysburg Rd
New Paris, OH 45347

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("National Trail High School",'New_Paris=' + New_Paris.length); New_Paris[New_Paris.length] = createMarker(new GPoint(-84.72290039,39.82981873),"
National Trail Middle School
6940 Oxford Gettysburg Rd
New Paris, OH 45347

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("National Trail Middle School",'New_Paris=' + New_Paris.length); Camden[Camden.length] = createMarker(new GPoint(-84.55220032,39.62623596),"
Preble Shawnee High School
5495 Somers Gratis Rd
Camden, OH 45311

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Preble Shawnee High School",'Camden=' + Camden.length); Camden[Camden.length] = createMarker(new GPoint(-84.55220032,39.62623596),"
Preble Shawnee Junior High School
5495 Somers Gratis Rd
Camden, OH 45311

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Preble Shawnee Junior High School",'Camden=' + Camden.length); Lewisburg[Lewisburg.length] = createMarker(new GPoint(-84.53856659,39.84558105),"
Tri-county North Elementary School
Po Box 219
Lewisburg, OH 45338

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Tri-county North Elementary School",'Lewisburg=' + Lewisburg.length); Lewisburg[Lewisburg.length] = createMarker(new GPoint(-84.53856659,39.84558105),"
Tri-county North High School
Po Box 610
Lewisburg, OH 45338

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tri-county North High School",'Lewisburg=' + Lewisburg.length); Lewisburg[Lewisburg.length] = createMarker(new GPoint(-84.53856659,39.84558105),"
Tri-county North Middle School
Po Box 699
Lewisburg, OH 45338

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Tri-county North Middle School",'Lewisburg=' + Lewisburg.length); West_Alexandria[West_Alexandria.length] = createMarker(new GPoint(-84.53542328,39.74873734),"
Twin Valley South Elementary School
100 Education Dr
West Alexandria, OH 45381

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Twin Valley South Elementary School",'West_Alexandria=' + West_Alexandria.length); West_Alexandria[West_Alexandria.length] = createMarker(new GPoint(-84.53542328,39.74873734),"
Twin Valley South High School
100 Education Dr
West Alexandria, OH 45381

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Twin Valley South High School",'West_Alexandria=' + West_Alexandria.length); West_Alexandria[West_Alexandria.length] = createMarker(new GPoint(-84.53542328,39.74873734),"
Twin Valley South Middle School
100 Education Dr
West Alexandria, OH 45381

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Twin Valley South Middle School",'West_Alexandria=' + West_Alexandria.length); West_Elkton[West_Elkton.length] = createMarker(new GPoint(-84.55470276,39.58869934),"
West Elkton Elementary School
Po Box 97
West Elkton, OH 45070

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West Elkton Elementary School",'West_Elkton=' + West_Elkton.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(Camden); map.removeOverlays(College_Corner); map.removeOverlays(Eaton); map.removeOverlays(Lewisburg); map.removeOverlays(New_Paris); map.removeOverlays(West_Alexandria); map.removeOverlays(West_Elkton); 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(Eaton);map.removeOverlays(Camden); map.removeOverlays(College_Corner); map.removeOverlays(Eaton); map.removeOverlays(Lewisburg); map.removeOverlays(New_Paris); map.removeOverlays(West_Alexandria); map.removeOverlays(West_Elkton); map.addOverlays(Camden); centerByArray(Camden, false, false); cntMarker += Camden.length; map.addOverlays(College_Corner); centerByArray(College_Corner, false, false); cntMarker += College_Corner.length; map.addOverlays(Eaton); centerByArray(Eaton, false, false); cntMarker += Eaton.length; map.addOverlays(Lewisburg); centerByArray(Lewisburg, false, false); cntMarker += Lewisburg.length; map.addOverlays(New_Paris); centerByArray(New_Paris, false, false); cntMarker += New_Paris.length; map.addOverlays(West_Alexandria); centerByArray(West_Alexandria, false, false); cntMarker += West_Alexandria.length; map.addOverlays(West_Elkton); centerByArray(West_Elkton, false, false); cntMarker += West_Elkton.length; centerByArray(Eaton,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'); } }