function addMarkers() { mySelect = document.getElementById('selection'); Mattoon = [];Ashmore = [];Charleston = [];Humboldt = [];Oakland = [];Lerna = [];mySelect.options[mySelect.options.length] = new Option("Ashmore schools",'all=Ashmore'); mySelect.options[mySelect.options.length] = new Option("Charleston schools",'all=Charleston'); mySelect.options[mySelect.options.length] = new Option("Humboldt schools",'all=Humboldt'); mySelect.options[mySelect.options.length] = new Option("Lerna schools",'all=Lerna'); mySelect.options[mySelect.options.length] = new Option("Mattoon schools",'all=Mattoon'); mySelect.options[mySelect.options.length] = new Option("Oakland schools",'all=Oakland'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Mattoon[Mattoon.length] = createMarker(new GPoint(-88.35891724,39.46749878),"
Arland D Williams Junior Elementary School
1709 S 9th St
Mattoon, IL 61938

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Arland D Williams Junior Elementary School",'Mattoon=' + Mattoon.length); Mattoon[Mattoon.length] = createMarker(new GPoint(-88.37117767,39.49023819),"
Armstrong Center Tmh School
1400 Piatt Ave
Mattoon, IL 61938

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Armstrong Center Tmh School",'Mattoon=' + Mattoon.length); Ashmore[Ashmore.length] = createMarker(new GPoint(-88.04170227,39.52750015),"
Ashmore Elementary School
Po Box 219
Ashmore, IL 61912

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ashmore Elementary School",'Ashmore=' + Ashmore.length); Mattoon[Mattoon.length] = createMarker(new GPoint(-88.39527893,39.48192596),"
Bennett Elementary School
205 S 32nd St
Mattoon, IL 61938

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bennett Elementary School",'Mattoon=' + Mattoon.length); Charleston[Charleston.length] = createMarker(new GPoint(-88.19120789,39.47869873),"
Carl Sandburg Elementary School
1924 Reynolds Dr
Charleston, IL 61920

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Carl Sandburg Elementary School",'Charleston=' + Charleston.length); Charleston[Charleston.length] = createMarker(new GPoint(-88.17447662,39.49309540),"
Charleston Bridges
730 7th St Ste A
Charleston, IL 61920

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Charleston Bridges",'Charleston=' + Charleston.length); Charleston[Charleston.length] = createMarker(new GPoint(-88.16479492,39.48453522),"
Charleston High School
1603 Lincoln
Charleston, IL 61920

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Charleston High School",'Charleston=' + Charleston.length); Charleston[Charleston.length] = createMarker(new GPoint(-88.17631400,39.49597500),"
Charleston Middle School
920 Smith Dr
Charleston, IL 61920

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Charleston Middle School",'Charleston=' + Charleston.length); Mattoon[Mattoon.length] = createMarker(new GPoint(-88.38866425,39.47676468),"
Diagnostic & Developmental Center
1201 S 6th St
Mattoon, IL 61938

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Diagnostic & Developmental Center",'Mattoon=' + Mattoon.length); Charleston[Charleston.length] = createMarker(new GPoint(-88.17447662,39.49309540),"
Eastern Il Efe/dual Credit
730 7th St
Charleston, IL 61920

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Eastern Il Efe/dual Credit",'Charleston=' + Charleston.length); Mattoon[Mattoon.length] = createMarker(new GPoint(-88.36037445,39.47085571),"
Franklin Elementary School
1201 S 6th St
Mattoon, IL 61938

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Franklin Elementary School",'Mattoon=' + Mattoon.length); Mattoon[Mattoon.length] = createMarker(new GPoint(-88.38452148,39.48616409),"
Hawthorne Elementary Sch/armstrong Tmh
2405 Champaign Ave
Mattoon, IL 61938

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hawthorne Elementary Sch/armstrong Tmh",'Mattoon=' + Mattoon.length); Humboldt[Humboldt.length] = createMarker(new GPoint(-88.31379700,39.59799957),"
Humboldt Elementary School
P O Box 37
Humboldt, IL 61931

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Humboldt Elementary School",'Humboldt=' + Humboldt.length); Charleston[Charleston.length] = createMarker(new GPoint(-88.17374420,39.49715424),"
Jefferson Elementary School
801 Jefferson Ave
Charleston, IL 61920

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jefferson Elementary School",'Charleston=' + Charleston.length); Oakland[Oakland.length] = createMarker(new GPoint(-88.03199768,39.65069962),"
Lake Crest Elementary School
Po Box 200
Oakland, IL 61943

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lake Crest Elementary School",'Oakland=' + Oakland.length); Lerna[Lerna.length] = createMarker(new GPoint(-88.26210022,39.39759827),"
Lerna Elementary School
P O Box 129
Lerna, IL 62440

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lerna Elementary School",'Lerna=' + Lerna.length); Mattoon[Mattoon.length] = createMarker(new GPoint(-88.37502289,39.47116089),"
Lincoln Elementary School
1200 S 17th St
Mattoon, IL 61938

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Mattoon=' + Mattoon.length); Charleston[Charleston.length] = createMarker(new GPoint(-88.16812134,39.48725891),"
Mark Twain Elementary School
1021 13th St
Charleston, IL 61920

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mark Twain Elementary School",'Charleston=' + Charleston.length); Lerna[Lerna.length] = createMarker(new GPoint(-88.34330750,39.49003220),"
Mattoon Bridges
Po Box 129
Lerna, IL 62440

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mattoon Bridges",'Lerna=' + Lerna.length); Mattoon[Mattoon.length] = createMarker(new GPoint(-88.38602448,39.47526169),"
Mattoon High School
2521 Walnut Ave
Mattoon, IL 61938

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mattoon High School",'Mattoon=' + Mattoon.length); Mattoon[Mattoon.length] = createMarker(new GPoint(-88.36412048,39.47105026),"
Mattoon Middle School
1200 S 9th St
Mattoon, IL 61938

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Mattoon Middle School",'Mattoon=' + Mattoon.length); Oakland[Oakland.length] = createMarker(new GPoint(-88.03199768,39.65069962),"
Oakland High School
Po Box 378
Oakland, IL 61943

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oakland High School",'Oakland=' + Oakland.length); Mattoon[Mattoon.length] = createMarker(new GPoint(-88.34626770,39.48482513),"
Pathways Roe 11 High School
305 Richmond E
Mattoon, IL 61938

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pathways Roe 11 High School",'Mattoon=' + Mattoon.length); Mattoon[Mattoon.length] = createMarker(new GPoint(-88.35891724,39.46749878),"
Riddle Elementary School
4201 Western Ave
Mattoon, IL 61938

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Riddle Elementary School",'Mattoon=' + Mattoon.length); Humboldt[Humboldt.length] = createMarker(new GPoint(-88.38132477,39.48333740),"
Treatment & Learning Center
Po Box 97
Humboldt, IL 61931

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Treatment & Learning Center",'Humboldt=' + Humboldt.length); Mattoon[Mattoon.length] = createMarker(new GPoint(-88.36894989,39.48699951),"
Washington Elementary School
1200 Shelby Ave
Mattoon, IL 61938

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Washington Elementary School",'Mattoon=' + Mattoon.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(Ashmore); map.removeOverlays(Charleston); map.removeOverlays(Humboldt); map.removeOverlays(Lerna); map.removeOverlays(Mattoon); map.removeOverlays(Oakland); 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(Mattoon);map.removeOverlays(Ashmore); map.removeOverlays(Charleston); map.removeOverlays(Humboldt); map.removeOverlays(Lerna); map.removeOverlays(Mattoon); map.removeOverlays(Oakland); map.addOverlays(Ashmore); centerByArray(Ashmore, false, false); cntMarker += Ashmore.length; map.addOverlays(Charleston); centerByArray(Charleston, false, false); cntMarker += Charleston.length; map.addOverlays(Humboldt); centerByArray(Humboldt, false, false); cntMarker += Humboldt.length; map.addOverlays(Lerna); centerByArray(Lerna, false, false); cntMarker += Lerna.length; map.addOverlays(Mattoon); centerByArray(Mattoon, false, false); cntMarker += Mattoon.length; map.addOverlays(Oakland); centerByArray(Oakland, false, false); cntMarker += Oakland.length; centerByArray(Mattoon,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'); } }