function addMarkers() { mySelect = document.getElementById('selection'); Bend = [];Brothers = [];Redmond = [];Lapine = [];Sisters = [];Terrebonne = [];Sunriver = [];mySelect.options[mySelect.options.length] = new Option("Bend schools",'all=Bend'); mySelect.options[mySelect.options.length] = new Option("Brothers schools",'all=Brothers'); mySelect.options[mySelect.options.length] = new Option("Lapine schools",'all=Lapine'); mySelect.options[mySelect.options.length] = new Option("Redmond schools",'all=Redmond'); mySelect.options[mySelect.options.length] = new Option("Sisters schools",'all=Sisters'); mySelect.options[mySelect.options.length] = new Option("Sunriver schools",'all=Sunriver'); mySelect.options[mySelect.options.length] = new Option("Terrebonne schools",'all=Terrebonne'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Bend[Bend.length] = createMarker(new GPoint(-121.31788635,44.05525970),"
Amity Creek Elementary School
437 Nw Wall St
Bend, OR 97701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Amity Creek Elementary School",'Bend=' + Bend.length); Bend[Bend.length] = createMarker(new GPoint(-121.28749084,44.05114746),"
Bear Creek Elementary School
51 Se 13th St
Bend, OR 97702

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bear Creek Elementary School",'Bend=' + Bend.length); Bend[Bend.length] = createMarker(new GPoint(-121.29700470,44.05262756),"
Bend Senior High School
230 Ne 6th St
Bend, OR 97701

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bend Senior High School",'Bend=' + Bend.length); Brothers[Brothers.length] = createMarker(new GPoint(-120.60159302,43.81332016),"
Brothers Elementary School
Po Box 130
Brothers, OR 97712

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Brothers Elementary School",'Brothers=' + Brothers.length); Bend[Bend.length] = createMarker(new GPoint(-121.24380493,44.07022858),"
Buckingham Elementary School
62560 Hamby Rd
Bend, OR 97701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Buckingham Elementary School",'Bend=' + Bend.length); Redmond[Redmond.length] = createMarker(new GPoint(-121.20200348,44.27180099),"
Cascade Child Treatment Center
Po Box 549
Redmond, OR 97756

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cascade Child Treatment Center",'Redmond=' + Redmond.length); Bend[Bend.length] = createMarker(new GPoint(-121.33966827,44.03776932),"
Cascade Middle School
19619 Mountaineer Wy
Bend, OR 97702

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Cascade Middle School",'Bend=' + Bend.length); Redmond[Redmond.length] = createMarker(new GPoint(-121.17690277,44.27636337),"
Edwin Brown High School
850 Sw Antler Ave
Redmond, OR 97756

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Edwin Brown High School",'Redmond=' + Redmond.length); Bend[Bend.length] = createMarker(new GPoint(-121.34584808,44.01349258),"
Elk Meadow Elementary School
60880 Brookswood Blvd
Bend, OR 97702

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Elk Meadow Elementary School",'Bend=' + Bend.length); Bend[Bend.length] = createMarker(new GPoint(-121.41612244,43.90103912),"
Ensworth Elementary School
2150 Ne Daggett Ln
Bend, OR 97701

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ensworth Elementary School",'Bend=' + Bend.length); Redmond[Redmond.length] = createMarker(new GPoint(-121.17758942,44.27319336),"
Evergreen Elementary School
437 S 9th St
Redmond, OR 97756

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Evergreen Elementary School",'Redmond=' + Redmond.length); Bend[Bend.length] = createMarker(new GPoint(-121.25922394,44.01535034),"
High Desert Middle School
61111 27th St
Bend, OR 97702

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("High Desert Middle School",'Bend=' + Bend.length); Bend[Bend.length] = createMarker(new GPoint(-121.35168457,44.06063843),"
High Lakes Elementary School
2500 Nw High Lakes Lp
Bend, OR 97701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("High Lakes Elementary School",'Bend=' + Bend.length); Bend[Bend.length] = createMarker(new GPoint(-121.32209778,44.06226349),"
Highland School At Kenwood Elementary School
701 Nw Newport Ave
Bend, OR 97701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Highland School At Kenwood Elementary School",'Bend=' + Bend.length); Redmond[Redmond.length] = createMarker(new GPoint(-121.19181824,44.27653885),"
Hugh Hartman Middle School
2105 W Antler
Redmond, OR 97756

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Hugh Hartman Middle School",'Redmond=' + Redmond.length); Redmond[Redmond.length] = createMarker(new GPoint(-121.17868805,44.27759552),"
John Tuck Elementary School
209 Nw 10th St
Redmond, OR 97756

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("John Tuck Elementary School",'Redmond=' + Redmond.length); Bend[Bend.length] = createMarker(new GPoint(-121.28924561,44.06403732),"
Juniper Elementary School
1300 Ne Norton St
Bend, OR 97701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Juniper Elementary School",'Bend=' + Bend.length); Bend[Bend.length] = createMarker(new GPoint(-121.32898712,44.06014252),"
Kingston Elementary School
1101 Nw 12th St
Bend, OR 97701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Kingston Elementary School",'Bend=' + Bend.length); Lapine[Lapine.length] = createMarker(new GPoint(-121.50569153,43.67514420),"
Lapine Elementary School
51615 Coach Rd
Lapine, OR 97739

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lapine Elementary School",'Lapine=' + Lapine.length); Lapine[Lapine.length] = createMarker(new GPoint(-121.46520233,43.73360062),"
Lapine Middle School
Po Box 305
Lapine, OR 97739

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Lapine Middle School",'Lapine=' + Lapine.length); Lapine[Lapine.length] = createMarker(new GPoint(-121.46520233,43.73360062),"
Lapine Senior High School
Po Box 306
Lapine, OR 97739

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lapine Senior High School",'Lapine=' + Lapine.length); Bend[Bend.length] = createMarker(new GPoint(-121.28158569,44.10896301),"
Lava Ridge Elementary School
20805 Cooley Rd
Bend, OR 97701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lava Ridge Elementary School",'Bend=' + Bend.length); Redmond[Redmond.length] = createMarker(new GPoint(-121.18218994,44.26646423),"
M A Lynch Elementary School
1314 Sw Kalama Ave
Redmond, OR 97756

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("M A Lynch Elementary School",'Redmond=' + Redmond.length); Bend[Bend.length] = createMarker(new GPoint(-121.29918671,44.06270218),"
Marshall High School
1291 Ne 5th
Bend, OR 97701

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Marshall High School",'Bend=' + Bend.length); Bend[Bend.length] = createMarker(new GPoint(-121.26399231,44.07834625),"
Mountain View Senior High School
2755 Ne 27th St
Bend, OR 97701

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mountain View Senior High School",'Bend=' + Bend.length); Redmond[Redmond.length] = createMarker(new GPoint(-121.18226624,44.26233673),"
Obsidian Middle School
1335 Sw Obsidian Ave
Redmond, OR 97756

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Obsidian Middle School",'Redmond=' + Redmond.length); Bend[Bend.length] = createMarker(new GPoint(-121.28189087,44.06566238),"
Pilot Butte Middle School
1501 Ne Neff St
Bend, OR 97701

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Pilot Butte Middle School",'Bend=' + Bend.length); Bend[Bend.length] = createMarker(new GPoint(-121.41535950,43.90208054),"
Pine Ridge Elementary School
19840 Hollygrape St
Bend, OR 97702

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pine Ridge Elementary School",'Bend=' + Bend.length); Bend[Bend.length] = createMarker(new GPoint(-121.29642487,44.01903534),"
R E Jewell Elementary School
20550 Murphy Rd
Bend, OR 97702

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("R E Jewell Elementary School",'Bend=' + Bend.length); Redmond[Redmond.length] = createMarker(new GPoint(-121.19055176,44.27077866),"
Redmond High School
675 Sw Rimrock Dr
Redmond, OR 97756

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Redmond High School",'Redmond=' + Redmond.length); Bend[Bend.length] = createMarker(new GPoint(-121.28189087,44.06566238),"
Rimrock Academy
2072 Nw Glassow
Bend, OR 97701

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Rimrock Academy",'Bend=' + Bend.length); Sisters[Sisters.length] = createMarker(new GPoint(-121.61450195,44.28250122),"
Sisters Elementary School
611 E Cascade
Sisters, OR 97759

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sisters Elementary School",'Sisters=' + Sisters.length); Sisters[Sisters.length] = createMarker(new GPoint(-121.61450195,44.28250122),"
Sisters High School
1700 W Mckinney Butte Rd
Sisters, OR 97759

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sisters High School",'Sisters=' + Sisters.length); Sisters[Sisters.length] = createMarker(new GPoint(-121.61450195,44.28250122),"
Sisters Middle School
15200 Mckenzie Hwy
Sisters, OR 97759

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Sisters Middle School",'Sisters=' + Sisters.length); Bend[Bend.length] = createMarker(new GPoint(-121.27909088,44.10695648),"
Sky View Middle School
63555 Ne 18th St
Bend, OR 97701

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Sky View Middle School",'Bend=' + Bend.length); Bend[Bend.length] = createMarker(new GPoint(-121.35978699,44.05776215),"
Summit High School
2855 Nw Clearwater Dr
Bend, OR 97701

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Summit High School",'Bend=' + Bend.length); Terrebonne[Terrebonne.length] = createMarker(new GPoint(-121.18124390,44.35143661),"
Terrebonne Elementary School
1199 B Ave
Terrebonne, OR 97760

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Terrebonne Elementary School",'Terrebonne=' + Terrebonne.length); Sunriver[Sunriver.length] = createMarker(new GPoint(-121.43151093,43.86577606),"
Three Rivers Elementary School
56900 Enterprise Dr
Sunriver, OR 97707

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Three Rivers Elementary School",'Sunriver=' + Sunriver.length); Bend[Bend.length] = createMarker(new GPoint(-121.33230591,44.15156174),"
Tumalo Elementary School
19835 2nd St
Bend, OR 97701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Tumalo Elementary School",'Bend=' + Bend.length); Redmond[Redmond.length] = createMarker(new GPoint(-121.20328522,44.26213837),"
Vern Patrick Elementary School
3001 Sw Obsidian
Redmond, OR 97756

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Vern Patrick Elementary School",'Redmond=' + Redmond.length); Bend[Bend.length] = createMarker(new GPoint(-121.32898712,44.06014252),"
Westside Village Magnet School At Kingston Elementary School
1101 Nw 12th St
Bend, OR 97701

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Westside Village Magnet School At Kingston Elementary School",'Bend=' + Bend.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(Bend); map.removeOverlays(Brothers); map.removeOverlays(Lapine); map.removeOverlays(Redmond); map.removeOverlays(Sisters); map.removeOverlays(Sunriver); map.removeOverlays(Terrebonne); 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(Bend);map.removeOverlays(Bend); map.removeOverlays(Brothers); map.removeOverlays(Lapine); map.removeOverlays(Redmond); map.removeOverlays(Sisters); map.removeOverlays(Sunriver); map.removeOverlays(Terrebonne); map.addOverlays(Bend); centerByArray(Bend, false, false); cntMarker += Bend.length; map.addOverlays(Brothers); centerByArray(Brothers, false, false); cntMarker += Brothers.length; map.addOverlays(Lapine); centerByArray(Lapine, false, false); cntMarker += Lapine.length; map.addOverlays(Redmond); centerByArray(Redmond, false, false); cntMarker += Redmond.length; map.addOverlays(Sisters); centerByArray(Sisters, false, false); cntMarker += Sisters.length; map.addOverlays(Sunriver); centerByArray(Sunriver, false, false); cntMarker += Sunriver.length; map.addOverlays(Terrebonne); centerByArray(Terrebonne, false, false); cntMarker += Terrebonne.length; centerByArray(Bend,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'); } }