function addMarkers() { mySelect = document.getElementById('selection'); Corvallis = [];Monroe = [];Alsea = [];Blodgett = [];Philomath = [];Albany = [];mySelect.options[mySelect.options.length] = new Option("Albany schools",'all=Albany'); mySelect.options[mySelect.options.length] = new Option("Alsea schools",'all=Alsea'); mySelect.options[mySelect.options.length] = new Option("Blodgett schools",'all=Blodgett'); mySelect.options[mySelect.options.length] = new Option("Corvallis schools",'all=Corvallis'); mySelect.options[mySelect.options.length] = new Option("Monroe schools",'all=Monroe'); mySelect.options[mySelect.options.length] = new Option("Philomath schools",'all=Philomath'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Corvallis[Corvallis.length] = createMarker(new GPoint(-123.28940582,44.55015945),"
Adams Elementary School
1615 Sw 35th St
Corvallis, OR 97333

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Adams Elementary School",'Corvallis=' + Corvallis.length); Monroe[Monroe.length] = createMarker(new GPoint(-123.36021423,44.32933807),"
Alpine Elementary School
25114 Alpine Rd
Monroe, OR 97456

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Alpine Elementary School",'Monroe=' + Monroe.length); Alsea[Alsea.length] = createMarker(new GPoint(-123.61260223,44.34949875),"
Alsea Elementary School
Po Box B
Alsea, OR 97324

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Alsea Elementary School",'Alsea=' + Alsea.length); Alsea[Alsea.length] = createMarker(new GPoint(-123.61260223,44.34949875),"
Alsea High School
Po Box B
Alsea, OR 97324

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Alsea High School",'Alsea=' + Alsea.length); Blodgett[Blodgett.length] = createMarker(new GPoint(-123.59329987,44.63410187),"
Blodgett Elementary School
Po Box 27
Blodgett, OR 97326

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Blodgett Elementary School",'Blodgett=' + Blodgett.length); Corvallis[Corvallis.length] = createMarker(new GPoint(-123.23539734,44.59981918),"
Cheldelin Middle School
987 Conifer Blvd Ne
Corvallis, OR 97330

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Cheldelin Middle School",'Corvallis=' + Corvallis.length); Philomath[Philomath.length] = createMarker(new GPoint(-123.35884857,44.53609467),"
Clemens Primary School
535 S 19th St
Philomath, OR 97370

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Clemens Primary School",'Philomath=' + Philomath.length); Corvallis[Corvallis.length] = createMarker(new GPoint(-123.26608276,44.57357788),"
Corvallis High School
1400 Nw Buchanan Ave
Corvallis, OR 97330

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Corvallis High School",'Corvallis=' + Corvallis.length); Corvallis[Corvallis.length] = createMarker(new GPoint(-123.26190948,44.61637115),"
Crescent Valley High School
4444 Nw Highland Dr
Corvallis, OR 97330

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Crescent Valley High School",'Corvallis=' + Corvallis.length); Corvallis[Corvallis.length] = createMarker(new GPoint(-123.22257996,44.59877777),"
Fairplay Elementary School
3855 Ne Hwy 20
Corvallis, OR 97330

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fairplay Elementary School",'Corvallis=' + Corvallis.length); Albany[Albany.length] = createMarker(new GPoint(-123.14510345,44.68913651),"
Fir Grove Primary School
5355 Scenic Dr Nw
Albany, OR 97321

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fir Grove Primary School",'Albany=' + Albany.length); Corvallis[Corvallis.length] = createMarker(new GPoint(-123.27307892,44.57434845),"
Franklin School
750 Nw 18th St
Corvallis, OR 97330

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Franklin School",'Corvallis=' + Corvallis.length); Corvallis[Corvallis.length] = createMarker(new GPoint(-123.26514435,44.58323669),"
Garfield Elementary School
1205 Nw Garfield Ave
Corvallis, OR 97330

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Garfield Elementary School",'Corvallis=' + Corvallis.length); Corvallis[Corvallis.length] = createMarker(new GPoint(-123.28599548,44.57291412),"
Harding Elementary School
510 Nw 31st St
Corvallis, OR 97330

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Harding Elementary School",'Corvallis=' + Corvallis.length); Corvallis[Corvallis.length] = createMarker(new GPoint(-123.26230621,44.58628464),"
Highland View Middle School
1920 Nw Highland Dr
Corvallis, OR 97330

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Highland View Middle School",'Corvallis=' + Corvallis.length); Corvallis[Corvallis.length] = createMarker(new GPoint(-123.29380035,44.59306335),"
Hoover Elementary School
3838 Nw Walnut Blvd
Corvallis, OR 97330

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hoover Elementary School",'Corvallis=' + Corvallis.length); Corvallis[Corvallis.length] = createMarker(new GPoint(-123.33700562,44.45947266),"
Inavale School
30252 Sw Bellfountain Rd
Corvallis, OR 97333

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Inavale School",'Corvallis=' + Corvallis.length); Corvallis[Corvallis.length] = createMarker(new GPoint(-123.28090668,44.58562088),"
Jefferson Elementary School
1825 Nw 27th St
Corvallis, OR 97330

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jefferson Elementary School",'Corvallis=' + Corvallis.length); Philomath[Philomath.length] = createMarker(new GPoint(-123.43287659,44.69259262),"
Kings Valley Charter School
38840 Kings Valley Hwy
Philomath, OR 97370

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Kings Valley Charter School",'Philomath=' + Philomath.length); Corvallis[Corvallis.length] = createMarker(new GPoint(-123.26565552,44.54506302),"
Lincoln Elementary School
110 Se Alexander Ave
Corvallis, OR 97333

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Corvallis=' + Corvallis.length); Monroe[Monroe.length] = createMarker(new GPoint(-123.29733276,44.31191254),"
Monroe Grade School
600 Dragon Dr
Monroe, OR 97456

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Monroe Grade School",'Monroe=' + Monroe.length); Monroe[Monroe.length] = createMarker(new GPoint(-123.29792786,44.31856155),"
Monroe High School
365 N Fifth St
Monroe, OR 97456

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Monroe High School",'Monroe=' + Monroe.length); Corvallis[Corvallis.length] = createMarker(new GPoint(-123.23792267,44.62894058),"
Mt View Elementary School
340 Ne Granger Ave
Corvallis, OR 97330

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mt View Elementary School",'Corvallis=' + Corvallis.length); Albany[Albany.length] = createMarker(new GPoint(-123.11000061,44.65174103),"
North Albany Elementary School
815 Thornton Lake Dr Nw
Albany, OR 97321

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Albany Elementary School",'Albany=' + Albany.length); Albany[Albany.length] = createMarker(new GPoint(-123.11620331,44.65205765),"
North Albany Middle School
1205 North Albany Rd Nw
Albany, OR 97321

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("North Albany Middle School",'Albany=' + Albany.length); Albany[Albany.length] = createMarker(new GPoint(-123.14299011,44.65766525),"
Oak Grove Intermediate
1500 Oak Grove Dr Nw
Albany, OR 97321

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Oak Grove Intermediate",'Albany=' + Albany.length); Philomath[Philomath.length] = createMarker(new GPoint(-123.36322021,44.53859329),"
Philomath Elementary School
239 S 16th St
Philomath, OR 97370

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Philomath Elementary School",'Philomath=' + Philomath.length); Philomath[Philomath.length] = createMarker(new GPoint(-123.35668945,44.53898239),"
Philomath High School
2054 Applegate St
Philomath, OR 97370

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Philomath High School",'Philomath=' + Philomath.length); Philomath[Philomath.length] = createMarker(new GPoint(-123.35678864,44.53253555),"
Philomath Middle School
2021 Chapel Dr
Philomath, OR 97370

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Philomath Middle School",'Philomath=' + Philomath.length); Corvallis[Corvallis.length] = createMarker(new GPoint(-123.26630402,44.56829834),"
Riverside High School
330 Nw 9th St
Corvallis, OR 97330

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Riverside High School",'Corvallis=' + Corvallis.length); Corvallis[Corvallis.length] = createMarker(new GPoint(-123.28940582,44.55221176),"
Westland Middle School
1111 Nw Cleveland Ave
Corvallis, OR 97330

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Westland Middle School",'Corvallis=' + Corvallis.length); Corvallis[Corvallis.length] = createMarker(new GPoint(-123.31340027,44.45920181),"
Willamette Valley Community School
Po Box 866
Corvallis, OR 97339

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Willamette Valley Community School",'Corvallis=' + Corvallis.length); Corvallis[Corvallis.length] = createMarker(new GPoint(-123.25720978,44.59468842),"
Wilson Elementary School
2701 Nw Satinwood
Corvallis, OR 97330

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wilson Elementary School",'Corvallis=' + Corvallis.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(Albany); map.removeOverlays(Alsea); map.removeOverlays(Blodgett); map.removeOverlays(Corvallis); map.removeOverlays(Monroe); map.removeOverlays(Philomath); 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(Corvallis);map.removeOverlays(Albany); map.removeOverlays(Alsea); map.removeOverlays(Blodgett); map.removeOverlays(Corvallis); map.removeOverlays(Monroe); map.removeOverlays(Philomath); map.addOverlays(Albany); centerByArray(Albany, false, false); cntMarker += Albany.length; map.addOverlays(Alsea); centerByArray(Alsea, false, false); cntMarker += Alsea.length; map.addOverlays(Blodgett); centerByArray(Blodgett, false, false); cntMarker += Blodgett.length; map.addOverlays(Corvallis); centerByArray(Corvallis, false, false); cntMarker += Corvallis.length; map.addOverlays(Monroe); centerByArray(Monroe, false, false); cntMarker += Monroe.length; map.addOverlays(Philomath); centerByArray(Philomath, false, false); cntMarker += Philomath.length; centerByArray(Corvallis,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'); } }