function addMarkers() { mySelect = document.getElementById('selection'); Albion = [];Avilla = [];Kendallville = [];Laotto = [];Ligonier = [];Rome_City = [];Wolf_Lake = [];mySelect.options[mySelect.options.length] = new Option("Albion schools",'all=Albion'); mySelect.options[mySelect.options.length] = new Option("Avilla schools",'all=Avilla'); mySelect.options[mySelect.options.length] = new Option("Kendallville schools",'all=Kendallville'); mySelect.options[mySelect.options.length] = new Option("Laotto schools",'all=Laotto'); mySelect.options[mySelect.options.length] = new Option("Ligonier schools",'all=Ligonier'); mySelect.options[mySelect.options.length] = new Option("Rome City schools",'all=Rome_City'); mySelect.options[mySelect.options.length] = new Option("Wolf Lake schools",'all=Wolf_Lake'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Albion[Albion.length] = createMarker(new GPoint(-85.41901398,41.39684677),"
Albion Elementary School
202 Cougar Ct
Albion, IN 46701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Albion Elementary School",'Albion=' + Albion.length); Avilla[Avilla.length] = createMarker(new GPoint(-85.24279785,41.35850143),"
Avilla Elementary & Middle School
Po Box 9
Avilla, IN 46710

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Avilla Elementary & Middle School",'Avilla=' + Avilla.length); Albion[Albion.length] = createMarker(new GPoint(-85.41901398,41.39720917),"
Central Noble High School
302 Cougar Ct
Albion, IN 46701

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Central Noble High School",'Albion=' + Albion.length); Albion[Albion.length] = createMarker(new GPoint(-85.41981506,41.39783859),"
Central Noble Middle School
401 E Highland
Albion, IN 46701

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Central Noble Middle School",'Albion=' + Albion.length); Kendallville[Kendallville.length] = createMarker(new GPoint(-85.25891876,41.43489075),"
East Noble High School
901 S Garden St
Kendallville, IN 46755

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("East Noble High School",'Kendallville=' + Kendallville.length); Kendallville[Kendallville.length] = createMarker(new GPoint(-85.13529968,41.33900070),"
Four County Area Voc Coop
1607 E Dowling St
Kendallville, IN 46755

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Four County Area Voc Coop",'Kendallville=' + Kendallville.length); Kendallville[Kendallville.length] = createMarker(new GPoint(-85.26020050,41.44033813),"
Kendallville Central Mid School
401 E Diamond St
Kendallville, IN 46755

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Kendallville Central Mid School",'Kendallville=' + Kendallville.length); Laotto[Laotto.length] = createMarker(new GPoint(-85.19039917,41.29309845),"
Laotto Elementary School
Po Box 235
Laotto, IN 46763

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Laotto Elementary School",'Laotto=' + Laotto.length); Ligonier[Ligonier.length] = createMarker(new GPoint(-85.59171295,41.46095657),"
Ligonier Elementary School
610 Grand St
Ligonier, IN 46767

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ligonier Elementary School",'Ligonier=' + Ligonier.length); Kendallville[Kendallville.length] = createMarker(new GPoint(-85.26339722,41.44996262),"
North Side Elementary School
302 E Harding St
Kendallville, IN 46755

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Side Elementary School",'Kendallville=' + Kendallville.length); Kendallville[Kendallville.length] = createMarker(new GPoint(-85.25473785,41.43099976),"
Northeast In Spec Ed Coop
112 S Orchard St
Kendallville, IN 46755

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Northeast In Spec Ed Coop",'Kendallville=' + Kendallville.length); Rome_City[Rome_City.length] = createMarker(new GPoint(-85.38050079,41.49269867),"
Rome City Elementary & Middle School
Po Box 218
Rome City, IN 46784

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rome City Elementary & Middle School",'Rome_City=' + Rome_City.length); Kendallville[Kendallville.length] = createMarker(new GPoint(-85.25423431,41.43214417),"
South Side Elementary School
1350 S Sherman St
Kendallville, IN 46755

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("South Side Elementary School",'Kendallville=' + Kendallville.length); Kendallville[Kendallville.length] = createMarker(new GPoint(-85.25252533,41.48136520),"
Wayne Center Elementary School
1056 E Schoolhouse Rd
Kendallville, IN 46755

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wayne Center Elementary School",'Kendallville=' + Kendallville.length); Ligonier[Ligonier.length] = createMarker(new GPoint(-85.58763885,41.46598053),"
West Noble Elementary School
5294 N Us 33
Ligonier, IN 46767

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West Noble Elementary School",'Ligonier=' + Ligonier.length); Ligonier[Ligonier.length] = createMarker(new GPoint(-85.58763885,41.46598053),"
West Noble High School
5094 N Us 33
Ligonier, IN 46767

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("West Noble High School",'Ligonier=' + Ligonier.length); Ligonier[Ligonier.length] = createMarker(new GPoint(-85.58763885,41.46598053),"
West Noble Middle School
5194 N Us 33
Ligonier, IN 46767

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("West Noble Middle School",'Ligonier=' + Ligonier.length); Wolf_Lake[Wolf_Lake.length] = createMarker(new GPoint(-85.49579620,41.33499908),"
Wolf Lake Elementary School
Box 67
Wolf Lake, IN 46796

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wolf Lake Elementary School",'Wolf_Lake=' + Wolf_Lake.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(Albion); map.removeOverlays(Avilla); map.removeOverlays(Kendallville); map.removeOverlays(Laotto); map.removeOverlays(Ligonier); map.removeOverlays(Rome_City); map.removeOverlays(Wolf_Lake); 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(Albion);map.removeOverlays(Albion); map.removeOverlays(Avilla); map.removeOverlays(Kendallville); map.removeOverlays(Laotto); map.removeOverlays(Ligonier); map.removeOverlays(Rome_City); map.removeOverlays(Wolf_Lake); map.addOverlays(Albion); centerByArray(Albion, false, false); cntMarker += Albion.length; map.addOverlays(Avilla); centerByArray(Avilla, false, false); cntMarker += Avilla.length; map.addOverlays(Kendallville); centerByArray(Kendallville, false, false); cntMarker += Kendallville.length; map.addOverlays(Laotto); centerByArray(Laotto, false, false); cntMarker += Laotto.length; map.addOverlays(Ligonier); centerByArray(Ligonier, false, false); cntMarker += Ligonier.length; map.addOverlays(Rome_City); centerByArray(Rome_City, false, false); cntMarker += Rome_City.length; map.addOverlays(Wolf_Lake); centerByArray(Wolf_Lake, false, false); cntMarker += Wolf_Lake.length; centerByArray(Albion,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'); } }