function addMarkers() { mySelect = document.getElementById('selection'); Akin = [];Benton = [];West_Frankfort = [];Christopher = [];Ewing = [];Logan = [];Sesser = [];Thompsonville = [];Zeigler = [];mySelect.options[mySelect.options.length] = new Option("Akin schools",'all=Akin'); mySelect.options[mySelect.options.length] = new Option("Benton schools",'all=Benton'); mySelect.options[mySelect.options.length] = new Option("Christopher schools",'all=Christopher'); mySelect.options[mySelect.options.length] = new Option("Ewing schools",'all=Ewing'); mySelect.options[mySelect.options.length] = new Option("Logan schools",'all=Logan'); mySelect.options[mySelect.options.length] = new Option("Sesser schools",'all=Sesser'); mySelect.options[mySelect.options.length] = new Option("Thompsonville schools",'all=Thompsonville'); mySelect.options[mySelect.options.length] = new Option("West Frankfort schools",'all=West_Frankfort'); mySelect.options[mySelect.options.length] = new Option("Zeigler schools",'all=Zeigler'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Akin[Akin.length] = createMarker(new GPoint(-88.74787903,37.98949814),"
Akin Community Consolidated Elementary School
21962 Akin Blacktop
Akin, IL 62805

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Akin Community Consolidated Elementary School",'Akin=' + Akin.length); Benton[Benton.length] = createMarker(new GPoint(-88.91329956,37.99671555),"
Benton Consolidated High School
511 E Main St
Benton, IL 62812

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Benton Consolidated High School",'Benton=' + Benton.length); Benton[Benton.length] = createMarker(new GPoint(-88.90438843,37.96163559),"
Benton Grade School 5-8
1000 Forrest St
Benton, IL 62812

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Benton Grade School 5-8",'Benton=' + Benton.length); Benton[Benton.length] = createMarker(new GPoint(-88.90732574,37.98943710),"
Benton Grade School K-4
1000 Mckinzie St
Benton, IL 62812

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Benton Grade School K-4",'Benton=' + Benton.length); Benton[Benton.length] = createMarker(new GPoint(-88.90731812,37.98943710),"
Benton Intermediate School
1006 Mckenzie Street
Benton, IL 62812

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Benton Intermediate School",'Benton=' + Benton.length); West_Frankfort[West_Frankfort.length] = createMarker(new GPoint(-88.91107941,37.90686417),"
Central Junior High School
1500 E 9th St
West Frankfort, IL 62896

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Central Junior High School",'West_Frankfort=' + West_Frankfort.length); Christopher[Christopher.length] = createMarker(new GPoint(-89.05847168,37.96825790),"
Christopher Elementary School
501 S Snider St
Christopher, IL 62822

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Christopher Elementary School",'Christopher=' + Christopher.length); Christopher[Christopher.length] = createMarker(new GPoint(-89.05699921,37.97750092),"
Christopher High School
1 Bearcat Dr
Christopher, IL 62822

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Christopher High School",'Christopher=' + Christopher.length); West_Frankfort[West_Frankfort.length] = createMarker(new GPoint(-88.94408417,37.90483856),"
Denning Elementary School
1401 W 6th St
West Frankfort, IL 62896

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Denning Elementary School",'West_Frankfort=' + West_Frankfort.length); Ewing[Ewing.length] = createMarker(new GPoint(-88.82869720,38.09159851),"
Ewing-northern Elementary School
Po Box 525
Ewing, IL 62836

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ewing-northern Elementary School",'Ewing=' + Ewing.length); West_Frankfort[West_Frankfort.length] = createMarker(new GPoint(-88.92131805,37.89813614),"
Frankfort High School
601 E Main St
West Frankfort, IL 62896

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Frankfort High School",'West_Frankfort=' + West_Frankfort.length); West_Frankfort[West_Frankfort.length] = createMarker(new GPoint(-88.90972137,37.90203857),"
Frankfort Intermediate School
800 N Cherry St
West Frankfort, IL 62896

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Frankfort Intermediate School",'West_Frankfort=' + West_Frankfort.length); Benton[Benton.length] = createMarker(new GPoint(-88.90438843,37.96163559),"
Harvey Academic Preparation Center
1000 Forrest St
Benton, IL 62812

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Harvey Academic Preparation Center",'Benton=' + Benton.length); Logan[Logan.length] = createMarker(new GPoint(-87.59681702,39.73741913),"
Logan Elementary School
6612 1st East St
Logan, IL 62856

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Logan Elementary School",'Logan=' + Logan.length); Sesser[Sesser.length] = createMarker(new GPoint(-89.06563568,38.08168411),"
Sesser-valier Elementary School
4626 State Hwy 154
Sesser, IL 62884

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sesser-valier Elementary School",'Sesser=' + Sesser.length); Sesser[Sesser.length] = createMarker(new GPoint(-89.06563568,38.08168411),"
Sesser-valier High School
4626 State Hwy 154
Sesser, IL 62884

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sesser-valier High School",'Sesser=' + Sesser.length); Sesser[Sesser.length] = createMarker(new GPoint(-89.06563568,38.08168411),"
Sesser-valier Junior High School
4626 St Hwy 154
Sesser, IL 62884

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Sesser-valier Junior High School",'Sesser=' + Sesser.length); Benton[Benton.length] = createMarker(new GPoint(-88.92491150,38.00064850),"
Starquest Academy Regional Safe School Prg
410 W 5th St
Benton, IL 62812

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Starquest Academy Regional Safe School Prg",'Benton=' + Benton.length); Thompsonville[Thompsonville.length] = createMarker(new GPoint(-88.76589966,37.91883469),"
Thompsonville Grade School
21165 Shawneetown Rd
Thompsonville, IL 62890

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Thompsonville Grade School",'Thompsonville=' + Thompsonville.length); Thompsonville[Thompsonville.length] = createMarker(new GPoint(-88.76622009,37.91892624),"
Thompsonville High School
21135 Shawneetown Rd
Thompsonville, IL 62890

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Thompsonville High School",'Thompsonville=' + Thompsonville.length); Zeigler[Zeigler.length] = createMarker(new GPoint(-89.05380249,37.89899826),"
Zeigler-royalton Elementary School
Po Box 87
Zeigler, IL 62999

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Zeigler-royalton Elementary School",'Zeigler=' + Zeigler.length); Zeigler[Zeigler.length] = createMarker(new GPoint(-89.05380249,37.89899826),"
Zeigler-royalton High School
Po Box 38
Zeigler, IL 62999

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Zeigler-royalton High School",'Zeigler=' + Zeigler.length); Zeigler[Zeigler.length] = createMarker(new GPoint(-89.05380249,37.89899826),"
Zeigler-royalton Junior High School
P O Box 87 Hwy 148 N
Zeigler, IL 62999

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Zeigler-royalton Junior High School",'Zeigler=' + Zeigler.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(Akin); map.removeOverlays(Benton); map.removeOverlays(Christopher); map.removeOverlays(Ewing); map.removeOverlays(Logan); map.removeOverlays(Sesser); map.removeOverlays(Thompsonville); map.removeOverlays(West_Frankfort); map.removeOverlays(Zeigler); 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(Akin);map.removeOverlays(Akin); map.removeOverlays(Benton); map.removeOverlays(Christopher); map.removeOverlays(Ewing); map.removeOverlays(Logan); map.removeOverlays(Sesser); map.removeOverlays(Thompsonville); map.removeOverlays(West_Frankfort); map.removeOverlays(Zeigler); map.addOverlays(Akin); centerByArray(Akin, false, false); cntMarker += Akin.length; map.addOverlays(Benton); centerByArray(Benton, false, false); cntMarker += Benton.length; map.addOverlays(Christopher); centerByArray(Christopher, false, false); cntMarker += Christopher.length; map.addOverlays(Ewing); centerByArray(Ewing, false, false); cntMarker += Ewing.length; map.addOverlays(Logan); centerByArray(Logan, false, false); cntMarker += Logan.length; map.addOverlays(Sesser); centerByArray(Sesser, false, false); cntMarker += Sesser.length; map.addOverlays(Thompsonville); centerByArray(Thompsonville, false, false); cntMarker += Thompsonville.length; map.addOverlays(West_Frankfort); centerByArray(West_Frankfort, false, false); cntMarker += West_Frankfort.length; map.addOverlays(Zeigler); centerByArray(Zeigler, false, false); cntMarker += Zeigler.length; centerByArray(Akin,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'); } }