function addMarkers() { mySelect = document.getElementById('selection'); Cardington = [];Edison = [];Sparta = [];Chesterville = [];Marengo = [];Iberia = [];Shauck = [];Mount_Gilead = [];Galion = [];mySelect.options[mySelect.options.length] = new Option("Cardington schools",'all=Cardington'); mySelect.options[mySelect.options.length] = new Option("Chesterville schools",'all=Chesterville'); mySelect.options[mySelect.options.length] = new Option("Edison schools",'all=Edison'); mySelect.options[mySelect.options.length] = new Option("Galion schools",'all=Galion'); mySelect.options[mySelect.options.length] = new Option("Iberia schools",'all=Iberia'); mySelect.options[mySelect.options.length] = new Option("Marengo schools",'all=Marengo'); mySelect.options[mySelect.options.length] = new Option("Mount Gilead schools",'all=Mount_Gilead'); mySelect.options[mySelect.options.length] = new Option("Shauck schools",'all=Shauck'); mySelect.options[mySelect.options.length] = new Option("Sparta schools",'all=Sparta'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Cardington[Cardington.length] = createMarker(new GPoint(-82.89321136,40.49645233),"
Cardington Local Digital
121 Nichols St
Cardington, OH 43315

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cardington Local Digital",'Cardington=' + Cardington.length); Cardington[Cardington.length] = createMarker(new GPoint(-82.89321136,40.49645233),"
Cardington-lincoln Elementary School
121 Nichols St
Cardington, OH 43315

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cardington-lincoln Elementary School",'Cardington=' + Cardington.length); Cardington[Cardington.length] = createMarker(new GPoint(-82.88470459,40.49573135),"
Cardington-lincoln High School
349 Chesterville Ave
Cardington, OH 43315

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cardington-lincoln High School",'Cardington=' + Cardington.length); Cardington[Cardington.length] = createMarker(new GPoint(-82.88470459,40.49573135),"
Cardington-lincoln Middle School
349 Chesterville Ave
Cardington, OH 43315

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Cardington-lincoln Middle School",'Cardington=' + Cardington.length); Edison[Edison.length] = createMarker(new GPoint(-82.88580322,40.57910156),"
Edison Elementary School
Po Box 216
Edison, OH 43320

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Edison Elementary School",'Edison=' + Edison.length); Edison[Edison.length] = createMarker(new GPoint(-82.82946777,40.54963684),"
Goal Digital Academy
Po Box 216
Edison, OH 43320

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Goal Digital Academy",'Edison=' + Edison.length); Sparta[Sparta.length] = createMarker(new GPoint(-82.69249725,40.38610077),"
Highland Central Elementary School
Po Box 69
Sparta, OH 43350

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Highland Central Elementary School",'Sparta=' + Sparta.length); Sparta[Sparta.length] = createMarker(new GPoint(-82.69249725,40.38610077),"
Highland Digital
Po Box 98
Sparta, OH 43350

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Highland Digital",'Sparta=' + Sparta.length); Sparta[Sparta.length] = createMarker(new GPoint(-82.69249725,40.38610077),"
Highland High School
Po Box 98
Sparta, OH 43350

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Highland High School",'Sparta=' + Sparta.length); Sparta[Sparta.length] = createMarker(new GPoint(-82.69249725,40.38610077),"
Highland Middle School
Po Box 68
Sparta, OH 43350

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Highland Middle School",'Sparta=' + Sparta.length); Chesterville[Chesterville.length] = createMarker(new GPoint(-82.68280029,40.47959900),"
Highland North Elementary School
Po Box 7
Chesterville, OH 43317

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Highland North Elementary School",'Chesterville=' + Chesterville.length); Marengo[Marengo.length] = createMarker(new GPoint(-82.81235504,40.40127945),"
Highland West Elementary School
19 West St
Marengo, OH 43334

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Highland West Elementary School",'Marengo=' + Marengo.length); Iberia[Iberia.length] = createMarker(new GPoint(-82.84359741,40.67020035),"
Iberia Elementary School
Po Box 87
Iberia, OH 43325

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Iberia Elementary School",'Iberia=' + Iberia.length); Shauck[Shauck.length] = createMarker(new GPoint(-82.66500092,40.61970139),"
Johnsville Elementary School
Po Box 213
Shauck, OH 43349

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Johnsville Elementary School",'Shauck=' + Shauck.length); Mount_Gilead[Mount_Gilead.length] = createMarker(new GPoint(-82.82905579,40.55266953),"
Mt Gilead Elementary School
145 12 N Cherry St
Mount Gilead, OH 43338

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mt Gilead Elementary School",'Mount_Gilead=' + Mount_Gilead.length); Mount_Gilead[Mount_Gilead.length] = createMarker(new GPoint(-82.83097076,40.55527115),"
Mt Gilead High School
338 Park Ave
Mount Gilead, OH 43338

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mt Gilead High School",'Mount_Gilead=' + Mount_Gilead.length); Mount_Gilead[Mount_Gilead.length] = createMarker(new GPoint(-82.82905579,40.55266953),"
Mt Gilead Middle School
145 N Cherry St
Mount Gilead, OH 43338

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Mt Gilead Middle School",'Mount_Gilead=' + Mount_Gilead.length); Galion[Galion.length] = createMarker(new GPoint(-82.75312042,40.63923645),"
Northmor High School
5353 County Road 29
Galion, OH 44833

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Northmor High School",'Galion=' + Galion.length); Mount_Gilead[Mount_Gilead.length] = createMarker(new GPoint(-82.83090210,40.55499649),"
Park Avenue Elementary School
335 Park Ave
Mount Gilead, OH 43338

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Park Avenue Elementary School",'Mount_Gilead=' + Mount_Gilead.length); Edison[Edison.length] = createMarker(new GPoint(-82.82946777,40.54963684),"
Tomorrow Center
Po Box 216
Edison, OH 43320

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tomorrow Center",'Edison=' + Edison.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(Cardington); map.removeOverlays(Chesterville); map.removeOverlays(Edison); map.removeOverlays(Galion); map.removeOverlays(Iberia); map.removeOverlays(Marengo); map.removeOverlays(Mount_Gilead); map.removeOverlays(Shauck); map.removeOverlays(Sparta); 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(Cardington);map.removeOverlays(Cardington); map.removeOverlays(Chesterville); map.removeOverlays(Edison); map.removeOverlays(Galion); map.removeOverlays(Iberia); map.removeOverlays(Marengo); map.removeOverlays(Mount_Gilead); map.removeOverlays(Shauck); map.removeOverlays(Sparta); map.addOverlays(Cardington); centerByArray(Cardington, false, false); cntMarker += Cardington.length; map.addOverlays(Chesterville); centerByArray(Chesterville, false, false); cntMarker += Chesterville.length; map.addOverlays(Edison); centerByArray(Edison, false, false); cntMarker += Edison.length; map.addOverlays(Galion); centerByArray(Galion, false, false); cntMarker += Galion.length; map.addOverlays(Iberia); centerByArray(Iberia, false, false); cntMarker += Iberia.length; map.addOverlays(Marengo); centerByArray(Marengo, false, false); cntMarker += Marengo.length; map.addOverlays(Mount_Gilead); centerByArray(Mount_Gilead, false, false); cntMarker += Mount_Gilead.length; map.addOverlays(Shauck); centerByArray(Shauck, false, false); cntMarker += Shauck.length; map.addOverlays(Sparta); centerByArray(Sparta, false, false); cntMarker += Sparta.length; centerByArray(Cardington,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'); } }