function addMarkers() { mySelect = document.getElementById('selection'); Klamath_Falls = [];Bonanza = [];Chiloquin = [];Bly = [];Gilchrist = [];Keno = [];Merrill = [];Malin = [];mySelect.options[mySelect.options.length] = new Option("Bly schools",'all=Bly'); mySelect.options[mySelect.options.length] = new Option("Bonanza schools",'all=Bonanza'); mySelect.options[mySelect.options.length] = new Option("Chiloquin schools",'all=Chiloquin'); mySelect.options[mySelect.options.length] = new Option("Gilchrist schools",'all=Gilchrist'); mySelect.options[mySelect.options.length] = new Option("Keno schools",'all=Keno'); mySelect.options[mySelect.options.length] = new Option("Klamath Falls schools",'all=Klamath_Falls'); mySelect.options[mySelect.options.length] = new Option("Malin schools",'all=Malin'); mySelect.options[mySelect.options.length] = new Option("Merrill schools",'all=Merrill'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Klamath_Falls[Klamath_Falls.length] = createMarker(new GPoint(-121.73798370,42.20528030),"
Altamont Elementary School
2450 Summers Ln
Klamath Falls, OR 97603

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Altamont Elementary School",'Klamath_Falls=' + Klamath_Falls.length); Bonanza[Bonanza.length] = createMarker(new GPoint(-121.40589400,42.19873000),"
Bonanza Junior/senior High School
Po Box 128
Bonanza, OR 97623

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bonanza Junior/senior High School",'Bonanza=' + Bonanza.length); Bonanza[Bonanza.length] = createMarker(new GPoint(-121.20169830,42.31399918),"
Bonanza School
Po Box 128
Bonanza, OR 97623

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bonanza School",'Bonanza=' + Bonanza.length); Klamath_Falls[Klamath_Falls.length] = createMarker(new GPoint(-121.72288513,42.18324280),"
Brixner Junior High School
4727 Homedale Rd
Klamath Falls, OR 97603

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Brixner Junior High School",'Klamath_Falls=' + Klamath_Falls.length); Chiloquin[Chiloquin.length] = createMarker(new GPoint(-121.57900238,42.67539978),"
Chiloquin Elementary School
Po Box 375
Chiloquin, OR 97624

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Chiloquin Elementary School",'Chiloquin=' + Chiloquin.length); Chiloquin[Chiloquin.length] = createMarker(new GPoint(-121.57900238,42.67539978),"
Chiloquin High School
Po Box 397
Chiloquin, OR 97624

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Chiloquin High School",'Chiloquin=' + Chiloquin.length); Klamath_Falls[Klamath_Falls.length] = createMarker(new GPoint(-121.82310486,42.18211746),"
Fairhaven Elementary School
5400 Hwy 66
Klamath Falls, OR 97601

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fairhaven Elementary School",'Klamath_Falls=' + Klamath_Falls.length); Klamath_Falls[Klamath_Falls.length] = createMarker(new GPoint(-121.78591156,42.23306274),"
Fairview Elementary School
1017 Donald St
Klamath Falls, OR 97601

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fairview Elementary School",'Klamath_Falls=' + Klamath_Falls.length); Klamath_Falls[Klamath_Falls.length] = createMarker(new GPoint(-121.72251129,42.19995880),"
Ferguson Elementary School
2901 Homedale Rd
Klamath Falls, OR 97603

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ferguson Elementary School",'Klamath_Falls=' + Klamath_Falls.length); Bly[Bly.length] = createMarker(new GPoint(-121.04329681,42.39849854),"
Gearhart Elementary School
Po Box 47
Bly, OR 97622

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Gearhart Elementary School",'Bly=' + Bly.length); Gilchrist[Gilchrist.length] = createMarker(new GPoint(-121.58809900,43.56732500),"
Gilchrist Junior/senior High School
Po Box 668
Gilchrist, OR 97737

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Gilchrist Junior/senior High School",'Gilchrist=' + Gilchrist.length); Gilchrist[Gilchrist.length] = createMarker(new GPoint(-121.58450317,43.36230087),"
Gilchrist School
Po Box 668
Gilchrist, OR 97737

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Gilchrist School",'Gilchrist=' + Gilchrist.length); Klamath_Falls[Klamath_Falls.length] = createMarker(new GPoint(-121.69801331,42.15101242),"
Henley Elementary School
8205 Hwy 39
Klamath Falls, OR 97603

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Henley Elementary School",'Klamath_Falls=' + Klamath_Falls.length); Klamath_Falls[Klamath_Falls.length] = createMarker(new GPoint(-121.69801331,42.15052414),"
Henley High School
8245 Hwy 39
Klamath Falls, OR 97603

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Henley High School",'Klamath_Falls=' + Klamath_Falls.length); Klamath_Falls[Klamath_Falls.length] = createMarker(new GPoint(-121.69801331,42.15454483),"
Henley Middle School
7925 Hwy 39
Klamath Falls, OR 97603

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Henley Middle School",'Klamath_Falls=' + Klamath_Falls.length); Klamath_Falls[Klamath_Falls.length] = createMarker(new GPoint(-121.79473114,42.23439026),"
Joseph Conger Elementary School
1700 California
Klamath Falls, OR 97601

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Joseph Conger Elementary School",'Klamath_Falls=' + Klamath_Falls.length); Keno[Keno.length] = createMarker(new GPoint(-121.95829773,42.10720062),"
Keno Elementary School
Po Box 180
Keno, OR 97627

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Keno Elementary School",'Keno=' + Keno.length); Klamath_Falls[Klamath_Falls.length] = createMarker(new GPoint(-121.77864838,42.23118210),"
Klamath Union High School
1300 Monclaire St
Klamath Falls, OR 97601

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Klamath Union High School",'Klamath_Falls=' + Klamath_Falls.length); Klamath_Falls[Klamath_Falls.length] = createMarker(new GPoint(-121.75248718,42.21733856),"
Klamath Youth Develpment Center
1336 Avalon
Klamath Falls, OR 97603

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Klamath Youth Develpment Center",'Klamath_Falls=' + Klamath_Falls.length); Merrill[Merrill.length] = createMarker(new GPoint(-121.56681061,42.02406311),"
Lost River High School
23330 Hwy 50
Merrill, OR 97633

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lost River High School",'Merrill=' + Merrill.length); Malin[Malin.length] = createMarker(new GPoint(-121.42870331,42.02429962),"
Malin Elementary School
Po Box 25
Malin, OR 97632

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Malin Elementary School",'Malin=' + Malin.length); Klamath_Falls[Klamath_Falls.length] = createMarker(new GPoint(-121.73751068,42.19899368),"
Mazama High School
3009 Summers Ln
Klamath Falls, OR 97603

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mazama High School",'Klamath_Falls=' + Klamath_Falls.length); Merrill[Merrill.length] = createMarker(new GPoint(-121.58820343,42.04629898),"
Merrill Elementary School
Po Box 468
Merrill, OR 97633

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Merrill Elementary School",'Merrill=' + Merrill.length); Klamath_Falls[Klamath_Falls.length] = createMarker(new GPoint(-121.76509857,42.21834183),"
Mills Elementary School
E Main Orchard Sts
Klamath Falls, OR 97601

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mills Elementary School",'Klamath_Falls=' + Klamath_Falls.length); Klamath_Falls[Klamath_Falls.length] = createMarker(new GPoint(-121.80339050,42.24933624),"
Pelican Elementary School
501 Mclean St
Klamath Falls, OR 97601

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pelican Elementary School",'Klamath_Falls=' + Klamath_Falls.length); Klamath_Falls[Klamath_Falls.length] = createMarker(new GPoint(-121.72978973,42.19026566),"
Peterson Elementary School
4856 Clinton Ave
Klamath Falls, OR 97603

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Peterson Elementary School",'Klamath_Falls=' + Klamath_Falls.length); Klamath_Falls[Klamath_Falls.length] = createMarker(new GPoint(-121.76059723,42.22826385),"
Ponderosa Junior High School
2554 Main St
Klamath Falls, OR 97601

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Ponderosa Junior High School",'Klamath_Falls=' + Klamath_Falls.length); Klamath_Falls[Klamath_Falls.length] = createMarker(new GPoint(-121.79409027,42.21939468),"
Riverside Elementary School
707 Cypress St
Klamath Falls, OR 97601

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Riverside Elementary School",'Klamath_Falls=' + Klamath_Falls.length); Klamath_Falls[Klamath_Falls.length] = createMarker(new GPoint(-121.77588654,42.23794556),"
Roosevelt Elementary School
1125 Eldorado St
Klamath Falls, OR 97601

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Roosevelt Elementary School",'Klamath_Falls=' + Klamath_Falls.length); Klamath_Falls[Klamath_Falls.length] = createMarker(new GPoint(-121.71761322,42.21082687),"
Shasta Elementary School
1951 Madison St
Klamath Falls, OR 97603

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Shasta Elementary School",'Klamath_Falls=' + Klamath_Falls.length); Klamath_Falls[Klamath_Falls.length] = createMarker(new GPoint(-121.74237061,42.19356155),"
Stearns Elementary School
3641 Crest St
Klamath Falls, OR 97603

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Stearns Elementary School",'Klamath_Falls=' + Klamath_Falls.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(Bly); map.removeOverlays(Bonanza); map.removeOverlays(Chiloquin); map.removeOverlays(Gilchrist); map.removeOverlays(Keno); map.removeOverlays(Klamath_Falls); map.removeOverlays(Malin); map.removeOverlays(Merrill); 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(Klamath_Falls);map.removeOverlays(Bly); map.removeOverlays(Bonanza); map.removeOverlays(Chiloquin); map.removeOverlays(Gilchrist); map.removeOverlays(Keno); map.removeOverlays(Klamath_Falls); map.removeOverlays(Malin); map.removeOverlays(Merrill); map.addOverlays(Bly); centerByArray(Bly, false, false); cntMarker += Bly.length; map.addOverlays(Bonanza); centerByArray(Bonanza, false, false); cntMarker += Bonanza.length; map.addOverlays(Chiloquin); centerByArray(Chiloquin, false, false); cntMarker += Chiloquin.length; map.addOverlays(Gilchrist); centerByArray(Gilchrist, false, false); cntMarker += Gilchrist.length; map.addOverlays(Keno); centerByArray(Keno, false, false); cntMarker += Keno.length; map.addOverlays(Klamath_Falls); centerByArray(Klamath_Falls, false, false); cntMarker += Klamath_Falls.length; map.addOverlays(Malin); centerByArray(Malin, false, false); cntMarker += Malin.length; map.addOverlays(Merrill); centerByArray(Merrill, false, false); cntMarker += Merrill.length; centerByArray(Klamath_Falls,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'); } }