function addMarkers() { mySelect = document.getElementById('selection'); Napoleon = [];Deshler = [];Archbold = [];Holgate = [];Liberty_Center = [];Malinta = [];Hamler = [];mySelect.options[mySelect.options.length] = new Option("Archbold schools",'all=Archbold'); mySelect.options[mySelect.options.length] = new Option("Deshler schools",'all=Deshler'); mySelect.options[mySelect.options.length] = new Option("Hamler schools",'all=Hamler'); mySelect.options[mySelect.options.length] = new Option("Holgate schools",'all=Holgate'); mySelect.options[mySelect.options.length] = new Option("Liberty Center schools",'all=Liberty_Center'); mySelect.options[mySelect.options.length] = new Option("Malinta schools",'all=Malinta'); mySelect.options[mySelect.options.length] = new Option("Napoleon schools",'all=Napoleon'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Napoleon[Napoleon.length] = createMarker(new GPoint(-84.11914062,41.38221741),"
C D Brillhart Elementary School
201 Rohrs Ave
Napoleon, OH 43545

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("C D Brillhart Elementary School",'Napoleon=' + Napoleon.length); Napoleon[Napoleon.length] = createMarker(new GPoint(-84.12706757,41.38906860),"
Central Elementary School
315 W Main St
Napoleon, OH 43545

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Central Elementary School",'Napoleon=' + Napoleon.length); Deshler[Deshler.length] = createMarker(new GPoint(-83.89839935,41.20742798),"
Deshler Elementary School
221 E Maple St
Deshler, OH 43516

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Deshler Elementary School",'Deshler=' + Deshler.length); Archbold[Archbold.length] = createMarker(new GPoint(-84.30373383,41.45141220),"
Four County Career Center
22900 State Route 34
Archbold, OH 43502

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Four County Career Center",'Archbold=' + Archbold.length); Holgate[Holgate.length] = createMarker(new GPoint(-84.13359070,41.24771881),"
Holgate Elementary School
103 Frazier Ave
Holgate, OH 43527

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Holgate Elementary School",'Holgate=' + Holgate.length); Holgate[Holgate.length] = createMarker(new GPoint(-84.13359070,41.24771881),"
Holgate High School
103 Frazier Ave
Holgate, OH 43527

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Holgate High School",'Holgate=' + Holgate.length); Liberty_Center[Liberty_Center.length] = createMarker(new GPoint(-83.99150085,41.43809891),"
Liberty Center Elementary School
Po Box 434
Liberty Center, OH 43532

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Liberty Center Elementary School",'Liberty_Center=' + Liberty_Center.length); Liberty_Center[Liberty_Center.length] = createMarker(new GPoint(-83.99150085,41.43809891),"
Liberty Center High School
Po Box 434
Liberty Center, OH 43532

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Liberty Center High School",'Liberty_Center=' + Liberty_Center.length); Liberty_Center[Liberty_Center.length] = createMarker(new GPoint(-83.99150085,41.43809891),"
Liberty Center Middle School
Po Box 434
Liberty Center, OH 43532

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Liberty Center Middle School",'Liberty_Center=' + Liberty_Center.length); Malinta[Malinta.length] = createMarker(new GPoint(-84.04350281,41.31549835),"
Malinta-grelton Elementary School
Po Box 87
Malinta, OH 43535

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Malinta-grelton Elementary School",'Malinta=' + Malinta.length); Napoleon[Napoleon.length] = createMarker(new GPoint(-84.14620209,41.38982773),"
Napoleon High School
701 Briarheath Ave Ste 123
Napoleon, OH 43545

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Napoleon High School",'Napoleon=' + Napoleon.length); Napoleon[Napoleon.length] = createMarker(new GPoint(-84.12685394,41.38914871),"
Napoleon Middle School
303 W Main St
Napoleon, OH 43545

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Napoleon Middle School",'Napoleon=' + Napoleon.length); Hamler[Hamler.length] = createMarker(new GPoint(-83.99565125,41.22523880),"
Patrick Henry High School
6900 State Route 18
Hamler, OH 43524

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Patrick Henry High School",'Hamler=' + Hamler.length); Hamler[Hamler.length] = createMarker(new GPoint(-84.04806800,41.22496200),"
Patrick Henry Middle School
E050 County Road 7
Hamler, OH 43524

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Patrick Henry Middle School",'Hamler=' + Hamler.length); Napoleon[Napoleon.length] = createMarker(new GPoint(-84.13670349,41.39166641),"
West Elementary School
700 Clairmont Ave
Napoleon, OH 43545

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West Elementary School",'Napoleon=' + Napoleon.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(Archbold); map.removeOverlays(Deshler); map.removeOverlays(Hamler); map.removeOverlays(Holgate); map.removeOverlays(Liberty_Center); map.removeOverlays(Malinta); map.removeOverlays(Napoleon); 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(Napoleon);map.removeOverlays(Archbold); map.removeOverlays(Deshler); map.removeOverlays(Hamler); map.removeOverlays(Holgate); map.removeOverlays(Liberty_Center); map.removeOverlays(Malinta); map.removeOverlays(Napoleon); map.addOverlays(Archbold); centerByArray(Archbold, false, false); cntMarker += Archbold.length; map.addOverlays(Deshler); centerByArray(Deshler, false, false); cntMarker += Deshler.length; map.addOverlays(Hamler); centerByArray(Hamler, false, false); cntMarker += Hamler.length; map.addOverlays(Holgate); centerByArray(Holgate, false, false); cntMarker += Holgate.length; map.addOverlays(Liberty_Center); centerByArray(Liberty_Center, false, false); cntMarker += Liberty_Center.length; map.addOverlays(Malinta); centerByArray(Malinta, false, false); cntMarker += Malinta.length; map.addOverlays(Napoleon); centerByArray(Napoleon, false, false); cntMarker += Napoleon.length; centerByArray(Napoleon,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'); } }