function addMarkers() { mySelect = document.getElementById('selection'); Polo = [];Mt_Morris = [];Byron = [];Rochelle = [];Chana = [];Creston = [];Mount_Morris = [];Lindenwood = [];Oregon = [];Forreston = [];Stillman_Valley = [];Kings = [];Leaf_River = [];Monroe_Center = [];mySelect.options[mySelect.options.length] = new Option("Byron schools",'all=Byron'); mySelect.options[mySelect.options.length] = new Option("Chana schools",'all=Chana'); mySelect.options[mySelect.options.length] = new Option("Creston schools",'all=Creston'); mySelect.options[mySelect.options.length] = new Option("Forreston schools",'all=Forreston'); mySelect.options[mySelect.options.length] = new Option("Kings schools",'all=Kings'); mySelect.options[mySelect.options.length] = new Option("Leaf River schools",'all=Leaf_River'); mySelect.options[mySelect.options.length] = new Option("Lindenwood schools",'all=Lindenwood'); mySelect.options[mySelect.options.length] = new Option("Monroe Center schools",'all=Monroe_Center'); mySelect.options[mySelect.options.length] = new Option("Mount Morris schools",'all=Mount_Morris'); mySelect.options[mySelect.options.length] = new Option("Mt Morris schools",'all=Mt_Morris'); mySelect.options[mySelect.options.length] = new Option("Oregon schools",'all=Oregon'); mySelect.options[mySelect.options.length] = new Option("Polo schools",'all=Polo'); mySelect.options[mySelect.options.length] = new Option("Rochelle schools",'all=Rochelle'); mySelect.options[mySelect.options.length] = new Option("Stillman Valley schools",'all=Stillman_Valley'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Polo[Polo.length] = createMarker(new GPoint(-89.57875400,41.98789500),"
Aplington Middle School
610 E Mason
Polo, IL 61064

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Aplington Middle School",'Polo=' + Polo.length); Mt_Morris[Mt_Morris.length] = createMarker(new GPoint(-89.43489838,42.04486465),"
Black Hawk Junior High School
105 W Brayton Rd
Mt Morris, IL 61054

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Black Hawk Junior High School",'Mt_Morris=' + Mt_Morris.length); Byron[Byron.length] = createMarker(new GPoint(-89.26750183,42.12900162),"
Byron High School 9-12
696 N Colfax St
Byron, IL 61010

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Byron High School 9-12",'Byron=' + Byron.length); Byron[Byron.length] = createMarker(new GPoint(-89.26750183,42.12900162),"
Byron Middle School
325 N Colfax St
Byron, IL 61010

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Byron Middle School",'Byron=' + Byron.length); Polo[Polo.length] = createMarker(new GPoint(-89.57231140,41.98390198),"
Centennial Elementary School
308 S Pleasant
Polo, IL 61064

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Centennial Elementary School",'Polo=' + Polo.length); Rochelle[Rochelle.length] = createMarker(new GPoint(-89.07018280,41.92320633),"
Central Elementary School
444 N 8th St
Rochelle, IL 61068

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Central Elementary School",'Rochelle=' + Rochelle.length); Chana[Chana.length] = createMarker(new GPoint(-89.22168732,41.98136139),"
Chana Educ Center/rock River
200 Main St
Chana, IL 61015

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Chana Educ Center/rock River",'Chana=' + Chana.length); Creston[Creston.length] = createMarker(new GPoint(-88.96440125,41.93080139),"
Creston Elementary School
Po Box 37
Creston, IL 60113

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Creston Elementary School",'Creston=' + Creston.length); Mount_Morris[Mount_Morris.length] = createMarker(new GPoint(-89.43901062,42.04476166),"
David L Rahn Elementary School
401 S Fletcher St
Mount Morris, IL 61054

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("David L Rahn Elementary School",'Mount_Morris=' + Mount_Morris.length); Lindenwood[Lindenwood.length] = createMarker(new GPoint(-89.02320099,42.04090118),"
Eswood C C Grade School
304 N Main
Lindenwood, IL 61049

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Eswood C C Grade School",'Lindenwood=' + Lindenwood.length); Oregon[Oregon.length] = createMarker(new GPoint(-89.34326172,42.01362610),"
Etnyre School
1200 Jefferson St
Oregon, IL 61061

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Etnyre School",'Oregon=' + Oregon.length); Forreston[Forreston.length] = createMarker(new GPoint(-89.57917786,42.12620926),"
Forreston Grade School
Po B0x 665
Forreston, IL 61030

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Forreston Grade School",'Forreston=' + Forreston.length); Forreston[Forreston.length] = createMarker(new GPoint(-89.58399963,42.11719894),"
Forreston High School
Po Box 665
Forreston, IL 61030

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Forreston High School",'Forreston=' + Forreston.length); Forreston[Forreston.length] = createMarker(new GPoint(-89.57917786,42.12620926),"
Forreston Middle School
Po B0x 665
Forreston, IL 61030

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Forreston Middle School",'Forreston=' + Forreston.length); Stillman_Valley[Stillman_Valley.length] = createMarker(new GPoint(-89.18218231,42.10318756),"
Highland Elementary School
410 S Hickory St
Stillman Valley, IL 61084

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Highland Elementary School",'Stillman_Valley=' + Stillman_Valley.length); Oregon[Oregon.length] = createMarker(new GPoint(-89.34067535,42.01354218),"
Jefferson Elementary School
1100 Jefferson St
Oregon, IL 61061

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jefferson Elementary School",'Oregon=' + Oregon.length); Kings[Kings.length] = createMarker(new GPoint(-89.10458374,42.00233841),"
Kings Elementary School
100 1st St
Kings, IL 61068

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Kings Elementary School",'Kings=' + Kings.length); Leaf_River[Leaf_River.length] = createMarker(new GPoint(-89.40779877,42.14260101),"
Leaf River Grade School
Po Box 276
Leaf River, IL 61047

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Leaf River Grade School",'Leaf_River=' + Leaf_River.length); Rochelle[Rochelle.length] = createMarker(new GPoint(-89.06507111,41.91934967),"
Lincoln Elementary School
108 S Main St
Rochelle, IL 61068

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Rochelle=' + Rochelle.length); Byron[Byron.length] = createMarker(new GPoint(-89.26750183,42.12900162),"
Mary Morgan Elementary School
420 North Colfax St
Byron, IL 61010

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mary Morgan Elementary School",'Byron=' + Byron.length); Byron[Byron.length] = createMarker(new GPoint(-89.26750183,42.12900162),"
Mary Morgan Primary School
Po Box 1012
Byron, IL 61010

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mary Morgan Primary School",'Byron=' + Byron.length); Rochelle[Rochelle.length] = createMarker(new GPoint(-89.06288147,41.93088531),"
May Elementary School
1033 N 2nd St
Rochelle, IL 61068

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("May Elementary School",'Rochelle=' + Rochelle.length); Stillman_Valley[Stillman_Valley.length] = createMarker(new GPoint(-89.18113708,42.10813522),"
Meridian Junior High School
207 W Main St
Stillman Valley, IL 61084

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Meridian Junior High School",'Stillman_Valley=' + Stillman_Valley.length); Monroe_Center[Monroe_Center.length] = createMarker(new GPoint(-89.00720215,42.10269928),"
Monroe Center Grade School
Po Box 360
Monroe Center, IL 61052

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Monroe Center Grade School",'Monroe_Center=' + Monroe_Center.length); Oregon[Oregon.length] = createMarker(new GPoint(-89.34070587,42.01317596),"
Oregon High School
210 S 10th St
Oregon, IL 61061

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oregon High School",'Oregon=' + Oregon.length); Polo[Polo.length] = createMarker(new GPoint(-89.56918335,41.98586273),"
Polo Community High School
100 S Union Ave
Polo, IL 61064

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Polo Community High School",'Polo=' + Polo.length); Rochelle[Rochelle.length] = createMarker(new GPoint(-89.02308655,41.84690857),"
Rochelle Middle School
111 E School Ave
Rochelle, IL 61068

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Rochelle Middle School",'Rochelle=' + Rochelle.length); Rochelle[Rochelle.length] = createMarker(new GPoint(-89.06816864,41.93217087),"
Rochelle Township High School
1401 Flagg Rd
Rochelle, IL 61068

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Rochelle Township High School",'Rochelle=' + Rochelle.length); Chana[Chana.length] = createMarker(new GPoint(-89.20950317,41.99190140),"
Rock River Challenge
Po Box 91
Chana, IL 61015

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Rock River Challenge",'Chana=' + Chana.length); Stillman_Valley[Stillman_Valley.length] = createMarker(new GPoint(-89.18041229,42.10317993),"
Stillman Valley High School
425 S Pine St
Stillman Valley, IL 61084

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Stillman Valley High School",'Stillman_Valley=' + Stillman_Valley.length); Rochelle[Rochelle.length] = createMarker(new GPoint(-89.07147980,41.93090820),"
Tilton Elementary School
1050 N 9th St
Rochelle, IL 61068

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Tilton Elementary School",'Rochelle=' + Rochelle.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(Byron); map.removeOverlays(Chana); map.removeOverlays(Creston); map.removeOverlays(Forreston); map.removeOverlays(Kings); map.removeOverlays(Leaf_River); map.removeOverlays(Lindenwood); map.removeOverlays(Monroe_Center); map.removeOverlays(Mount_Morris); map.removeOverlays(Mt_Morris); map.removeOverlays(Oregon); map.removeOverlays(Polo); map.removeOverlays(Rochelle); map.removeOverlays(Stillman_Valley); 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(Polo);map.removeOverlays(Byron); map.removeOverlays(Chana); map.removeOverlays(Creston); map.removeOverlays(Forreston); map.removeOverlays(Kings); map.removeOverlays(Leaf_River); map.removeOverlays(Lindenwood); map.removeOverlays(Monroe_Center); map.removeOverlays(Mount_Morris); map.removeOverlays(Mt_Morris); map.removeOverlays(Oregon); map.removeOverlays(Polo); map.removeOverlays(Rochelle); map.removeOverlays(Stillman_Valley); map.addOverlays(Byron); centerByArray(Byron, false, false); cntMarker += Byron.length; map.addOverlays(Chana); centerByArray(Chana, false, false); cntMarker += Chana.length; map.addOverlays(Creston); centerByArray(Creston, false, false); cntMarker += Creston.length; map.addOverlays(Forreston); centerByArray(Forreston, false, false); cntMarker += Forreston.length; map.addOverlays(Kings); centerByArray(Kings, false, false); cntMarker += Kings.length; map.addOverlays(Leaf_River); centerByArray(Leaf_River, false, false); cntMarker += Leaf_River.length; map.addOverlays(Lindenwood); centerByArray(Lindenwood, false, false); cntMarker += Lindenwood.length; map.addOverlays(Monroe_Center); centerByArray(Monroe_Center, false, false); cntMarker += Monroe_Center.length; map.addOverlays(Mount_Morris); centerByArray(Mount_Morris, false, false); cntMarker += Mount_Morris.length; map.addOverlays(Mt_Morris); centerByArray(Mt_Morris, false, false); cntMarker += Mt_Morris.length; map.addOverlays(Oregon); centerByArray(Oregon, false, false); cntMarker += Oregon.length; map.addOverlays(Polo); centerByArray(Polo, false, false); cntMarker += Polo.length; map.addOverlays(Rochelle); centerByArray(Rochelle, false, false); cntMarker += Rochelle.length; map.addOverlays(Stillman_Valley); centerByArray(Stillman_Valley, false, false); cntMarker += Stillman_Valley.length; centerByArray(Polo,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'); } }