function addMarkers() { mySelect = document.getElementById('selection'); Colville = [];Chewelah = [];b_Hunters_Shop_Road = [];Gifford = [];Kettle_Falls = [];Loon_Lake = [];Springdale = [];Northport = [];Addy = [];Valley = [];Wellpinit = [];_Ford_Wellpinit_Rd = [];mySelect.options[mySelect.options.length] = new Option("Addy schools",'all=Addy'); mySelect.options[mySelect.options.length] = new Option("Chewelah schools",'all=Chewelah'); mySelect.options[mySelect.options.length] = new Option("Colville schools",'all=Colville'); mySelect.options[mySelect.options.length] = new Option("Gifford schools",'all=Gifford'); mySelect.options[mySelect.options.length] = new Option("Kettle Falls schools",'all=Kettle_Falls'); mySelect.options[mySelect.options.length] = new Option("Loon Lake schools",'all=Loon_Lake'); mySelect.options[mySelect.options.length] = new Option("Northport schools",'all=Northport'); mySelect.options[mySelect.options.length] = new Option("Springdale schools",'all=Springdale'); mySelect.options[mySelect.options.length] = new Option("Valley schools",'all=Valley'); mySelect.options[mySelect.options.length] = new Option("Wellpinit schools",'all=Wellpinit'); mySelect.options[mySelect.options.length] = new Option(" Ford Wellpinit Rd schools",'all=_Ford_Wellpinit_Rd'); mySelect.options[mySelect.options.length] = new Option("b Hunters Shop Road schools",'all=b_Hunters_Shop_Road'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Colville[Colville.length] = createMarker(new GPoint(-117.89699554,48.54307938),"
Aster Elementary School
225 Hofstetter St
Colville, WA 99114

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Aster Elementary School",'Colville=' + Colville.length); Chewelah[Chewelah.length] = createMarker(new GPoint(-117.71554900,48.28136000),"
Chewelah Alternative
P.o. Box 47
Chewelah, WA 99109

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Chewelah Alternative",'Chewelah=' + Chewelah.length); b_Hunters_Shop_Road[b_Hunters_Shop_Road.length] = createMarker(new GPoint(-118.08309937,48.15689850),"
Columbia High And Elementary School
4961b Hunters Shop Road
4961b Hunters Shop Road, WA 99137

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Columbia High And Elementary School",'b_Hunters_Shop_Road=' + b_Hunters_Shop_Road.length); Colville[Colville.length] = createMarker(new GPoint(-117.89870453,48.53551865),"
Colville Junior High School
990 S Cedar St
Colville, WA 99114

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Colville Junior High School",'Colville=' + Colville.length); Colville[Colville.length] = createMarker(new GPoint(-117.88294220,48.54694748),"
Colville Senior High School
154 Highway 20 E
Colville, WA 99114

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Colville Senior High School",'Colville=' + Colville.length); Gifford[Gifford.length] = createMarker(new GPoint(-118.13714600,48.31051254),"
Evergreen School
3342 Addy-gifford Rd
Gifford, WA 99131

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Evergreen School",'Gifford=' + Gifford.length); Colville[Colville.length] = createMarker(new GPoint(-117.89048767,48.53476334),"
Fort Colville Elementary School
1212 E Ivy Ave
Colville, WA 99114

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Fort Colville Elementary School",'Colville=' + Colville.length); Chewelah[Chewelah.length] = createMarker(new GPoint(-117.71529388,48.27750397),"
Gess Elementary School
E. 405 Lincoln
Chewelah, WA 99109

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Gess Elementary School",'Chewelah=' + Chewelah.length); Colville[Colville.length] = createMarker(new GPoint(-117.89712524,48.55004883),"
Hofstetter Elementary School
640 N Hofstetter St
Colville, WA 99114

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hofstetter Elementary School",'Colville=' + Colville.length); Chewelah[Chewelah.length] = createMarker(new GPoint(-117.71330261,48.31100082),"
Home Link Alternative
P.o. Box 1099
Chewelah, WA 99109

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Home Link Alternative",'Chewelah=' + Chewelah.length); Chewelah[Chewelah.length] = createMarker(new GPoint(-117.71685791,48.28103638),"
Jenkins Middle School
P.o. Box 1099
Chewelah, WA 99109

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Jenkins Middle School",'Chewelah=' + Chewelah.length); Chewelah[Chewelah.length] = createMarker(new GPoint(-117.70853424,48.28086472),"
Jenkins Senior High School
E. 702 Lincoln
Chewelah, WA 99109

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Jenkins Senior High School",'Chewelah=' + Chewelah.length); Kettle_Falls[Kettle_Falls.length] = createMarker(new GPoint(-118.05370331,48.60579681),"
Kettle Falls Elementary School
Po Box 458
Kettle Falls, WA 99141

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Kettle Falls Elementary School",'Kettle_Falls=' + Kettle_Falls.length); Kettle_Falls[Kettle_Falls.length] = createMarker(new GPoint(-118.05998993,48.59965897),"
Kettle Falls High School
Po Box 458
Kettle Falls, WA 99141

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kettle Falls High School",'Kettle_Falls=' + Kettle_Falls.length); Kettle_Falls[Kettle_Falls.length] = createMarker(new GPoint(-118.13661957,48.70552063),"
Kettle Falls Home Link
Po Box 458
Kettle Falls, WA 99141

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kettle Falls Home Link",'Kettle_Falls=' + Kettle_Falls.length); Kettle_Falls[Kettle_Falls.length] = createMarker(new GPoint(-118.06361700,48.61028600),"
Kettle Falls Homelink
W 105 11th St
Kettle Falls, WA 99141

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kettle Falls Homelink",'Kettle_Falls=' + Kettle_Falls.length); Kettle_Falls[Kettle_Falls.length] = createMarker(new GPoint(-118.05580139,48.60340118),"
Kettle Falls Middle School
Po Box 458
Kettle Falls, WA 99141

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Kettle Falls Middle School",'Kettle_Falls=' + Kettle_Falls.length); Loon_Lake[Loon_Lake.length] = createMarker(new GPoint(-117.63071442,48.06251144),"
Loon Lake Elementary School
4001 Maple Street
Loon Lake, WA 99148

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Loon Lake Elementary School",'Loon_Lake=' + Loon_Lake.length); Loon_Lake[Loon_Lake.length] = createMarker(new GPoint(-117.57267761,48.10826111),"
Loon Lake Homelink Program Elementary School
4001 Maple Street
Loon Lake, WA 99148

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Loon Lake Homelink Program Elementary School",'Loon_Lake=' + Loon_Lake.length); Springdale[Springdale.length] = createMarker(new GPoint(-117.74142700,48.05660300),"
Mary Walker Alternative High School
Po Box 159
Springdale, WA 99173

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mary Walker Alternative High School",'Springdale=' + Springdale.length); Springdale[Springdale.length] = createMarker(new GPoint(-117.74028015,48.05747986),"
Mary Walker High School
Po Box 159
Springdale, WA 99173

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mary Walker High School",'Springdale=' + Springdale.length); Northport[Northport.length] = createMarker(new GPoint(-117.78845978,48.91147995),"
Northport Elementary School
Po Box 1280
Northport, WA 99157

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Northport Elementary School",'Northport=' + Northport.length); Northport[Northport.length] = createMarker(new GPoint(-117.78845978,48.91147995),"
Northport High School
Po Box 1280
Northport, WA 99157

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Northport High School",'Northport=' + Northport.length); Colville[Colville.length] = createMarker(new GPoint(-117.79244995,48.74014282),"
Onion Creek Elementary School
2006 Lotze Creek Rd
Colville, WA 99114

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Onion Creek Elementary School",'Colville=' + Colville.length); Springdale[Springdale.length] = createMarker(new GPoint(-122.63349915,48.49499893),"
Parent Partner Program
Po Box 159
Springdale, WA 99173

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Parent Partner Program",'Springdale=' + Springdale.length); Springdale[Springdale.length] = createMarker(new GPoint(-117.91490173,47.99940109),"
Springdale Academy
Po Box 159
Springdale, WA 99173

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Springdale Academy",'Springdale=' + Springdale.length); Springdale[Springdale.length] = createMarker(new GPoint(-117.74028015,48.05747986),"
Springdale Elementary School
Po Box 159
Springdale, WA 99173

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Springdale Elementary School",'Springdale=' + Springdale.length); Springdale[Springdale.length] = createMarker(new GPoint(-117.74028015,48.05747986),"
Springdale Middle School
Po Box 159
Springdale, WA 99173

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Springdale Middle School",'Springdale=' + Springdale.length); Addy[Addy.length] = createMarker(new GPoint(-117.97523499,48.30633163),"
Summit Valley School
2360 Addy-gifford Road
Addy, WA 99101

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Summit Valley School",'Addy=' + Addy.length); Valley[Valley.length] = createMarker(new GPoint(-117.75060272,48.15510178),"
Valley Elem/middle School
P.o. Box 157
Valley, WA 99181

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Valley Elem/middle School",'Valley=' + Valley.length); Valley[Valley.length] = createMarker(new GPoint(-117.82437897,48.19047928),"
Valley Home Program
P.o. Box 157
Valley, WA 99181

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Valley Home Program",'Valley=' + Valley.length); Wellpinit[Wellpinit.length] = createMarker(new GPoint(-117.98700900,47.88677500),"
Wellpinit Alliance High School
6231 Old School Rd
Wellpinit, WA 99040

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wellpinit Alliance High School",'Wellpinit=' + Wellpinit.length); _Ford_Wellpinit_Rd[_Ford_Wellpinit_Rd.length] = createMarker(new GPoint(-117.98940100,47.89620700),"
Wellpinit Elementary School
Po Box 390
6270 Ford Wellpinit Rd, WA 99040

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wellpinit Elementary School",'_Ford_Wellpinit_Rd=' + _Ford_Wellpinit_Rd.length); Wellpinit[Wellpinit.length] = createMarker(new GPoint(-118.05930328,47.89910126),"
Wellpinit High School
Po Box 390
Wellpinit, WA 99040

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wellpinit High School",'Wellpinit=' + Wellpinit.length); Wellpinit[Wellpinit.length] = createMarker(new GPoint(-117.98716300,47.88798500),"
Wellpinit Middle School
Po Box 390
Wellpinit, WA 99040

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Wellpinit Middle School",'Wellpinit=' + Wellpinit.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(Addy); map.removeOverlays(Chewelah); map.removeOverlays(Colville); map.removeOverlays(Gifford); map.removeOverlays(Kettle_Falls); map.removeOverlays(Loon_Lake); map.removeOverlays(Northport); map.removeOverlays(Springdale); map.removeOverlays(Valley); map.removeOverlays(Wellpinit); map.removeOverlays(_Ford_Wellpinit_Rd); map.removeOverlays(b_Hunters_Shop_Road); 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(Colville);map.removeOverlays(Addy); map.removeOverlays(Chewelah); map.removeOverlays(Colville); map.removeOverlays(Gifford); map.removeOverlays(Kettle_Falls); map.removeOverlays(Loon_Lake); map.removeOverlays(Northport); map.removeOverlays(Springdale); map.removeOverlays(Valley); map.removeOverlays(Wellpinit); map.removeOverlays(_Ford_Wellpinit_Rd); map.removeOverlays(b_Hunters_Shop_Road); map.addOverlays(Addy); centerByArray(Addy, false, false); cntMarker += Addy.length; map.addOverlays(Chewelah); centerByArray(Chewelah, false, false); cntMarker += Chewelah.length; map.addOverlays(Colville); centerByArray(Colville, false, false); cntMarker += Colville.length; map.addOverlays(Gifford); centerByArray(Gifford, false, false); cntMarker += Gifford.length; map.addOverlays(Kettle_Falls); centerByArray(Kettle_Falls, false, false); cntMarker += Kettle_Falls.length; map.addOverlays(Loon_Lake); centerByArray(Loon_Lake, false, false); cntMarker += Loon_Lake.length; map.addOverlays(Northport); centerByArray(Northport, false, false); cntMarker += Northport.length; map.addOverlays(Springdale); centerByArray(Springdale, false, false); cntMarker += Springdale.length; map.addOverlays(Valley); centerByArray(Valley, false, false); cntMarker += Valley.length; map.addOverlays(Wellpinit); centerByArray(Wellpinit, false, false); cntMarker += Wellpinit.length; map.addOverlays(_Ford_Wellpinit_Rd); centerByArray(_Ford_Wellpinit_Rd, false, false); cntMarker += _Ford_Wellpinit_Rd.length; map.addOverlays(b_Hunters_Shop_Road); centerByArray(b_Hunters_Shop_Road, false, false); cntMarker += b_Hunters_Shop_Road.length; centerByArray(Colville,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'); } }