function addMarkers() { mySelect = document.getElementById('selection'); Brownstown = [];Seymour = [];Crothersville = [];Freetown = [];Medora = [];mySelect.options[mySelect.options.length] = new Option("Brownstown schools",'all=Brownstown'); mySelect.options[mySelect.options.length] = new Option("Crothersville schools",'all=Crothersville'); mySelect.options[mySelect.options.length] = new Option("Freetown schools",'all=Freetown'); mySelect.options[mySelect.options.length] = new Option("Medora schools",'all=Medora'); mySelect.options[mySelect.options.length] = new Option("Seymour schools",'all=Seymour'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Brownstown[Brownstown.length] = createMarker(new GPoint(-86.04431152,38.88547516),"
Brownstown Central High School
500 N Elm St
Brownstown, IN 47220

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Brownstown Central High School",'Brownstown=' + Brownstown.length); Brownstown[Brownstown.length] = createMarker(new GPoint(-86.04699707,38.88078690),"
Brownstown Central Middle School
520 W Walnut St
Brownstown, IN 47220

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Brownstown Central Middle School",'Brownstown=' + Brownstown.length); Brownstown[Brownstown.length] = createMarker(new GPoint(-86.03802490,38.86713409),"
Brownstown Elementary School
612 S Base Rd
Brownstown, IN 47220

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Brownstown Elementary School",'Brownstown=' + Brownstown.length); Seymour[Seymour.length] = createMarker(new GPoint(-85.88923645,38.95952988),"
Cortland Elementary School
6687 N Cr 400 E
Seymour, IN 47274

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cortland Elementary School",'Seymour=' + Seymour.length); Crothersville[Crothersville.length] = createMarker(new GPoint(-85.83683777,38.79701996),"
Crothersville Elementary School
109 S Preston
Crothersville, IN 47229

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Crothersville Elementary School",'Crothersville=' + Crothersville.length); Crothersville[Crothersville.length] = createMarker(new GPoint(-85.83683777,38.79701996),"
Crothersville Jr-sr High School
109 N Preston St
Crothersville, IN 47229

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Crothersville Jr-sr High School",'Crothersville=' + Crothersville.length); Seymour[Seymour.length] = createMarker(new GPoint(-85.89842224,38.96083832),"
Emerson Elementary School
500 Emerson Dr
Seymour, IN 47274

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Emerson Elementary School",'Seymour=' + Seymour.length); Freetown[Freetown.length] = createMarker(new GPoint(-86.13043976,38.97561646),"
Freetown Elementary School
4696 W Columbus Pike
Freetown, IN 47235

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Freetown Elementary School",'Freetown=' + Freetown.length); Brownstown[Brownstown.length] = createMarker(new GPoint(-86.04177094,38.87918091),"
Jackson Co Juvenile Detention Cntr
Co 608 W Commerce St
Brownstown, IN 47220

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Jackson Co Juvenile Detention Cntr",'Brownstown=' + Brownstown.length); Seymour[Seymour.length] = createMarker(new GPoint(-85.87447357,38.95544434),"
Margaret R Brown Elementary School
550 Miller Ln
Seymour, IN 47274

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Margaret R Brown Elementary School",'Seymour=' + Seymour.length); Medora[Medora.length] = createMarker(new GPoint(-86.19129944,38.82849884),"
Medora Elementary School
Box 248
Medora, IN 47260

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Medora Elementary School",'Medora=' + Medora.length); Medora[Medora.length] = createMarker(new GPoint(-86.19129944,38.82849884),"
Medora Junior & Senior High School
Box 248
Medora, IN 47260

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Medora Junior & Senior High School",'Medora=' + Medora.length); Seymour[Seymour.length] = createMarker(new GPoint(-85.89082700,38.97637200),"
S.a.m.s.
321 E 16th St
Seymour, IN 47274

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("S.a.m.s.",'Seymour=' + Seymour.length); Seymour[Seymour.length] = createMarker(new GPoint(-85.87855530,38.96821594),"
Seymour Middle School
920 N O''brien St
Seymour, IN 47274

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Seymour Middle School",'Seymour=' + Seymour.length); Seymour[Seymour.length] = createMarker(new GPoint(-85.90580750,38.95429611),"
Seymour Senior High School
1350 W 2nd St
Seymour, IN 47274

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Seymour Senior High School",'Seymour=' + Seymour.length); Seymour[Seymour.length] = createMarker(new GPoint(-85.89170074,38.95116043),"
Seymour-jackson Elementary School
508 B Ave East
Seymour, IN 47274

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Seymour-jackson Elementary School",'Seymour=' + Seymour.length); Seymour[Seymour.length] = createMarker(new GPoint(-85.88981628,38.97177887),"
Seymour-redding Elementary School
1700 N Ewing St
Seymour, IN 47274

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Seymour-redding Elementary School",'Seymour=' + Seymour.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(Brownstown); map.removeOverlays(Crothersville); map.removeOverlays(Freetown); map.removeOverlays(Medora); map.removeOverlays(Seymour); 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(Brownstown);map.removeOverlays(Brownstown); map.removeOverlays(Crothersville); map.removeOverlays(Freetown); map.removeOverlays(Medora); map.removeOverlays(Seymour); map.addOverlays(Brownstown); centerByArray(Brownstown, false, false); cntMarker += Brownstown.length; map.addOverlays(Crothersville); centerByArray(Crothersville, false, false); cntMarker += Crothersville.length; map.addOverlays(Freetown); centerByArray(Freetown, false, false); cntMarker += Freetown.length; map.addOverlays(Medora); centerByArray(Medora, false, false); cntMarker += Medora.length; map.addOverlays(Seymour); centerByArray(Seymour, false, false); cntMarker += Seymour.length; centerByArray(Brownstown,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'); } }