function addMarkers() { mySelect = document.getElementById('selection'); Albers = [];Aviston = [];Bartelso = [];Beckemeyer = [];Breese = [];Carlyle = [];Damiansville = [];Germantown = [];Centralia = [];New_Baden = [];Trenton = [];St_Rose = [];mySelect.options[mySelect.options.length] = new Option("Albers schools",'all=Albers'); mySelect.options[mySelect.options.length] = new Option("Aviston schools",'all=Aviston'); mySelect.options[mySelect.options.length] = new Option("Bartelso schools",'all=Bartelso'); mySelect.options[mySelect.options.length] = new Option("Beckemeyer schools",'all=Beckemeyer'); mySelect.options[mySelect.options.length] = new Option("Breese schools",'all=Breese'); mySelect.options[mySelect.options.length] = new Option("Carlyle schools",'all=Carlyle'); mySelect.options[mySelect.options.length] = new Option("Centralia schools",'all=Centralia'); mySelect.options[mySelect.options.length] = new Option("Damiansville schools",'all=Damiansville'); mySelect.options[mySelect.options.length] = new Option("Germantown schools",'all=Germantown'); mySelect.options[mySelect.options.length] = new Option("New Baden schools",'all=New_Baden'); mySelect.options[mySelect.options.length] = new Option("St Rose schools",'all=St_Rose'); mySelect.options[mySelect.options.length] = new Option("Trenton schools",'all=Trenton'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Albers[Albers.length] = createMarker(new GPoint(-89.61409760,38.52830124),"
Albers Elementary School
Po Box 104
Albers, IL 62215

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Albers Elementary School",'Albers=' + Albers.length); Aviston[Aviston.length] = createMarker(new GPoint(-89.60959625,38.60729980),"
Aviston Elementary School
350 S Hull St
Aviston, IL 62216

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Aviston Elementary School",'Aviston=' + Aviston.length); Bartelso[Bartelso.length] = createMarker(new GPoint(-89.46662140,38.53665161),"
Bartelso Elementary School
306 S Washington St
Bartelso, IL 62218

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bartelso Elementary School",'Bartelso=' + Bartelso.length); Beckemeyer[Beckemeyer.length] = createMarker(new GPoint(-89.43479919,38.60480118),"
Beckemeyer Elementary School
Po Box 307
Beckemeyer, IL 62219

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Beckemeyer Elementary School",'Beckemeyer=' + Beckemeyer.length); Breese[Breese.length] = createMarker(new GPoint(-89.51697540,38.61286545),"
Breese Elementary School
777 Memorial Dr
Breese, IL 62230

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Breese Elementary School",'Breese=' + Breese.length); Carlyle[Carlyle.length] = createMarker(new GPoint(-89.36537170,38.61362076),"
Carlyle Elementary School
951 6th St
Carlyle, IL 62231

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Carlyle Elementary School",'Carlyle=' + Carlyle.length); Carlyle[Carlyle.length] = createMarker(new GPoint(-89.37317657,38.61899948),"
Carlyle High School
1461 12th St
Carlyle, IL 62231

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Carlyle High School",'Carlyle=' + Carlyle.length); Carlyle[Carlyle.length] = createMarker(new GPoint(-89.37317657,38.62040710),"
Carlyle Junior High School
1631 12th St
Carlyle, IL 62231

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Carlyle Junior High School",'Carlyle=' + Carlyle.length); Breese[Breese.length] = createMarker(new GPoint(-89.55687714,38.61140060),"
Central Community High School
7740 Old Us Hwy 50
Breese, IL 62230

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Central Community High School",'Breese=' + Breese.length); Damiansville[Damiansville.length] = createMarker(new GPoint(-89.62271881,38.50996399),"
Damiansville Elementary School
101 E Main
Damiansville, IL 62215

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Damiansville Elementary School",'Damiansville=' + Damiansville.length); Germantown[Germantown.length] = createMarker(new GPoint(-89.54900360,38.55170059),"
Germantown Elementary School
Po Box 400
Germantown, IL 62245

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Germantown Elementary School",'Germantown=' + Germantown.length); Centralia[Centralia.length] = createMarker(new GPoint(-89.13213348,38.52453995),"
Kaskaskia Education Center
1535 W Mccord Elm
Centralia, IL 62801

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kaskaskia Education Center",'Centralia=' + Centralia.length); New_Baden[New_Baden.length] = createMarker(new GPoint(-89.69280243,38.53903580),"
New Baden Elementary School
700 Marilyn Dr
New Baden, IL 62265

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("New Baden Elementary School",'New_Baden=' + New_Baden.length); Centralia[Centralia.length] = createMarker(new GPoint(-89.14607239,38.51206207),"
North Wamac Grade School
1500 Case St
Centralia, IL 62801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Wamac Grade School",'Centralia=' + Centralia.length); Carlyle[Carlyle.length] = createMarker(new GPoint(-89.37107849,38.61133575),"
Safe School Program Carlyle
1063 Fairfax
Carlyle, IL 62231

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Safe School Program Carlyle",'Carlyle=' + Carlyle.length); Centralia[Centralia.length] = createMarker(new GPoint(-89.14758301,38.52553558),"
Schiller Elementary School
800 W 4th St
Centralia, IL 62801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Schiller Elementary School",'Centralia=' + Centralia.length); New_Baden[New_Baden.length] = createMarker(new GPoint(-89.69676208,38.53746414),"
St George Elementary School
317 E Maple St
New Baden, IL 62265

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("St George Elementary School",'New_Baden=' + New_Baden.length); Carlyle[Carlyle.length] = createMarker(new GPoint(-89.37238312,38.61323547),"
St Mary Public Elementary School
1171 Livingston
Carlyle, IL 62231

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("St Mary Public Elementary School",'Carlyle=' + Carlyle.length); Trenton[Trenton.length] = createMarker(new GPoint(-89.68487549,38.60289383),"
St Marys Elementary School
313 S Adams St
Trenton, IL 62293

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("St Marys Elementary School",'Trenton=' + Trenton.length); St_Rose[St_Rose.length] = createMarker(new GPoint(-89.55451965,38.68405151),"
St Rose Elementary School
18004 St Rose Rd
St Rose, IL 62230

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("St Rose Elementary School",'St_Rose=' + St_Rose.length); Trenton[Trenton.length] = createMarker(new GPoint(-89.68342590,38.60828018),"
Trenton Elementary School
308 N Washington St
Trenton, IL 62293

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Trenton Elementary School",'Trenton=' + Trenton.length); Trenton[Trenton.length] = createMarker(new GPoint(-89.68684387,38.56809235),"
Wesclin Junior High School
10003 State Rt 160 S
Trenton, IL 62293

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Wesclin Junior High School",'Trenton=' + Trenton.length); Trenton[Trenton.length] = createMarker(new GPoint(-89.68684387,38.56809235),"
Wesclin Senior High School
10003 State Rt 160 S
Trenton, IL 62293

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wesclin Senior High School",'Trenton=' + Trenton.length); Centralia[Centralia.length] = createMarker(new GPoint(-89.14824677,38.52136230),"
Willow Grove Elementary School
815 W 7th St
Centralia, IL 62801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Willow Grove Elementary School",'Centralia=' + Centralia.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(Albers); map.removeOverlays(Aviston); map.removeOverlays(Bartelso); map.removeOverlays(Beckemeyer); map.removeOverlays(Breese); map.removeOverlays(Carlyle); map.removeOverlays(Centralia); map.removeOverlays(Damiansville); map.removeOverlays(Germantown); map.removeOverlays(New_Baden); map.removeOverlays(St_Rose); map.removeOverlays(Trenton); 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(Albers);map.removeOverlays(Albers); map.removeOverlays(Aviston); map.removeOverlays(Bartelso); map.removeOverlays(Beckemeyer); map.removeOverlays(Breese); map.removeOverlays(Carlyle); map.removeOverlays(Centralia); map.removeOverlays(Damiansville); map.removeOverlays(Germantown); map.removeOverlays(New_Baden); map.removeOverlays(St_Rose); map.removeOverlays(Trenton); map.addOverlays(Albers); centerByArray(Albers, false, false); cntMarker += Albers.length; map.addOverlays(Aviston); centerByArray(Aviston, false, false); cntMarker += Aviston.length; map.addOverlays(Bartelso); centerByArray(Bartelso, false, false); cntMarker += Bartelso.length; map.addOverlays(Beckemeyer); centerByArray(Beckemeyer, false, false); cntMarker += Beckemeyer.length; map.addOverlays(Breese); centerByArray(Breese, false, false); cntMarker += Breese.length; map.addOverlays(Carlyle); centerByArray(Carlyle, false, false); cntMarker += Carlyle.length; map.addOverlays(Centralia); centerByArray(Centralia, false, false); cntMarker += Centralia.length; map.addOverlays(Damiansville); centerByArray(Damiansville, false, false); cntMarker += Damiansville.length; map.addOverlays(Germantown); centerByArray(Germantown, false, false); cntMarker += Germantown.length; map.addOverlays(New_Baden); centerByArray(New_Baden, false, false); cntMarker += New_Baden.length; map.addOverlays(St_Rose); centerByArray(St_Rose, false, false); cntMarker += St_Rose.length; map.addOverlays(Trenton); centerByArray(Trenton, false, false); cntMarker += Trenton.length; centerByArray(Albers,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'); } }