function addMarkers() { mySelect = document.getElementById('selection'); Sekiu = [];Clallam_Bay = [];Port_Angeles = [];Bremerton = [];Joyce = [];_South_Forks_Avenue = [];Forks = [];Sequim = [];Neah_Bay = [];La_Push = [];_N_Sequim_Ave = [];mySelect.options[mySelect.options.length] = new Option("Bremerton schools",'all=Bremerton'); mySelect.options[mySelect.options.length] = new Option("Clallam Bay schools",'all=Clallam_Bay'); mySelect.options[mySelect.options.length] = new Option("Forks schools",'all=Forks'); mySelect.options[mySelect.options.length] = new Option("Joyce schools",'all=Joyce'); mySelect.options[mySelect.options.length] = new Option("La Push schools",'all=La_Push'); mySelect.options[mySelect.options.length] = new Option("Neah Bay schools",'all=Neah_Bay'); mySelect.options[mySelect.options.length] = new Option("Port Angeles schools",'all=Port_Angeles'); mySelect.options[mySelect.options.length] = new Option("Sekiu schools",'all=Sekiu'); mySelect.options[mySelect.options.length] = new Option("Sequim schools",'all=Sequim'); mySelect.options[mySelect.options.length] = new Option(" N Sequim Ave schools",'all=_N_Sequim_Ave'); mySelect.options[mySelect.options.length] = new Option(" South Forks Avenue schools",'all=_South_Forks_Avenue'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Sekiu[Sekiu.length] = createMarker(new GPoint(-124.62458038,48.36782074),"
Cape Flattery Preschool
13193 Hwy 112
Sekiu, WA 98381

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cape Flattery Preschool",'Sekiu=' + Sekiu.length); Clallam_Bay[Clallam_Bay.length] = createMarker(new GPoint(-124.25869751,48.25476074),"
Cape Flattery Preschool
16933 Hwy 112
Clallam Bay, WA 98326

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cape Flattery Preschool",'Clallam_Bay=' + Clallam_Bay.length); Port_Angeles[Port_Angeles.length] = createMarker(new GPoint(-123.43232727,48.11481094),"
Choice Community High School
924 W 9th St
Port Angeles, WA 98363

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Choice Community High School",'Port_Angeles=' + Port_Angeles.length); Bremerton[Bremerton.length] = createMarker(new GPoint(-122.62406158,47.56586075),"
Clallam Bay Correction Center
Olympic Esd 114
Bremerton, WA 98312

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Clallam Bay Correction Center",'Bremerton=' + Bremerton.length); Clallam_Bay[Clallam_Bay.length] = createMarker(new GPoint(-124.25869751,48.25476074),"
Clallam Bay High & Elementary School
P.o. Box 337
Clallam Bay, WA 98326

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Clallam Bay High & Elementary School",'Clallam_Bay=' + Clallam_Bay.length); Port_Angeles[Port_Angeles.length] = createMarker(new GPoint(-123.48409271,48.11927032),"
Clallam Co Juvenile Detention
1912 W 18th St
Port Angeles, WA 98363

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Clallam Co Juvenile Detention",'Port_Angeles=' + Port_Angeles.length); Port_Angeles[Port_Angeles.length] = createMarker(new GPoint(-123.74103546,48.13632584),"
Crescent Elementary School
50350 Hwy 112
Port Angeles, WA 98363

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Crescent Elementary School",'Port_Angeles=' + Port_Angeles.length); Joyce[Joyce.length] = createMarker(new GPoint(-123.74103546,48.13632584),"
Crescent School
North Olympic Homeconnection
Joyce, WA 98343

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Crescent School",'Joyce=' + Joyce.length); _South_Forks_Avenue[_South_Forks_Avenue.length] = createMarker(new GPoint(-124.38564800,47.94811200),"
District Run Home School
382 South Forks Avenue
382 South Forks Avenue, WA 98331

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("District Run Home School",'_South_Forks_Avenue=' + _South_Forks_Avenue.length); Port_Angeles[Port_Angeles.length] = createMarker(new GPoint(-123.53660583,48.11268234),"
Dry Creek Elementary School
25 Rife Rd
Port Angeles, WA 98363

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Dry Creek Elementary School",'Port_Angeles=' + Port_Angeles.length); Port_Angeles[Port_Angeles.length] = createMarker(new GPoint(-123.32330322,48.10025787),"
Fairview Elementary School
166 Lake Farm Rd
Port Angeles, WA 98362

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fairview Elementary School",'Port_Angeles=' + Port_Angeles.length); Forks[Forks.length] = createMarker(new GPoint(-124.38706970,47.94599533),"
Forks Alternative School
161 East E Street
Forks, WA 98331

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Forks Alternative School",'Forks=' + Forks.length); Forks[Forks.length] = createMarker(new GPoint(-124.38130188,47.94992065),"
Forks Elementary School
301 South Elderberry Ave
Forks, WA 98331

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Forks Elementary School",'Forks=' + Forks.length); Forks[Forks.length] = createMarker(new GPoint(-124.38420105,47.94918060),"
Forks High School
261 South Spartan Avenue
Forks, WA 98331

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Forks High School",'Forks=' + Forks.length); Forks[Forks.length] = createMarker(new GPoint(-124.38546753,47.94841385),"
Forks Middle School
121 South Spartan Avenue
Forks, WA 98331

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Forks Middle School",'Forks=' + Forks.length); Port_Angeles[Port_Angeles.length] = createMarker(new GPoint(-123.42389679,48.10403061),"
Franklin Elementary School
2505 S Washington St
Port Angeles, WA 98362

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Franklin Elementary School",'Port_Angeles=' + Port_Angeles.length); Sequim[Sequim.length] = createMarker(new GPoint(-123.17320251,48.08201599),"
Greywolf Elementary School
171 Carlsborg Rd.
Sequim, WA 98382

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Greywolf Elementary School",'Sequim=' + Sequim.length); Port_Angeles[Port_Angeles.length] = createMarker(new GPoint(-123.47275543,48.12773132),"
Hamilton Elementary School
1822 W 7th St
Port Angeles, WA 98363

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hamilton Elementary School",'Port_Angeles=' + Port_Angeles.length); Sequim[Sequim.length] = createMarker(new GPoint(-123.10911560,48.08343887),"
Helen Haller Elementary School
350 W. Fir Street
Sequim, WA 98382

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Helen Haller Elementary School",'Sequim=' + Sequim.length); Port_Angeles[Port_Angeles.length] = createMarker(new GPoint(-123.44467926,48.11037445),"
Jefferson Elementary School
218 E 12th St
Port Angeles, WA 98362

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jefferson Elementary School",'Port_Angeles=' + Port_Angeles.length); Port_Angeles[Port_Angeles.length] = createMarker(new GPoint(-123.38650513,48.10323715),"
Monroe Elementary School
102 Monroe Rd
Port Angeles, WA 98362

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Monroe Elementary School",'Port_Angeles=' + Port_Angeles.length); Port_Angeles[Port_Angeles.length] = createMarker(new GPoint(-123.44060516,48.10146332),"
N Olympic Peninsula Skill Consor High School
905 W 9th St
Port Angeles, WA 98363

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("N Olympic Peninsula Skill Consor High School",'Port_Angeles=' + Port_Angeles.length); Neah_Bay[Neah_Bay.length] = createMarker(new GPoint(-10.00000000,10.00000000),"
Neah Bay Elementary School
3560 Deer Street
Neah Bay, WA 98357

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Neah Bay Elementary School",'Neah_Bay=' + Neah_Bay.length); Neah_Bay[Neah_Bay.length] = createMarker(new GPoint(-124.62290192,48.36286163),"
Neah Bay High And Elementary School
P.o. Box 86
Neah Bay, WA 98357

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Neah Bay High And Elementary School",'Neah_Bay=' + Neah_Bay.length); Port_Angeles[Port_Angeles.length] = createMarker(new GPoint(-123.43232727,48.11481094),"
Parents As Partners
216 E 4th St
Port Angeles, WA 98362

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Parents As Partners",'Port_Angeles=' + Port_Angeles.length); Port_Angeles[Port_Angeles.length] = createMarker(new GPoint(-123.44060516,48.10146332),"
Port Angeles High School
304 E Park Ave
Port Angeles, WA 98362

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Port Angeles High School",'Port_Angeles=' + Port_Angeles.length); La_Push[La_Push.length] = createMarker(new GPoint(-124.63529968,47.90909958),"
Quileute Tribal School
Po Box 39
La Push, WA 98350

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Quileute Tribal School",'La_Push=' + La_Push.length); Forks[Forks.length] = createMarker(new GPoint(-124.38509369,47.94628525),"
Quillayute Valley Preschool
945 S Forks Ave
Forks, WA 98331

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Quillayute Valley Preschool",'Forks=' + Forks.length); Port_Angeles[Port_Angeles.length] = createMarker(new GPoint(-123.38650513,48.10318375),"
Roosevelt Middle School
106 Monroe Road
Port Angeles, WA 98362

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Roosevelt Middle School",'Port_Angeles=' + Port_Angeles.length); Sequim[Sequim.length] = createMarker(new GPoint(-123.10566711,48.08253860),"
Sequim Community School
220 W. Alder
Sequim, WA 98382

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sequim Community School",'Sequim=' + Sequim.length); Sequim[Sequim.length] = createMarker(new GPoint(-123.12413788,48.08689880),"
Sequim Middle School
301 W. Hendrickson Rd.
Sequim, WA 98382

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Sequim Middle School",'Sequim=' + Sequim.length); _N_Sequim_Ave[_N_Sequim_Ave.length] = createMarker(new GPoint(-123.10250092,48.08464813),"
Sequim Senior High School
601 N. Sequim Ave.
601 N. Sequim Ave., WA 98382

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sequim Senior High School",'_N_Sequim_Ave=' + _N_Sequim_Ave.length); Port_Angeles[Port_Angeles.length] = createMarker(new GPoint(-123.43370300,48.11553600),"
Special Education
216 E 4th St
Port Angeles, WA 98362

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Special Education",'Port_Angeles=' + Port_Angeles.length); Port_Angeles[Port_Angeles.length] = createMarker(new GPoint(-123.46457672,48.11633682),"
Stevens Middle School
1139 W 14th St
Port Angeles, WA 98363

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Stevens Middle School",'Port_Angeles=' + Port_Angeles.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(Bremerton); map.removeOverlays(Clallam_Bay); map.removeOverlays(Forks); map.removeOverlays(Joyce); map.removeOverlays(La_Push); map.removeOverlays(Neah_Bay); map.removeOverlays(Port_Angeles); map.removeOverlays(Sekiu); map.removeOverlays(Sequim); map.removeOverlays(_N_Sequim_Ave); map.removeOverlays(_South_Forks_Avenue); 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(Sekiu);map.removeOverlays(Bremerton); map.removeOverlays(Clallam_Bay); map.removeOverlays(Forks); map.removeOverlays(Joyce); map.removeOverlays(La_Push); map.removeOverlays(Neah_Bay); map.removeOverlays(Port_Angeles); map.removeOverlays(Sekiu); map.removeOverlays(Sequim); map.removeOverlays(_N_Sequim_Ave); map.removeOverlays(_South_Forks_Avenue); map.addOverlays(Bremerton); centerByArray(Bremerton, false, false); cntMarker += Bremerton.length; map.addOverlays(Clallam_Bay); centerByArray(Clallam_Bay, false, false); cntMarker += Clallam_Bay.length; map.addOverlays(Forks); centerByArray(Forks, false, false); cntMarker += Forks.length; map.addOverlays(Joyce); centerByArray(Joyce, false, false); cntMarker += Joyce.length; map.addOverlays(La_Push); centerByArray(La_Push, false, false); cntMarker += La_Push.length; map.addOverlays(Neah_Bay); centerByArray(Neah_Bay, false, false); cntMarker += Neah_Bay.length; map.addOverlays(Port_Angeles); centerByArray(Port_Angeles, false, false); cntMarker += Port_Angeles.length; map.addOverlays(Sekiu); centerByArray(Sekiu, false, false); cntMarker += Sekiu.length; map.addOverlays(Sequim); centerByArray(Sequim, false, false); cntMarker += Sequim.length; map.addOverlays(_N_Sequim_Ave); centerByArray(_N_Sequim_Ave, false, false); cntMarker += _N_Sequim_Ave.length; map.addOverlays(_South_Forks_Avenue); centerByArray(_South_Forks_Avenue, false, false); cntMarker += _South_Forks_Avenue.length; centerByArray(Sekiu,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'); } }