function addMarkers() { mySelect = document.getElementById('selection'); Ottawa = [];Columbus_Grove = [];Continental = [];Fort_Jennings = [];Gilboa = [];Glandorf = [];Kalida = [];Leipsic = [];Miller_City = [];Ottoville = [];Pandora = [];mySelect.options[mySelect.options.length] = new Option("Columbus Grove schools",'all=Columbus_Grove'); mySelect.options[mySelect.options.length] = new Option("Continental schools",'all=Continental'); mySelect.options[mySelect.options.length] = new Option("Fort Jennings schools",'all=Fort_Jennings'); mySelect.options[mySelect.options.length] = new Option("Gilboa schools",'all=Gilboa'); mySelect.options[mySelect.options.length] = new Option("Glandorf schools",'all=Glandorf'); mySelect.options[mySelect.options.length] = new Option("Kalida schools",'all=Kalida'); mySelect.options[mySelect.options.length] = new Option("Leipsic schools",'all=Leipsic'); mySelect.options[mySelect.options.length] = new Option("Miller City schools",'all=Miller_City'); mySelect.options[mySelect.options.length] = new Option("Ottawa schools",'all=Ottawa'); mySelect.options[mySelect.options.length] = new Option("Ottoville schools",'all=Ottoville'); mySelect.options[mySelect.options.length] = new Option("Pandora schools",'all=Pandora'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Ottawa[Ottawa.length] = createMarker(new GPoint(-84.03877700,41.07375300),"
Alternative Opportunity Center High School
7374 State Route 109
Ottawa, OH 45875

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Alternative Opportunity Center High School",'Ottawa=' + Ottawa.length); Columbus_Grove[Columbus_Grove.length] = createMarker(new GPoint(-84.05641937,40.92132568),"
Columbus Grove Elementary School
201 W Cross St
Columbus Grove, OH 45830

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Columbus Grove Elementary School",'Columbus_Grove=' + Columbus_Grove.length); Columbus_Grove[Columbus_Grove.length] = createMarker(new GPoint(-84.05641937,40.92132568),"
Columbus Grove High School
201 W Cross St
Columbus Grove, OH 45830

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Columbus Grove High School",'Columbus_Grove=' + Columbus_Grove.length); Columbus_Grove[Columbus_Grove.length] = createMarker(new GPoint(-84.05641937,40.92132568),"
Columbus Grove Middle School
201 W Cross St
Columbus Grove, OH 45830

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Columbus Grove Middle School",'Columbus_Grove=' + Columbus_Grove.length); Continental[Continental.length] = createMarker(new GPoint(-84.26591492,41.10504532),"
Continental Local Elementary School
5211 State Route 634
Continental, OH 45831

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Continental Local Elementary School",'Continental=' + Continental.length); Continental[Continental.length] = createMarker(new GPoint(-84.26591492,41.10504532),"
Continental Local High School
5211 State Route 634
Continental, OH 45831

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Continental Local High School",'Continental=' + Continental.length); Continental[Continental.length] = createMarker(new GPoint(-84.26591492,41.10504532),"
Continental Local Middle School
5211 State Route 634
Continental, OH 45831

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Continental Local Middle School",'Continental=' + Continental.length); Fort_Jennings[Fort_Jennings.length] = createMarker(new GPoint(-84.27369690,40.92060089),"
Fort Jennings Elementary School
Po Box 187
Fort Jennings, OH 45844

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fort Jennings Elementary School",'Fort_Jennings=' + Fort_Jennings.length); Fort_Jennings[Fort_Jennings.length] = createMarker(new GPoint(-84.27369690,40.92060089),"
Fort Jennings High School
Po Box 98
Fort Jennings, OH 45844

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fort Jennings High School",'Fort_Jennings=' + Fort_Jennings.length); Gilboa[Gilboa.length] = createMarker(new GPoint(-83.92366791,41.01820755),"
Gilboa Middle School
102 Blanchard St
Gilboa, OH 45875

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Gilboa Middle School",'Gilboa=' + Gilboa.length); Glandorf[Glandorf.length] = createMarker(new GPoint(-84.07910156,41.02880096),"
Glandorf Elementary School
Po Box 129
Glandorf, OH 45848

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Glandorf Elementary School",'Glandorf=' + Glandorf.length); Kalida[Kalida.length] = createMarker(new GPoint(-84.19770050,40.98389816),"
Kalida Elementary School
Po Box 358
Kalida, OH 45853

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Kalida Elementary School",'Kalida=' + Kalida.length); Kalida[Kalida.length] = createMarker(new GPoint(-84.19770050,40.98389816),"
Kalida High School
Po Box 269
Kalida, OH 45853

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kalida High School",'Kalida=' + Kalida.length); Leipsic[Leipsic.length] = createMarker(new GPoint(-83.98961639,41.09833527),"
Leipsic Elementary School
232 Oak St
Leipsic, OH 45856

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Leipsic Elementary School",'Leipsic=' + Leipsic.length); Leipsic[Leipsic.length] = createMarker(new GPoint(-83.98961639,41.09833527),"
Leipsic High School
232 Oak St
Leipsic, OH 45856

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Leipsic High School",'Leipsic=' + Leipsic.length); Miller_City[Miller_City.length] = createMarker(new GPoint(-84.13150024,41.10269928),"
Miller City Elementary School
Po Box 38
Miller City, OH 45864

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Miller City Elementary School",'Miller_City=' + Miller_City.length); Miller_City[Miller_City.length] = createMarker(new GPoint(-84.13150024,41.10269928),"
Miller City High School
Po Box 38
Miller City, OH 45864

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Miller City High School",'Miller_City=' + Miller_City.length); Ottawa[Ottawa.length] = createMarker(new GPoint(-84.03850555,41.07542038),"
New Cleveland Middle School
7374 State Route 109
Ottawa, OH 45875

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("New Cleveland Middle School",'Ottawa=' + Ottawa.length); Ottawa[Ottawa.length] = createMarker(new GPoint(-84.04020691,41.02168655),"
Ottawa Elementary School
751 E 4th St
Ottawa, OH 45875

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ottawa Elementary School",'Ottawa=' + Ottawa.length); Ottawa[Ottawa.length] = createMarker(new GPoint(-84.04401398,41.02292633),"
Ottawa-glandorf Complex Elementary School
630 Glendale Ave
Ottawa, OH 45875

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ottawa-glandorf Complex Elementary School",'Ottawa=' + Ottawa.length); Ottawa[Ottawa.length] = createMarker(new GPoint(-84.04550171,41.02916336),"
Ottawa-glandorf High School
630 Glendale Ave
Ottawa, OH 45875

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ottawa-glandorf High School",'Ottawa=' + Ottawa.length); Ottoville[Ottoville.length] = createMarker(new GPoint(-84.34190369,40.93450165),"
Ottoville Elementary School
Po Box 248
Ottoville, OH 45876

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ottoville Elementary School",'Ottoville=' + Ottoville.length); Ottoville[Ottoville.length] = createMarker(new GPoint(-84.34190369,40.93450165),"
Ottoville High School
Po Box 248
Ottoville, OH 45876

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ottoville High School",'Ottoville=' + Ottoville.length); Pandora[Pandora.length] = createMarker(new GPoint(-83.95130157,40.95019913),"
Pandora Elementary School
Po Box 389
Pandora, OH 45877

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pandora Elementary School",'Pandora=' + Pandora.length); Pandora[Pandora.length] = createMarker(new GPoint(-83.95130157,40.95019913),"
Pandora-gilboa High School
410 Rocket Ridge
Pandora, OH 45877

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pandora-gilboa High School",'Pandora=' + Pandora.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(Columbus_Grove); map.removeOverlays(Continental); map.removeOverlays(Fort_Jennings); map.removeOverlays(Gilboa); map.removeOverlays(Glandorf); map.removeOverlays(Kalida); map.removeOverlays(Leipsic); map.removeOverlays(Miller_City); map.removeOverlays(Ottawa); map.removeOverlays(Ottoville); map.removeOverlays(Pandora); 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(Ottawa);map.removeOverlays(Columbus_Grove); map.removeOverlays(Continental); map.removeOverlays(Fort_Jennings); map.removeOverlays(Gilboa); map.removeOverlays(Glandorf); map.removeOverlays(Kalida); map.removeOverlays(Leipsic); map.removeOverlays(Miller_City); map.removeOverlays(Ottawa); map.removeOverlays(Ottoville); map.removeOverlays(Pandora); map.addOverlays(Columbus_Grove); centerByArray(Columbus_Grove, false, false); cntMarker += Columbus_Grove.length; map.addOverlays(Continental); centerByArray(Continental, false, false); cntMarker += Continental.length; map.addOverlays(Fort_Jennings); centerByArray(Fort_Jennings, false, false); cntMarker += Fort_Jennings.length; map.addOverlays(Gilboa); centerByArray(Gilboa, false, false); cntMarker += Gilboa.length; map.addOverlays(Glandorf); centerByArray(Glandorf, false, false); cntMarker += Glandorf.length; map.addOverlays(Kalida); centerByArray(Kalida, false, false); cntMarker += Kalida.length; map.addOverlays(Leipsic); centerByArray(Leipsic, false, false); cntMarker += Leipsic.length; map.addOverlays(Miller_City); centerByArray(Miller_City, false, false); cntMarker += Miller_City.length; map.addOverlays(Ottawa); centerByArray(Ottawa, false, false); cntMarker += Ottawa.length; map.addOverlays(Ottoville); centerByArray(Ottoville, false, false); cntMarker += Ottoville.length; map.addOverlays(Pandora); centerByArray(Pandora, false, false); cntMarker += Pandora.length; centerByArray(Ottawa,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'); } }