function addMarkers() { mySelect = document.getElementById('selection'); Centralia = [];Salem = [];Iuka = [];Kell = [];Odin = [];Patoka = [];Sandoval = [];Farina = [];Kinmundy = [];mySelect.options[mySelect.options.length] = new Option("Centralia schools",'all=Centralia'); mySelect.options[mySelect.options.length] = new Option("Farina schools",'all=Farina'); mySelect.options[mySelect.options.length] = new Option("Iuka schools",'all=Iuka'); mySelect.options[mySelect.options.length] = new Option("Kell schools",'all=Kell'); mySelect.options[mySelect.options.length] = new Option("Kinmundy schools",'all=Kinmundy'); mySelect.options[mySelect.options.length] = new Option("Odin schools",'all=Odin'); mySelect.options[mySelect.options.length] = new Option("Patoka schools",'all=Patoka'); mySelect.options[mySelect.options.length] = new Option("Salem schools",'all=Salem'); mySelect.options[mySelect.options.length] = new Option("Sandoval schools",'all=Sandoval'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Centralia[Centralia.length] = createMarker(new GPoint(-89.13816071,38.50493622),"
Bronson Center
226 Chicago Ave
Centralia, IL 62801

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bronson Center",'Centralia=' + Centralia.length); Centralia[Centralia.length] = createMarker(new GPoint(-89.12808990,38.54787827),"
Central City Elementary School
129 Douglas St
Centralia, IL 62801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Central City Elementary School",'Centralia=' + Centralia.length); Salem[Salem.length] = createMarker(new GPoint(-88.94777679,38.62462997),"
Central Elementary School
315 S Maple St
Salem, IL 62881

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Central Elementary School",'Salem=' + Salem.length); Centralia[Centralia.length] = createMarker(new GPoint(-89.12922668,38.54959869),"
Centralia Alternative School
223 N Broadway
Centralia, IL 62801

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Centralia Alternative School",'Centralia=' + Centralia.length); Centralia[Centralia.length] = createMarker(new GPoint(-89.12879944,38.52619934),"
Centralia Correctional Center
Po Box 1266
Centralia, IL 62801

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Centralia Correctional Center",'Centralia=' + Centralia.length); Centralia[Centralia.length] = createMarker(new GPoint(-89.12062073,38.52413559),"
Centralia High School
1000 E 3rd St
Centralia, IL 62801

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Centralia High School",'Centralia=' + Centralia.length); Centralia[Centralia.length] = createMarker(new GPoint(-89.13047028,38.51766205),"
Centralia Junior High School
900 S Pine St
Centralia, IL 62801

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Centralia Junior High School",'Centralia=' + Centralia.length); Centralia[Centralia.length] = createMarker(new GPoint(-89.13278198,38.52299500),"
Centralia Pre-kindergarten Center
422 S Elm St
Centralia, IL 62801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Centralia Pre-kindergarten Center",'Centralia=' + Centralia.length); Salem[Salem.length] = createMarker(new GPoint(-88.95897675,38.62833786),"
Clnton/mrn/wshngtn Pre-kind Prog Elementary School
200 E Schwartz St
Salem, IL 62881

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Clnton/mrn/wshngtn Pre-kind Prog Elementary School",'Salem=' + Salem.length); Salem[Salem.length] = createMarker(new GPoint(-88.94561400,38.62666000),"
Clnton/mrn/wshngtn Truant Alt School
200 E Schwartz St
Salem, IL 62881

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Clnton/mrn/wshngtn Truant Alt School",'Salem=' + Salem.length); Centralia[Centralia.length] = createMarker(new GPoint(-89.13702393,38.51585770),"
Field Kindergarten Center
1101 S Locust St
Centralia, IL 62801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Field Kindergarten Center",'Centralia=' + Centralia.length); Salem[Salem.length] = createMarker(new GPoint(-88.95117187,38.63930130),"
Franklin Park Middle School
1325 N Franklin St
Salem, IL 62881

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Franklin Park Middle School",'Salem=' + Salem.length); Salem[Salem.length] = createMarker(new GPoint(-88.95897675,38.63753891),"
Hawthorn Elementary School
1300 Hawthorn Rd
Salem, IL 62881

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hawthorn Elementary School",'Salem=' + Salem.length); Centralia[Centralia.length] = createMarker(new GPoint(-89.12879944,38.52619934),"
Hudelson Education Center
Po Box 548
Centralia, IL 62801

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hudelson Education Center",'Centralia=' + Centralia.length); Centralia[Centralia.length] = createMarker(new GPoint(-89.12751007,38.52490234),"
Irving Elementary School
200 S Pine St
Centralia, IL 62801

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Irving Elementary School",'Centralia=' + Centralia.length); Iuka[Iuka.length] = createMarker(new GPoint(-88.77230072,38.59469986),"
Iuka Community Consolidated School
Po Box 68
Iuka, IL 62849

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Iuka Community Consolidated School",'Iuka=' + Iuka.length); Centralia[Centralia.length] = createMarker(new GPoint(-89.09822083,38.48541641),"
Jordan Elementary School
311 Airport Rd
Centralia, IL 62801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jordan Elementary School",'Centralia=' + Centralia.length); Kell[Kell.length] = createMarker(new GPoint(-88.91500092,38.51459885),"
Kell Grade School
Po Box 9
Kell, IL 62853

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Kell Grade School",'Kell=' + Kell.length); Centralia[Centralia.length] = createMarker(new GPoint(-89.12962341,38.53224182),"
Lincoln Elementary School
501 N Elm St
Centralia, IL 62801

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Centralia=' + Centralia.length); Salem[Salem.length] = createMarker(new GPoint(-88.95897675,38.62833786),"
Mar/clin/wash Co Rds
200 E Schwartz
Salem, IL 62881

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mar/clin/wash Co Rds",'Salem=' + Salem.length); Odin[Odin.length] = createMarker(new GPoint(-89.04900360,38.61610031),"
Odin Elementary School
Po Box 250
Odin, IL 62870

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Odin Elementary School",'Odin=' + Odin.length); Odin[Odin.length] = createMarker(new GPoint(-89.04900360,38.61610031),"
Odin High School
Po Box 250
Odin, IL 62870

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Odin High School",'Odin=' + Odin.length); Patoka[Patoka.length] = createMarker(new GPoint(-89.08608246,38.76494980),"
Patoka Elementary School
1220 Kinoka Rd
Patoka, IL 62875

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Patoka Elementary School",'Patoka=' + Patoka.length); Patoka[Patoka.length] = createMarker(new GPoint(-89.08608246,38.76494980),"
Patoka Junior High School
1220 Kinoka Road
Patoka, IL 62875

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Patoka Junior High School",'Patoka=' + Patoka.length); Patoka[Patoka.length] = createMarker(new GPoint(-89.08608246,38.76494980),"
Patoka Senior High School
1220 Kinoka Rd
Patoka, IL 62875

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Patoka Senior High School",'Patoka=' + Patoka.length); Centralia[Centralia.length] = createMarker(new GPoint(-88.97868347,38.51927185),"
Raccoon Consolidated Elementary School
3601 State Route 161
Centralia, IL 62801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Raccoon Consolidated Elementary School",'Centralia=' + Centralia.length); Centralia[Centralia.length] = createMarker(new GPoint(-89.13816071,38.50493622),"
Safe School Program Centralia
226 Chicago Ave
Centralia, IL 62801

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Safe School Program Centralia",'Centralia=' + Centralia.length); Salem[Salem.length] = createMarker(new GPoint(-88.94456482,38.63742828),"
Salem Community High School
1200 N Broadway
Salem, IL 62881

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Salem Community High School",'Salem=' + Salem.length); Sandoval[Sandoval.length] = createMarker(new GPoint(-89.11660767,38.61467743),"
Sandoval Elementary School
300 Perry Ave
Sandoval, IL 62882

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sandoval Elementary School",'Sandoval=' + Sandoval.length); Sandoval[Sandoval.length] = createMarker(new GPoint(-89.13101959,38.61643600),"
Sandoval Junior High School
859 W Missouri Ave
Sandoval, IL 62882

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Sandoval Junior High School",'Sandoval=' + Sandoval.length); Sandoval[Sandoval.length] = createMarker(new GPoint(-89.13101959,38.61643600),"
Sandoval Senior High School
859 W Missouri Ave
Sandoval, IL 62882

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sandoval Senior High School",'Sandoval=' + Sandoval.length); Salem[Salem.length] = createMarker(new GPoint(-88.99588013,38.62237167),"
Selmaville North Elementary School
3185 Selmaville Rd
Salem, IL 62881

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Selmaville North Elementary School",'Salem=' + Salem.length); Salem[Salem.length] = createMarker(new GPoint(-88.99962616,38.59079361),"
Selmaville South Elementary School
3185 Selmaville Road
Salem, IL 62881

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Selmaville South Elementary School",'Salem=' + Salem.length); Farina[Farina.length] = createMarker(new GPoint(-88.76979828,38.84529877),"
South Central Elementary-farina Middle School
Rr 1 Box 35-3
Farina, IL 62838

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("South Central Elementary-farina Middle School",'Farina=' + Farina.length); Kinmundy[Kinmundy.length] = createMarker(new GPoint(-88.84018707,38.77363586),"
South Central Elementary-kinmundy Elementary School
P O Box 59
Kinmundy, IL 62854

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("South Central Elementary-kinmundy Elementary School",'Kinmundy=' + Kinmundy.length); Farina[Farina.length] = createMarker(new GPoint(-88.76979828,38.84529877),"
South Central High School
Rr 2 Box 9-1
Farina, IL 62838

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("South Central High School",'Farina=' + Farina.length); Kinmundy[Kinmundy.length] = createMarker(new GPoint(-88.81770325,38.76710129),"
South Central Middle School
Po Box 40
Kinmundy, IL 62854

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("South Central Middle School",'Kinmundy=' + Kinmundy.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(Centralia); map.removeOverlays(Farina); map.removeOverlays(Iuka); map.removeOverlays(Kell); map.removeOverlays(Kinmundy); map.removeOverlays(Odin); map.removeOverlays(Patoka); map.removeOverlays(Salem); map.removeOverlays(Sandoval); 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(Centralia);map.removeOverlays(Centralia); map.removeOverlays(Farina); map.removeOverlays(Iuka); map.removeOverlays(Kell); map.removeOverlays(Kinmundy); map.removeOverlays(Odin); map.removeOverlays(Patoka); map.removeOverlays(Salem); map.removeOverlays(Sandoval); map.addOverlays(Centralia); centerByArray(Centralia, false, false); cntMarker += Centralia.length; map.addOverlays(Farina); centerByArray(Farina, false, false); cntMarker += Farina.length; map.addOverlays(Iuka); centerByArray(Iuka, false, false); cntMarker += Iuka.length; map.addOverlays(Kell); centerByArray(Kell, false, false); cntMarker += Kell.length; map.addOverlays(Kinmundy); centerByArray(Kinmundy, false, false); cntMarker += Kinmundy.length; map.addOverlays(Odin); centerByArray(Odin, false, false); cntMarker += Odin.length; map.addOverlays(Patoka); centerByArray(Patoka, false, false); cntMarker += Patoka.length; map.addOverlays(Salem); centerByArray(Salem, false, false); cntMarker += Salem.length; map.addOverlays(Sandoval); centerByArray(Sandoval, false, false); cntMarker += Sandoval.length; centerByArray(Centralia,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'); } }