function addMarkers() { mySelect = document.getElementById('selection'); Adna = [];Winlock = [];Curtis = [];Chehalis = [];Centralia = [];Washington = [];Glenoma = [];Mineral = [];Morton = [];Mossyrock = [];Napavine = [];Onalaska = [];Packwood = [];Pe_Ell = [];Randle = [];Toledo = [];Vader = [];mySelect.options[mySelect.options.length] = new Option("Adna schools",'all=Adna'); mySelect.options[mySelect.options.length] = new Option("Centralia schools",'all=Centralia'); mySelect.options[mySelect.options.length] = new Option("Chehalis schools",'all=Chehalis'); mySelect.options[mySelect.options.length] = new Option("Curtis schools",'all=Curtis'); mySelect.options[mySelect.options.length] = new Option("Glenoma schools",'all=Glenoma'); mySelect.options[mySelect.options.length] = new Option("Mineral schools",'all=Mineral'); mySelect.options[mySelect.options.length] = new Option("Morton schools",'all=Morton'); mySelect.options[mySelect.options.length] = new Option("Mossyrock schools",'all=Mossyrock'); mySelect.options[mySelect.options.length] = new Option("Napavine schools",'all=Napavine'); mySelect.options[mySelect.options.length] = new Option("Onalaska schools",'all=Onalaska'); mySelect.options[mySelect.options.length] = new Option("Packwood schools",'all=Packwood'); mySelect.options[mySelect.options.length] = new Option("Pe Ell schools",'all=Pe_Ell'); mySelect.options[mySelect.options.length] = new Option("Randle schools",'all=Randle'); mySelect.options[mySelect.options.length] = new Option("Toledo schools",'all=Toledo'); mySelect.options[mySelect.options.length] = new Option("Vader schools",'all=Vader'); mySelect.options[mySelect.options.length] = new Option("Washington schools",'all=Washington'); mySelect.options[mySelect.options.length] = new Option("Winlock schools",'all=Winlock'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Adna[Adna.length] = createMarker(new GPoint(-123.06015015,46.63745880),"
Adna Elementary School
P.o. Box 28
Adna, WA 98522

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Adna Elementary School",'Adna=' + Adna.length); Adna[Adna.length] = createMarker(new GPoint(-123.05069733,46.62859344),"
Adna Middle/high School
P.o. Box 148
Adna, WA 98522

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Adna Middle/high School",'Adna=' + Adna.length); Winlock[Winlock.length] = createMarker(new GPoint(-122.89216614,46.48900223),"
Apolo High School
241 North Military Road
Winlock, WA 98596

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Apolo High School",'Winlock=' + Winlock.length); Curtis[Curtis.length] = createMarker(new GPoint(-123.13340759,46.54954529),"
Boistfort Elementary School
983 Boistfort Road
Curtis, WA 98538

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Boistfort Elementary School",'Curtis=' + Curtis.length); Chehalis[Chehalis.length] = createMarker(new GPoint(-122.96276093,46.65869904),"
Cascade Elementary School
89 Sw Third Street
Chehalis, WA 98532

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cascade Elementary School",'Chehalis=' + Chehalis.length); Centralia[Centralia.length] = createMarker(new GPoint(-122.99990082,46.72550964),"
Centralia High School
813 Eshom Road
Centralia, WA 98531

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Centralia High School",'Centralia=' + Centralia.length); Centralia[Centralia.length] = createMarker(new GPoint(-122.98210144,46.72611237),"
Centralia Middle School
901 Johnson Road
Centralia, WA 98531

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Centralia Middle School",'Centralia=' + Centralia.length); Chehalis[Chehalis.length] = createMarker(new GPoint(-122.94195557,46.64326477),"
Chehalis Middle School
1060 Sw 20th Street
Chehalis, WA 98532

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Chehalis Middle School",'Chehalis=' + Chehalis.length); Winlock[Winlock.length] = createMarker(new GPoint(-122.93502200,46.53796200),"
Contract Studies School-onalaska
165 Conradi Rd.
Winlock, WA 98596

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Contract Studies School-onalaska",'Winlock=' + Winlock.length); Centralia[Centralia.length] = createMarker(new GPoint(-122.95929718,46.72188568),"
Edison Elementary School
607 H Street
Centralia, WA 98531

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Edison Elementary School",'Centralia=' + Centralia.length); Washington[Washington.length] = createMarker(new GPoint(-122.93824768,46.53966522),"
Evaline Elementary School
111 Schoolhouse Road
Washington, WA 98596

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Evaline Elementary School",'Washington=' + Washington.length); Centralia[Centralia.length] = createMarker(new GPoint(-122.98775482,46.73405457),"
Fords Prairie Elementary School
1620 Harrison Avenue
Centralia, WA 98531

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fords Prairie Elementary School",'Centralia=' + Centralia.length); Glenoma[Glenoma.length] = createMarker(new GPoint(-122.15600586,46.51815033),"
Glenoma Elementary School
119 Glenoma Road
Glenoma, WA 98336

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Glenoma Elementary School",'Glenoma=' + Glenoma.length); Chehalis[Chehalis.length] = createMarker(new GPoint(-122.96109009,46.65071487),"
Green Hill Academic School
375 Sw 11th Street
Chehalis, WA 98532

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Green Hill Academic School",'Chehalis=' + Chehalis.length); Centralia[Centralia.length] = createMarker(new GPoint(-122.96356201,46.70606232),"
Jefferson Lincoln Elementary School
400 West Summa
Centralia, WA 98531

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jefferson Lincoln Elementary School",'Centralia=' + Centralia.length); Chehalis[Chehalis.length] = createMarker(new GPoint(-122.96109009,46.65071487),"
Lewis County Juvenile Detention
360 Nw North St
Chehalis, WA 98532

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lewis County Juvenile Detention",'Chehalis=' + Chehalis.length); Mineral[Mineral.length] = createMarker(new GPoint(-122.18099976,46.71666336),"
Mineral Elementary School
Po Box 176
Mineral, WA 98355

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mineral Elementary School",'Mineral=' + Mineral.length); Morton[Morton.length] = createMarker(new GPoint(-122.27896118,46.55815125),"
Morton Elementary School
Po Box L
Morton, WA 98356

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Morton Elementary School",'Morton=' + Morton.length); Morton[Morton.length] = createMarker(new GPoint(-122.27426147,46.55368042),"
Morton Junior-senior High School
Po Box F
Morton, WA 98356

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Morton Junior-senior High School",'Morton=' + Morton.length); Mossyrock[Mossyrock.length] = createMarker(new GPoint(-122.48549652,46.53157806),"
Mossyrock Elementary School
445 Willliams St
Mossyrock, WA 98564

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mossyrock Elementary School",'Mossyrock=' + Mossyrock.length); Mossyrock[Mossyrock.length] = createMarker(new GPoint(-122.48559570,46.53023529),"
Mossyrock Middle & High School
Po Box 454
Mossyrock, WA 98564

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mossyrock Middle & High School",'Mossyrock=' + Mossyrock.length); Napavine[Napavine.length] = createMarker(new GPoint(-122.90655518,46.57872772),"
Napavine Elementary School
209 E. Park Street
Napavine, WA 98565

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Napavine Elementary School",'Napavine=' + Napavine.length); Napavine[Napavine.length] = createMarker(new GPoint(-122.90689850,46.57469940),"
Napavine Junior Senior High School
Po Box 357
Napavine, WA 98565

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Napavine Junior Senior High School",'Napavine=' + Napavine.length); Centralia[Centralia.length] = createMarker(new GPoint(-122.95217133,46.74263763),"
Oakview Elementary School
201 Oakview Avenue
Centralia, WA 98531

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Oakview Elementary School",'Centralia=' + Centralia.length); Chehalis[Chehalis.length] = createMarker(new GPoint(-122.93975830,46.64246368),"
Olympic Elementary School
2057 Sw Salsbury Avenue
Chehalis, WA 98532

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Olympic Elementary School",'Chehalis=' + Chehalis.length); Onalaska[Onalaska.length] = createMarker(new GPoint(-122.71929932,46.58153152),"
Onalaska Elementary Middle School
540 Carlisle Ave.
Onalaska, WA 98570

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Onalaska Elementary Middle School",'Onalaska=' + Onalaska.length); Onalaska[Onalaska.length] = createMarker(new GPoint(-122.71929932,46.58153152),"
Onalaska High School
540 Carlisle Ave.
Onalaska, WA 98570

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Onalaska High School",'Onalaska=' + Onalaska.length); Packwood[Packwood.length] = createMarker(new GPoint(-121.65380096,46.62900162),"
Packwood Elementary School
12990 Highway 12
Packwood, WA 98361

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Packwood Elementary School",'Packwood=' + Packwood.length); Pe_Ell[Pe_Ell.length] = createMarker(new GPoint(-123.29806519,46.57521820),"
Pe Ell School
Po Box 368
Pe Ell, WA 98572

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pe Ell School",'Pe_Ell=' + Pe_Ell.length); Chehalis[Chehalis.length] = createMarker(new GPoint(-122.96172333,46.66022873),"
R E Bennett Elementary School
233 South Market Blvd
Chehalis, WA 98532

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("R E Bennett Elementary School",'Chehalis=' + Chehalis.length); Randle[Randle.length] = createMarker(new GPoint(-121.92679596,46.53546906),"
Randle Elementary School
Po Box 278
Randle, WA 98377

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Randle Elementary School",'Randle=' + Randle.length); Toledo[Toledo.length] = createMarker(new GPoint(-122.85240173,46.43911362),"
Toledo Elementary School
Po Box 549
Toledo, WA 98591

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Toledo Elementary School",'Toledo=' + Toledo.length); Toledo[Toledo.length] = createMarker(new GPoint(-122.84516144,46.44969177),"
Toledo High School
Po Box 820
Toledo, WA 98591

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Toledo High School",'Toledo=' + Toledo.length); Toledo[Toledo.length] = createMarker(new GPoint(-122.84970093,46.44075775),"
Toledo Middle School
Po Box 668
Toledo, WA 98591

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Toledo Middle School",'Toledo=' + Toledo.length); Vader[Vader.length] = createMarker(new GPoint(-122.96739960,46.40230179),"
Vader Elementary School
704 D St
Vader, WA 98593

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Vader Elementary School",'Vader=' + Vader.length); Chehalis[Chehalis.length] = createMarker(new GPoint(-122.95069885,46.65056610),"
W F West High School
342 Sw 16th Street
Chehalis, WA 98532

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("W F West High School",'Chehalis=' + Chehalis.length); Centralia[Centralia.length] = createMarker(new GPoint(-122.95381165,46.70845413),"
Washington Elementary School
800 Field Street
Centralia, WA 98531

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Washington Elementary School",'Centralia=' + Centralia.length); Randle[Randle.length] = createMarker(new GPoint(-121.92833710,46.53736115),"
Whitepass Junior Senior High School
516 Silverbrook Road
Randle, WA 98377

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Whitepass Junior Senior High School",'Randle=' + Randle.length); Winlock[Winlock.length] = createMarker(new GPoint(-122.89216614,46.48900223),"
Winlock Middle School
241 North Military Road
Winlock, WA 98596

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Winlock Middle School",'Winlock=' + Winlock.length); Winlock[Winlock.length] = createMarker(new GPoint(-122.94079590,46.49258423),"
Winlock Miller Elementary School
405 Nw Benton
Winlock, WA 98596

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Winlock Miller Elementary School",'Winlock=' + Winlock.length); Winlock[Winlock.length] = createMarker(new GPoint(-122.89216614,46.48900223),"
Winlock Senior High School
241 North Military Road
Winlock, WA 98596

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Winlock Senior High School",'Winlock=' + Winlock.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(Adna); map.removeOverlays(Centralia); map.removeOverlays(Chehalis); map.removeOverlays(Curtis); map.removeOverlays(Glenoma); map.removeOverlays(Mineral); map.removeOverlays(Morton); map.removeOverlays(Mossyrock); map.removeOverlays(Napavine); map.removeOverlays(Onalaska); map.removeOverlays(Packwood); map.removeOverlays(Pe_Ell); map.removeOverlays(Randle); map.removeOverlays(Toledo); map.removeOverlays(Vader); map.removeOverlays(Washington); map.removeOverlays(Winlock); 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(Adna);map.removeOverlays(Adna); map.removeOverlays(Centralia); map.removeOverlays(Chehalis); map.removeOverlays(Curtis); map.removeOverlays(Glenoma); map.removeOverlays(Mineral); map.removeOverlays(Morton); map.removeOverlays(Mossyrock); map.removeOverlays(Napavine); map.removeOverlays(Onalaska); map.removeOverlays(Packwood); map.removeOverlays(Pe_Ell); map.removeOverlays(Randle); map.removeOverlays(Toledo); map.removeOverlays(Vader); map.removeOverlays(Washington); map.removeOverlays(Winlock); map.addOverlays(Adna); centerByArray(Adna, false, false); cntMarker += Adna.length; map.addOverlays(Centralia); centerByArray(Centralia, false, false); cntMarker += Centralia.length; map.addOverlays(Chehalis); centerByArray(Chehalis, false, false); cntMarker += Chehalis.length; map.addOverlays(Curtis); centerByArray(Curtis, false, false); cntMarker += Curtis.length; map.addOverlays(Glenoma); centerByArray(Glenoma, false, false); cntMarker += Glenoma.length; map.addOverlays(Mineral); centerByArray(Mineral, false, false); cntMarker += Mineral.length; map.addOverlays(Morton); centerByArray(Morton, false, false); cntMarker += Morton.length; map.addOverlays(Mossyrock); centerByArray(Mossyrock, false, false); cntMarker += Mossyrock.length; map.addOverlays(Napavine); centerByArray(Napavine, false, false); cntMarker += Napavine.length; map.addOverlays(Onalaska); centerByArray(Onalaska, false, false); cntMarker += Onalaska.length; map.addOverlays(Packwood); centerByArray(Packwood, false, false); cntMarker += Packwood.length; map.addOverlays(Pe_Ell); centerByArray(Pe_Ell, false, false); cntMarker += Pe_Ell.length; map.addOverlays(Randle); centerByArray(Randle, false, false); cntMarker += Randle.length; map.addOverlays(Toledo); centerByArray(Toledo, false, false); cntMarker += Toledo.length; map.addOverlays(Vader); centerByArray(Vader, false, false); cntMarker += Vader.length; map.addOverlays(Washington); centerByArray(Washington, false, false); cntMarker += Washington.length; map.addOverlays(Winlock); centerByArray(Winlock, false, false); cntMarker += Winlock.length; centerByArray(Adna,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'); } }