function addMarkers() { mySelect = document.getElementById('selection'); Carlisle = [];Dugger = [];Farmersburg = [];Graysville = [];Hymera = [];Shelburn = [];Sullivan = [];mySelect.options[mySelect.options.length] = new Option("Carlisle schools",'all=Carlisle'); mySelect.options[mySelect.options.length] = new Option("Dugger schools",'all=Dugger'); mySelect.options[mySelect.options.length] = new Option("Farmersburg schools",'all=Farmersburg'); mySelect.options[mySelect.options.length] = new Option("Graysville schools",'all=Graysville'); mySelect.options[mySelect.options.length] = new Option("Hymera schools",'all=Hymera'); mySelect.options[mySelect.options.length] = new Option("Shelburn schools",'all=Shelburn'); mySelect.options[mySelect.options.length] = new Option("Sullivan schools",'all=Sullivan'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Carlisle[Carlisle.length] = createMarker(new GPoint(-87.40261841,38.96332169),"
Carlisle Elementary And Junior High School
Po Box 649
Carlisle, IN 47838

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Carlisle Elementary And Junior High School",'Carlisle=' + Carlisle.length); Dugger[Dugger.length] = createMarker(new GPoint(-87.26130676,39.06740189),"
Dugger Elementary School
7356 E Cr 50 S
Dugger, IN 47848

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Dugger Elementary School",'Dugger=' + Dugger.length); Farmersburg[Farmersburg.length] = createMarker(new GPoint(-87.39559937,39.25000000),"
Farmersburg Elementary School
Po Box 689
Farmersburg, IN 47850

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Farmersburg Elementary School",'Farmersburg=' + Farmersburg.length); Graysville[Graysville.length] = createMarker(new GPoint(-87.55549622,39.12020111),"
Graysville Elementary School
Po Box 38
Graysville, IN 47852

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Graysville Elementary School",'Graysville=' + Graysville.length); Hymera[Hymera.length] = createMarker(new GPoint(-87.29949951,39.18629837),"
Hymera Elementary School
Po Box 494
Hymera, IN 47855

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hymera Elementary School",'Hymera=' + Hymera.length); Farmersburg[Farmersburg.length] = createMarker(new GPoint(-87.37985229,39.24826050),"
North Central High School
910 E Cr 975 N
Farmersburg, IN 47850

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("North Central High School",'Farmersburg=' + Farmersburg.length); Graysville[Graysville.length] = createMarker(new GPoint(-87.55605300,39.11758300),"
Rural Community Academy
Po Box 85
Graysville, IN 47852

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rural Community Academy",'Graysville=' + Graysville.length); Shelburn[Shelburn.length] = createMarker(new GPoint(-87.39459229,39.18370819),"
Shelburn Elementary School
620 N Washington St
Shelburn, IN 47879

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Shelburn Elementary School",'Shelburn=' + Shelburn.length); Sullivan[Sullivan.length] = createMarker(new GPoint(-87.41092682,39.11353302),"
Sullivan Elementary School
351 W Frakes St
Sullivan, IN 47882

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sullivan Elementary School",'Sullivan=' + Sullivan.length); Sullivan[Sullivan.length] = createMarker(new GPoint(-87.40957642,39.10477448),"
Sullivan High School
902 N Section
Sullivan, IN 47882

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sullivan High School",'Sullivan=' + Sullivan.length); Sullivan[Sullivan.length] = createMarker(new GPoint(-87.40964400,39.09493500),"
Sullivan Jr High School
820 N Section
Sullivan, IN 47882

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sullivan Jr High School",'Sullivan=' + Sullivan.length); Dugger[Dugger.length] = createMarker(new GPoint(-87.26130676,39.06740189),"
Union High School
7356 E Cr 50 S
Dugger, IN 47848

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Union High School",'Dugger=' + Dugger.length); Carlisle[Carlisle.length] = createMarker(new GPoint(-87.36329651,38.95940018),"
Wabash Valley Correctional Facility High School
Po Box 5006908 S Old Hwy Us41
Carlisle, IN 47838

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wabash Valley Correctional Facility High School",'Carlisle=' + Carlisle.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(Carlisle); map.removeOverlays(Dugger); map.removeOverlays(Farmersburg); map.removeOverlays(Graysville); map.removeOverlays(Hymera); map.removeOverlays(Shelburn); map.removeOverlays(Sullivan); 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(Carlisle);map.removeOverlays(Carlisle); map.removeOverlays(Dugger); map.removeOverlays(Farmersburg); map.removeOverlays(Graysville); map.removeOverlays(Hymera); map.removeOverlays(Shelburn); map.removeOverlays(Sullivan); map.addOverlays(Carlisle); centerByArray(Carlisle, false, false); cntMarker += Carlisle.length; map.addOverlays(Dugger); centerByArray(Dugger, false, false); cntMarker += Dugger.length; map.addOverlays(Farmersburg); centerByArray(Farmersburg, false, false); cntMarker += Farmersburg.length; map.addOverlays(Graysville); centerByArray(Graysville, false, false); cntMarker += Graysville.length; map.addOverlays(Hymera); centerByArray(Hymera, false, false); cntMarker += Hymera.length; map.addOverlays(Shelburn); centerByArray(Shelburn, false, false); cntMarker += Shelburn.length; map.addOverlays(Sullivan); centerByArray(Sullivan, false, false); cntMarker += Sullivan.length; centerByArray(Carlisle,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'); } }