function addMarkers() { mySelect = document.getElementById('selection'); Pontiac = [];Chatsworth = [];Cornell = [];Dwight = [];Flanagan = [];Graymont = [];Forrest = [];Odell = [];Fairbury = [];Saunemin = [];Cullom = [];Streator = [];mySelect.options[mySelect.options.length] = new Option("Chatsworth schools",'all=Chatsworth'); mySelect.options[mySelect.options.length] = new Option("Cornell schools",'all=Cornell'); mySelect.options[mySelect.options.length] = new Option("Cullom schools",'all=Cullom'); mySelect.options[mySelect.options.length] = new Option("Dwight schools",'all=Dwight'); mySelect.options[mySelect.options.length] = new Option("Fairbury schools",'all=Fairbury'); mySelect.options[mySelect.options.length] = new Option("Flanagan schools",'all=Flanagan'); mySelect.options[mySelect.options.length] = new Option("Forrest schools",'all=Forrest'); mySelect.options[mySelect.options.length] = new Option("Graymont schools",'all=Graymont'); mySelect.options[mySelect.options.length] = new Option("Odell schools",'all=Odell'); mySelect.options[mySelect.options.length] = new Option("Pontiac schools",'all=Pontiac'); mySelect.options[mySelect.options.length] = new Option("Saunemin schools",'all=Saunemin'); mySelect.options[mySelect.options.length] = new Option("Streator schools",'all=Streator'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Pontiac[Pontiac.length] = createMarker(new GPoint(-88.62900543,40.88213730),"
Central Elementary School
117 W Livingston St
Pontiac, IL 61764

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Central Elementary School",'Pontiac=' + Pontiac.length); Chatsworth[Chatsworth.length] = createMarker(new GPoint(-88.29429626,40.74089813),"
Chatsworth Grade School
Po Box 816
Chatsworth, IL 60921

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Chatsworth Grade School",'Chatsworth=' + Chatsworth.length); Cornell[Cornell.length] = createMarker(new GPoint(-88.74510193,40.99610138),"
Cornell Elementary School
300 N 7th St
Cornell, IL 61319

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cornell Elementary School",'Cornell=' + Cornell.length); Dwight[Dwight.length] = createMarker(new GPoint(-88.42997742,41.08584213),"
Dwight Common School
801 S Columbia St
Dwight, IL 60420

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Dwight Common School",'Dwight=' + Dwight.length); Dwight[Dwight.length] = createMarker(new GPoint(-88.42469788,41.09220123),"
Dwight Correctional Center
Po Box 5001
Dwight, IL 60420

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Dwight Correctional Center",'Dwight=' + Dwight.length); Dwight[Dwight.length] = createMarker(new GPoint(-88.42597961,41.08655930),"
Dwight High School
801 S Franklin St
Dwight, IL 60420

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Dwight High School",'Dwight=' + Dwight.length); Flanagan[Flanagan.length] = createMarker(new GPoint(-88.86039734,40.87919998),"
Flanagan Elementary School
Po Box 367
Flanagan, IL 61740

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Flanagan Elementary School",'Flanagan=' + Flanagan.length); Flanagan[Flanagan.length] = createMarker(new GPoint(-88.86039734,40.87919998),"
Flanagan High School
Po Box 367
Flanagan, IL 61740

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Flanagan High School",'Flanagan=' + Flanagan.length); Flanagan[Flanagan.length] = createMarker(new GPoint(-88.85337830,40.84444427),"
Flanagan South Campus High School
15161 N 400 East Rd
Flanagan, IL 61740

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Flanagan South Campus High School",'Flanagan=' + Flanagan.length); Graymont[Graymont.length] = createMarker(new GPoint(-88.77380371,40.88729858),"
Graymont Elementary School
Po Box 117
Graymont, IL 61743

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Graymont Elementary School",'Graymont=' + Graymont.length); Pontiac[Pontiac.length] = createMarker(new GPoint(-88.62860107,40.87424850),"
Lincoln Elementary School
514 S Main St
Pontiac, IL 61764

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Pontiac=' + Pontiac.length); Pontiac[Pontiac.length] = createMarker(new GPoint(-88.61871338,40.88836288),"
Livingston Area Voc Center
1100 E Indiana Ave
Pontiac, IL 61764

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Livingston Area Voc Center",'Pontiac=' + Pontiac.length); Pontiac[Pontiac.length] = createMarker(new GPoint(-88.64131165,40.93176270),"
Livingston Co Crossroads Academy
1305 Indiana Ave
Pontiac, IL 61764

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Livingston Co Crossroads Academy",'Pontiac=' + Pontiac.length); Pontiac[Pontiac.length] = createMarker(new GPoint(-88.63989258,40.88626480),"
Livingston County Academy
920 Custer Ste B
Pontiac, IL 61764

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Livingston County Academy",'Pontiac=' + Pontiac.length); Forrest[Forrest.length] = createMarker(new GPoint(-88.41590881,40.75313187),"
Meadowbrook Elementary School
450 N Bach
Forrest, IL 61741

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Meadowbrook Elementary School",'Forrest=' + Forrest.length); Odell[Odell.length] = createMarker(new GPoint(-88.52043152,41.00229645),"
Odell Grade School
203 N East St
Odell, IL 60460

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Odell Grade School",'Odell=' + Odell.length); Pontiac[Pontiac.length] = createMarker(new GPoint(-88.63069916,40.87929916),"
Pontiac Correctional Center
Po Box 99
Pontiac, IL 61764

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pontiac Correctional Center",'Pontiac=' + Pontiac.length); Pontiac[Pontiac.length] = createMarker(new GPoint(-88.61871338,40.88836288),"
Pontiac High School
1100 E Indiana Ave
Pontiac, IL 61764

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pontiac High School",'Pontiac=' + Pontiac.length); Pontiac[Pontiac.length] = createMarker(new GPoint(-88.61741638,40.88304138),"
Pontiac Junior High School
600 Morrow St
Pontiac, IL 61764

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Pontiac Junior High School",'Pontiac=' + Pontiac.length); Fairbury[Fairbury.length] = createMarker(new GPoint(-88.50672150,40.75041199),"
Prairie Central High School
411 N 7th St
Fairbury, IL 61739

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Prairie Central High School",'Fairbury=' + Fairbury.length); Forrest[Forrest.length] = createMarker(new GPoint(-88.41348267,40.75516129),"
Prairie Central Junior High School
800 N Wood St
Forrest, IL 61741

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Prairie Central Junior High School",'Forrest=' + Forrest.length); Forrest[Forrest.length] = createMarker(new GPoint(-88.40650177,40.75260162),"
Prairie Central Upper Elementary School
Po Box 496
Forrest, IL 61741

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Prairie Central Upper Elementary School",'Forrest=' + Forrest.length); Saunemin[Saunemin.length] = createMarker(new GPoint(-88.40319824,40.88610077),"
Saunemin Elementary School
Po Box 290
Saunemin, IL 61769

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Saunemin Elementary School",'Saunemin=' + Saunemin.length); Cullom[Cullom.length] = createMarker(new GPoint(-88.28659821,40.88349915),"
Tri-point High School
Po Box 316
Cullom, IL 60929

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tri-point High School",'Cullom=' + Cullom.length); Pontiac[Pontiac.length] = createMarker(new GPoint(-88.61741638,40.88133621),"
Washington Elementary School
400 Morrow St
Pontiac, IL 61764

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Washington Elementary School",'Pontiac=' + Pontiac.length); Fairbury[Fairbury.length] = createMarker(new GPoint(-88.51638031,40.74146271),"
Westview Elementary School
600 S 1st St
Fairbury, IL 61739

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Westview Elementary School",'Fairbury=' + Fairbury.length); Streator[Streator.length] = createMarker(new GPoint(-88.81784058,41.06154633),"
Woodland Elementary/jr High School
5800 E 3000 North Rd
Streator, IL 61364

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Woodland Elementary/jr High School",'Streator=' + Streator.length); Streator[Streator.length] = createMarker(new GPoint(-88.81784058,41.06154633),"
Woodland High School
5800 E 3000 North Rd
Streator, IL 61364

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Woodland High School",'Streator=' + Streator.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(Chatsworth); map.removeOverlays(Cornell); map.removeOverlays(Cullom); map.removeOverlays(Dwight); map.removeOverlays(Fairbury); map.removeOverlays(Flanagan); map.removeOverlays(Forrest); map.removeOverlays(Graymont); map.removeOverlays(Odell); map.removeOverlays(Pontiac); map.removeOverlays(Saunemin); map.removeOverlays(Streator); 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(Pontiac);map.removeOverlays(Chatsworth); map.removeOverlays(Cornell); map.removeOverlays(Cullom); map.removeOverlays(Dwight); map.removeOverlays(Fairbury); map.removeOverlays(Flanagan); map.removeOverlays(Forrest); map.removeOverlays(Graymont); map.removeOverlays(Odell); map.removeOverlays(Pontiac); map.removeOverlays(Saunemin); map.removeOverlays(Streator); map.addOverlays(Chatsworth); centerByArray(Chatsworth, false, false); cntMarker += Chatsworth.length; map.addOverlays(Cornell); centerByArray(Cornell, false, false); cntMarker += Cornell.length; map.addOverlays(Cullom); centerByArray(Cullom, false, false); cntMarker += Cullom.length; map.addOverlays(Dwight); centerByArray(Dwight, false, false); cntMarker += Dwight.length; map.addOverlays(Fairbury); centerByArray(Fairbury, false, false); cntMarker += Fairbury.length; map.addOverlays(Flanagan); centerByArray(Flanagan, false, false); cntMarker += Flanagan.length; map.addOverlays(Forrest); centerByArray(Forrest, false, false); cntMarker += Forrest.length; map.addOverlays(Graymont); centerByArray(Graymont, false, false); cntMarker += Graymont.length; map.addOverlays(Odell); centerByArray(Odell, false, false); cntMarker += Odell.length; map.addOverlays(Pontiac); centerByArray(Pontiac, false, false); cntMarker += Pontiac.length; map.addOverlays(Saunemin); centerByArray(Saunemin, false, false); cntMarker += Saunemin.length; map.addOverlays(Streator); centerByArray(Streator, false, false); cntMarker += Streator.length; centerByArray(Pontiac,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'); } }