function addMarkers() { mySelect = document.getElementById('selection'); Ransom = [];Mendota = [];Streator = [];Ottawa = [];Seneca = [];La_Salle = [];Earlville = [];Grand_Ridge = [];Lasalle = [];Leland = [];Oglesby = [];Lostant = [];Marseilles = [];Peru = [];Serena = [];Sheridan = [];Tonica = [];Utica = [];mySelect.options[mySelect.options.length] = new Option("Earlville schools",'all=Earlville'); mySelect.options[mySelect.options.length] = new Option("Grand Ridge schools",'all=Grand_Ridge'); mySelect.options[mySelect.options.length] = new Option("La Salle schools",'all=La_Salle'); mySelect.options[mySelect.options.length] = new Option("Lasalle schools",'all=Lasalle'); mySelect.options[mySelect.options.length] = new Option("Leland schools",'all=Leland'); mySelect.options[mySelect.options.length] = new Option("Lostant schools",'all=Lostant'); mySelect.options[mySelect.options.length] = new Option("Marseilles schools",'all=Marseilles'); mySelect.options[mySelect.options.length] = new Option("Mendota schools",'all=Mendota'); mySelect.options[mySelect.options.length] = new Option("Oglesby schools",'all=Oglesby'); mySelect.options[mySelect.options.length] = new Option("Ottawa schools",'all=Ottawa'); mySelect.options[mySelect.options.length] = new Option("Peru schools",'all=Peru'); mySelect.options[mySelect.options.length] = new Option("Ransom schools",'all=Ransom'); mySelect.options[mySelect.options.length] = new Option("Seneca schools",'all=Seneca'); mySelect.options[mySelect.options.length] = new Option("Serena schools",'all=Serena'); mySelect.options[mySelect.options.length] = new Option("Sheridan schools",'all=Sheridan'); mySelect.options[mySelect.options.length] = new Option("Streator schools",'all=Streator'); mySelect.options[mySelect.options.length] = new Option("Tonica schools",'all=Tonica'); mySelect.options[mySelect.options.length] = new Option("Utica schools",'all=Utica'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Ransom[Ransom.length] = createMarker(new GPoint(-88.65408325,41.15396118),"
",iconRd); mySelect.options[mySelect.options.length] = new Option("Allen-otter Creek Ccsd 65 Elementary School",'Ransom=' + Ransom.length); Mendota[Mendota.length] = createMarker(new GPoint(-89.12797546,41.54916382),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Blackstone Elementary School",'Mendota=' + Mendota.length); Streator[Streator.length] = createMarker(new GPoint(-88.84456635,41.15013885),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Centennial Elementary School",'Streator=' + Streator.length); Ottawa[Ottawa.length] = createMarker(new GPoint(-88.84401703,41.34429932),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Central Elementary School",'Ottawa=' + Ottawa.length); Seneca[Seneca.length] = createMarker(new GPoint(-88.60619354,41.31399155),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Circuit Breaker School",'Seneca=' + Seneca.length); Ottawa[Ottawa.length] = createMarker(new GPoint(-88.96661377,41.27318573),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Deer Park C C Elementary School",'Ottawa=' + Ottawa.length); La_Salle[La_Salle.length] = createMarker(new GPoint(-89.10736847,41.41152573),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Dimmick Community Consolidated School",'La_Salle=' + La_Salle.length); Earlville[Earlville.length] = createMarker(new GPoint(-88.91510010,41.59049988),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Earlville Elementary School",'Earlville=' + Earlville.length); Earlville[Earlville.length] = createMarker(new GPoint(-88.91510010,41.59049988),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Earlville High School",'Earlville=' + Earlville.length); Grand_Ridge[Grand_Ridge.length] = createMarker(new GPoint(-88.83029938,41.23500061),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Grand Ridge Community Consolidated School",'Grand_Ridge=' + Grand_Ridge.length); Earlville[Earlville.length] = createMarker(new GPoint(-88.84621429,41.51496124),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Harding Grade School",'Earlville=' + Earlville.length); Ottawa[Ottawa.length] = createMarker(new GPoint(-88.84117889,41.35796738),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Jefferson Elementary School",'Ottawa=' + Ottawa.length); Streator[Streator.length] = createMarker(new GPoint(-88.82450104,41.12054062),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Kimes Elementary School",'Streator=' + Streator.length); La_Salle[La_Salle.length] = createMarker(new GPoint(-89.10472870,41.33227158),"",iconGr); mySelect.options[mySelect.options.length] = new Option("La Salle-peru Township High School",'La_Salle=' + La_Salle.length); Ottawa[Ottawa.length] = createMarker(new GPoint(-88.82909393,41.37346268),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Lasalle County Detention Home",'Ottawa=' + Ottawa.length); Lasalle[Lasalle.length] = createMarker(new GPoint(-89.09174347,41.33177948),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Lasalle-peru Area Career Center",'Lasalle=' + Lasalle.length); Leland[Leland.length] = createMarker(new GPoint(-88.79938507,41.61737823),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Leland Elementary School",'Leland=' + Leland.length); Leland[Leland.length] = createMarker(new GPoint(-88.79938507,41.61737823),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Leland High School",'Leland=' + Leland.length); Ottawa[Ottawa.length] = createMarker(new GPoint(-88.85554504,41.34656143),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Ottawa=' + Ottawa.length); Oglesby[Oglesby.length] = createMarker(new GPoint(-89.07064056,41.30632019),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Oglesby=' + Oglesby.length); Mendota[Mendota.length] = createMarker(new GPoint(-89.11301422,41.54898834),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Mendota=' + Mendota.length); La_Salle[La_Salle.length] = createMarker(new GPoint(-89.09648132,41.33955002),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Lincoln Junior High School",'La_Salle=' + La_Salle.length); Lostant[Lostant.length] = createMarker(new GPoint(-89.07669830,41.13970184),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Lostant Elementary School",'Lostant=' + Lostant.length); Marseilles[Marseilles.length] = createMarker(new GPoint(-88.69781494,41.32418060),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Marseilles Elementary School",'Marseilles=' + Marseilles.length); Ottawa[Ottawa.length] = createMarker(new GPoint(-88.83951569,41.32503510),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Mckinley Elementary School",'Ottawa=' + Ottawa.length); Mendota[Mendota.length] = createMarker(new GPoint(-89.12454224,41.55852127),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Mendota Township High School",'Mendota=' + Mendota.length); Marseilles[Marseilles.length] = createMarker(new GPoint(-88.70258331,41.32493973),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Milton Pope Elementary School",'Marseilles=' + Marseilles.length); Mendota[Mendota.length] = createMarker(new GPoint(-89.11848450,41.55995560),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Northbrook School",'Mendota=' + Mendota.length); Streator[Streator.length] = createMarker(new GPoint(-88.83381653,41.13555145),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Northlawn Junior High School",'Streator=' + Streator.length); Peru[Peru.length] = createMarker(new GPoint(-89.12454224,41.33860016),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Northview Elementary School",'Peru=' + Peru.length); La_Salle[La_Salle.length] = createMarker(new GPoint(-89.10168457,41.34654236),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Northwest Elementary School",'La_Salle=' + La_Salle.length); Streator[Streator.length] = createMarker(new GPoint(-88.82981873,41.11166000),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Oakland Park Elementary School",'Streator=' + Streator.length); Ottawa[Ottawa.length] = createMarker(new GPoint(-88.83932495,41.34566116),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Ottawa Township High School",'Ottawa=' + Ottawa.length); Streator[Streator.length] = createMarker(new GPoint(-88.83460236,41.12670135),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Otter Creek-hyatt Elementary School",'Streator=' + Streator.length); Peru[Peru.length] = createMarker(new GPoint(-89.12474060,41.33116150),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Peru Washington School",'Peru=' + Peru.length); Ottawa[Ottawa.length] = createMarker(new GPoint(-88.84230804,41.34666443),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Regional Safe School",'Ottawa=' + Ottawa.length); Peru[Peru.length] = createMarker(new GPoint(-89.13542938,41.32953644),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Roosevelt Elementary School",'Peru=' + Peru.length); Ottawa[Ottawa.length] = createMarker(new GPoint(-88.84213257,41.34576035),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Rutland Elementary School",'Ottawa=' + Ottawa.length); Seneca[Seneca.length] = createMarker(new GPoint(-88.60781860,41.30947876),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Seneca Elementary School South Campus",'Seneca=' + Seneca.length); Seneca[Seneca.length] = createMarker(new GPoint(-88.60781860,41.30947876),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Seneca Grade School",'Seneca=' + Seneca.length); Seneca[Seneca.length] = createMarker(new GPoint(-88.61840057,41.32109833),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Seneca High School",'Seneca=' + Seneca.length); Serena[Serena.length] = createMarker(new GPoint(-88.73194122,41.48699951),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Serena Elementary School",'Serena=' + Serena.length); Serena[Serena.length] = createMarker(new GPoint(-88.74040222,41.48649979),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Serena High School",'Serena=' + Serena.length); Ottawa[Ottawa.length] = createMarker(new GPoint(-88.82996368,41.32436371),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Shepherd Middle School",'Ottawa=' + Ottawa.length); Sheridan[Sheridan.length] = createMarker(new GPoint(-88.68013400,41.53079000),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Sheridan Correctional Center",'Sheridan=' + Sheridan.length); Sheridan[Sheridan.length] = createMarker(new GPoint(-88.67989349,41.52986145),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Sheridan Elementary School",'Sheridan=' + Sheridan.length); Streator[Streator.length] = createMarker(new GPoint(-88.81906128,41.12323761),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Sherman Elementary School",'Streator=' + Streator.length); Streator[Streator.length] = createMarker(new GPoint(-88.83857727,41.12623978),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Streator Township High School",'Streator=' + Streator.length); Tonica[Tonica.length] = createMarker(new GPoint(-89.05742645,41.22054291),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Tonica Grade School",'Tonica=' + Tonica.length); Utica[Utica.length] = createMarker(new GPoint(-89.00859833,41.36140060),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Utica Elementary School",'Utica=' + Utica.length); Ottawa[Ottawa.length] = createMarker(new GPoint(-88.88132477,41.41164017),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Wallace Elementary School",'Ottawa=' + Ottawa.length); Utica[Utica.length] = createMarker(new GPoint(-88.98239136,41.41106415),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Waltham Elementary School",'Utica=' + Utica.length); Oglesby[Oglesby.length] = createMarker(new GPoint(-89.06282043,41.29523849),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Washington Elementary School",'Oglesby=' + Oglesby.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(Earlville); map.removeOverlays(Grand_Ridge); map.removeOverlays(La_Salle); map.removeOverlays(Lasalle); map.removeOverlays(Leland); map.removeOverlays(Lostant); map.removeOverlays(Marseilles); map.removeOverlays(Mendota); map.removeOverlays(Oglesby); map.removeOverlays(Ottawa); map.removeOverlays(Peru); map.removeOverlays(Ransom); map.removeOverlays(Seneca); map.removeOverlays(Serena); map.removeOverlays(Sheridan); map.removeOverlays(Streator); map.removeOverlays(Tonica); map.removeOverlays(Utica); 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(Ransom);map.removeOverlays(Earlville); map.removeOverlays(Grand_Ridge); map.removeOverlays(La_Salle); map.removeOverlays(Lasalle); map.removeOverlays(Leland); map.removeOverlays(Lostant); map.removeOverlays(Marseilles); map.removeOverlays(Mendota); map.removeOverlays(Oglesby); map.removeOverlays(Ottawa); map.removeOverlays(Peru); map.removeOverlays(Ransom); map.removeOverlays(Seneca); map.removeOverlays(Serena); map.removeOverlays(Sheridan); map.removeOverlays(Streator); map.removeOverlays(Tonica); map.removeOverlays(Utica); map.addOverlays(Earlville); centerByArray(Earlville, false, false); cntMarker += Earlville.length; map.addOverlays(Grand_Ridge); centerByArray(Grand_Ridge, false, false); cntMarker += Grand_Ridge.length; map.addOverlays(La_Salle); centerByArray(La_Salle, false, false); cntMarker += La_Salle.length; map.addOverlays(Lasalle); centerByArray(Lasalle, false, false); cntMarker += Lasalle.length; map.addOverlays(Leland); centerByArray(Leland, false, false); cntMarker += Leland.length; map.addOverlays(Lostant); centerByArray(Lostant, false, false); cntMarker += Lostant.length; map.addOverlays(Marseilles); centerByArray(Marseilles, false, false); cntMarker += Marseilles.length; map.addOverlays(Mendota); centerByArray(Mendota, false, false); cntMarker += Mendota.length; map.addOverlays(Oglesby); centerByArray(Oglesby, false, false); cntMarker += Oglesby.length; map.addOverlays(Ottawa); centerByArray(Ottawa, false, false); cntMarker += Ottawa.length; map.addOverlays(Peru); centerByArray(Peru, false, false); cntMarker += Peru.length; map.addOverlays(Ransom); centerByArray(Ransom, false, false); cntMarker += Ransom.length; map.addOverlays(Seneca); centerByArray(Seneca, false, false); cntMarker += Seneca.length; map.addOverlays(Serena); centerByArray(Serena, false, false); cntMarker += Serena.length; map.addOverlays(Sheridan); centerByArray(Sheridan, false, false); cntMarker += Sheridan.length; map.addOverlays(Streator); centerByArray(Streator, false, false); cntMarker += Streator.length; map.addOverlays(Tonica); centerByArray(Tonica, false, false); cntMarker += Tonica.length; map.addOverlays(Utica); centerByArray(Utica, false, false); cntMarker += Utica.length; centerByArray(Ransom,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'); } }