function addMarkers() { mySelect = document.getElementById('selection'); Aberdeen = [];Montesano = [];Hoquiam = [];Cosmopolis = [];Elma = [];Amanda_Park = [];Mccleary = [];Ocean_Shores = [];Oakville = [];Westport = [];Pacific_Beach = [];Satsop = [];Taholah = [];mySelect.options[mySelect.options.length] = new Option("Aberdeen schools",'all=Aberdeen'); mySelect.options[mySelect.options.length] = new Option("Amanda Park schools",'all=Amanda_Park'); mySelect.options[mySelect.options.length] = new Option("Cosmopolis schools",'all=Cosmopolis'); mySelect.options[mySelect.options.length] = new Option("Elma schools",'all=Elma'); mySelect.options[mySelect.options.length] = new Option("Hoquiam schools",'all=Hoquiam'); mySelect.options[mySelect.options.length] = new Option("Mccleary schools",'all=Mccleary'); mySelect.options[mySelect.options.length] = new Option("Montesano schools",'all=Montesano'); mySelect.options[mySelect.options.length] = new Option("Oakville schools",'all=Oakville'); mySelect.options[mySelect.options.length] = new Option("Ocean Shores schools",'all=Ocean_Shores'); mySelect.options[mySelect.options.length] = new Option("Pacific Beach schools",'all=Pacific_Beach'); mySelect.options[mySelect.options.length] = new Option("Satsop schools",'all=Satsop'); mySelect.options[mySelect.options.length] = new Option("Taholah schools",'all=Taholah'); mySelect.options[mySelect.options.length] = new Option("Westport schools",'all=Westport'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Aberdeen[Aberdeen.length] = createMarker(new GPoint(-123.83791351,46.97226334),"
A J West Elementary School
1801 Bay Ave.
Aberdeen, WA 98520

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("A J West Elementary School",'Aberdeen=' + Aberdeen.length); Aberdeen[Aberdeen.length] = createMarker(new GPoint(-123.83650208,46.97703552),"
Alexander Young Elementary School
1700 Cherry St
Aberdeen, WA 98520

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Alexander Young Elementary School",'Aberdeen=' + Aberdeen.length); Montesano[Montesano.length] = createMarker(new GPoint(-123.58016205,46.98517990),"
Beacon Avenue Elementary School
1717 East Beacon Avenue
Montesano, WA 98563

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Beacon Avenue Elementary School",'Montesano=' + Montesano.length); Hoquiam[Hoquiam.length] = createMarker(new GPoint(-123.88952637,46.98075867),"
Central Elementary School
310 Simpson Avenue
Hoquiam, WA 98550

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Central Elementary School",'Hoquiam=' + Hoquiam.length); Aberdeen[Aberdeen.length] = createMarker(new GPoint(-123.69719696,46.96626282),"
Central Park Elementary School
601 School Road
Aberdeen, WA 98520

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Central Park Elementary School",'Aberdeen=' + Aberdeen.length); Cosmopolis[Cosmopolis.length] = createMarker(new GPoint(-123.77214050,46.95282745),"
Cosmopolis Elementary School
1439 Fourth Street
Cosmopolis, WA 98537

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cosmopolis Elementary School",'Cosmopolis=' + Cosmopolis.length); Elma[Elma.length] = createMarker(new GPoint(-123.40917969,47.00263596),"
East Grays Harbor Lrn Opp Cntr High School
1235 Monte-elma Rd
Elma, WA 98541

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("East Grays Harbor Lrn Opp Cntr High School",'Elma=' + Elma.length); Elma[Elma.length] = createMarker(new GPoint(-123.43242645,47.00323486),"
Elma Elementary School
1235 Monte-elma Rd
Elma, WA 98541

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Elma Elementary School",'Elma=' + Elma.length); Elma[Elma.length] = createMarker(new GPoint(-123.43242645,47.00323486),"
Elma High School
1235 Elma-monte Rd
Elma, WA 98541

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Elma High School",'Elma=' + Elma.length); Elma[Elma.length] = createMarker(new GPoint(-123.43242645,47.00323486),"
Elma Middle School
1235 Monte-elma Rd.
Elma, WA 98541

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Elma Middle School",'Elma=' + Elma.length); Hoquiam[Hoquiam.length] = createMarker(new GPoint(-123.90199280,46.98113632),"
Emerson Elementary School
101 W Emerson
Hoquiam, WA 98550

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Emerson Elementary School",'Hoquiam=' + Hoquiam.length); Aberdeen[Aberdeen.length] = createMarker(new GPoint(-123.81596400,46.97587500),"
Grays Harbor Juvenile Detention
Grays Harbor Juvenile Detentio
Aberdeen, WA 98520

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Grays Harbor Juvenile Detention",'Aberdeen=' + Aberdeen.length); Aberdeen[Aberdeen.length] = createMarker(new GPoint(-123.83129883,46.97203064),"
Harbor High School
300 N. Williams
Aberdeen, WA 98520

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Harbor High School",'Aberdeen=' + Aberdeen.length); Aberdeen[Aberdeen.length] = createMarker(new GPoint(-123.81616974,46.97798920),"
Homelink
216 North G Street
Aberdeen, WA 98520

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Homelink",'Aberdeen=' + Aberdeen.length); Aberdeen[Aberdeen.length] = createMarker(new GPoint(-123.83791351,46.97226334),"
Hopkins Elementary School
1313 Pacific
Aberdeen, WA 98520

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hopkins Elementary School",'Aberdeen=' + Aberdeen.length); Hoquiam[Hoquiam.length] = createMarker(new GPoint(-123.90614319,46.98109818),"
Hoquiam High School
501 W. Emerson
Hoquiam, WA 98550

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hoquiam High School",'Hoquiam=' + Hoquiam.length); Hoquiam[Hoquiam.length] = createMarker(new GPoint(-123.90609741,46.98154831),"
Hoquiam Middle School
200 Spencer
Hoquiam, WA 98550

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Hoquiam Middle School",'Hoquiam=' + Hoquiam.length); Aberdeen[Aberdeen.length] = createMarker(new GPoint(-123.82025146,46.97837830),"
J M Weatherwax High School
414 North I Street
Aberdeen, WA 98520

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("J M Weatherwax High School",'Aberdeen=' + Aberdeen.length); Amanda_Park[Amanda_Park.length] = createMarker(new GPoint(-123.88752747,47.46189880),"
Lake Quinault Elementary School
P O Box 38
Amanda Park, WA 98526

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lake Quinault Elementary School",'Amanda_Park=' + Amanda_Park.length); Amanda_Park[Amanda_Park.length] = createMarker(new GPoint(-124.06729889,47.45479965),"
Lake Quinault High School
P O Box 38
Amanda Park, WA 98526

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lake Quinault High School",'Amanda_Park=' + Amanda_Park.length); Hoquiam[Hoquiam.length] = createMarker(new GPoint(-123.88896942,46.99176788),"
Lincoln Elementary School
700 Wood
Hoquiam, WA 98550

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Hoquiam=' + Hoquiam.length); Mccleary[Mccleary.length] = createMarker(new GPoint(-123.26589203,47.05010605),"
Mccleary Elementary School
611 S. Main St.
Mccleary, WA 98557

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mccleary Elementary School",'Mccleary=' + Mccleary.length); Aberdeen[Aberdeen.length] = createMarker(new GPoint(-123.82302856,46.97689056),"
Mcdermoth Elementary School
601 North K St
Aberdeen, WA 98520

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mcdermoth Elementary School",'Aberdeen=' + Aberdeen.length); Aberdeen[Aberdeen.length] = createMarker(new GPoint(-123.79339600,46.96373749),"
Miller Junior High School
100 E Lindstrom
Aberdeen, WA 98520

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Miller Junior High School",'Aberdeen=' + Aberdeen.length); Montesano[Montesano.length] = createMarker(new GPoint(-123.59704500,46.98359000),"
Montesano Choice School
302 North Church Street
Montesano, WA 98563

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Montesano Choice School",'Montesano=' + Montesano.length); Montesano[Montesano.length] = createMarker(new GPoint(-123.59729767,46.98378754),"
Montesano Junior Senior High School
303 North Church
Montesano, WA 98563

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Montesano Junior Senior High School",'Montesano=' + Montesano.length); Ocean_Shores[Ocean_Shores.length] = createMarker(new GPoint(-124.15825653,47.01729965),"
North Beach High School
P.o. Box 969
Ocean Shores, WA 98569

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("North Beach High School",'Ocean_Shores=' + Ocean_Shores.length); Ocean_Shores[Ocean_Shores.length] = createMarker(new GPoint(-124.15825653,47.01729965),"
North Beach Middle School
Po Box 969
Ocean Shores, WA 98569

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("North Beach Middle School",'Ocean_Shores=' + Ocean_Shores.length); Cosmopolis[Cosmopolis.length] = createMarker(new GPoint(-123.49060822,46.77537537),"
North River School
2867 North River Rd
Cosmopolis, WA 98537

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("North River School",'Cosmopolis=' + Cosmopolis.length); Oakville[Oakville.length] = createMarker(new GPoint(-123.23989868,46.83901978),"
Oakville Elementary School
Po Box H
Oakville, WA 98568

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Oakville Elementary School",'Oakville=' + Oakville.length); Oakville[Oakville.length] = createMarker(new GPoint(-123.23989868,46.83901978),"
Oakville High School
Po Box H
Oakville, WA 98568

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oakville High School",'Oakville=' + Oakville.length); Ocean_Shores[Ocean_Shores.length] = createMarker(new GPoint(-124.15621948,46.97807312),"
Ocean Shores Elementary School
300 Mt. Olympus Way
Ocean Shores, WA 98569

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ocean Shores Elementary School",'Ocean_Shores=' + Ocean_Shores.length); Westport[Westport.length] = createMarker(new GPoint(-124.10068512,46.86125183),"
Ocosta Elementary School
2580 Montesano Street South
Westport, WA 98595

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ocosta Elementary School",'Westport=' + Westport.length); Westport[Westport.length] = createMarker(new GPoint(-124.10068512,46.86125183),"
Ocosta Junior - Senior High School
2580 Montesano Street South
Westport, WA 98595

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ocosta Junior - Senior High School",'Westport=' + Westport.length); Pacific_Beach[Pacific_Beach.length] = createMarker(new GPoint(-124.20030212,47.20857620),"
Pacific Beach Elementary School
P.o. Box H
Pacific Beach, WA 98571

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pacific Beach Elementary School",'Pacific_Beach=' + Pacific_Beach.length); Aberdeen[Aberdeen.length] = createMarker(new GPoint(-123.81257629,46.98413086),"
Robert Gray Elementary School
1516 North B St
Aberdeen, WA 98520

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Robert Gray Elementary School",'Aberdeen=' + Aberdeen.length); Satsop[Satsop.length] = createMarker(new GPoint(-123.47868347,47.00365067),"
Satsop Elementary School
Box 96
Satsop, WA 98583

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Satsop Elementary School",'Satsop=' + Satsop.length); Montesano[Montesano.length] = createMarker(new GPoint(-123.59729767,46.98378754),"
Simpson Avenue Elementary School
519 West Simpson Avenue
Montesano, WA 98563

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Simpson Avenue Elementary School",'Montesano=' + Montesano.length); Aberdeen[Aberdeen.length] = createMarker(new GPoint(-123.78919983,46.96720123),"
Stevens Elementary School
301 S. Farragut
Aberdeen, WA 98520

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Stevens Elementary School",'Aberdeen=' + Aberdeen.length); Taholah[Taholah.length] = createMarker(new GPoint(-124.28628400,47.34257500),"
Taholah Elementary & Middle School
Po Box 249
Taholah, WA 98587

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Taholah Elementary & Middle School",'Taholah=' + Taholah.length); Taholah[Taholah.length] = createMarker(new GPoint(-124.29135895,47.34703064),"
Taholah High School
Po Box 249
Taholah, WA 98587

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Taholah High School",'Taholah=' + Taholah.length); Hoquiam[Hoquiam.length] = createMarker(new GPoint(-123.85603333,46.97712326),"
Washington Elementary School
3003 Cherry
Hoquiam, WA 98550

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Washington Elementary School",'Hoquiam=' + Hoquiam.length); Aberdeen[Aberdeen.length] = createMarker(new GPoint(-123.77185822,47.11763763),"
Wishkah Valley Elementary/high School
4640 Wishkah Rd.
Aberdeen, WA 98520

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wishkah Valley Elementary/high School",'Aberdeen=' + Aberdeen.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(Aberdeen); map.removeOverlays(Amanda_Park); map.removeOverlays(Cosmopolis); map.removeOverlays(Elma); map.removeOverlays(Hoquiam); map.removeOverlays(Mccleary); map.removeOverlays(Montesano); map.removeOverlays(Oakville); map.removeOverlays(Ocean_Shores); map.removeOverlays(Pacific_Beach); map.removeOverlays(Satsop); map.removeOverlays(Taholah); map.removeOverlays(Westport); 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(Aberdeen);map.removeOverlays(Aberdeen); map.removeOverlays(Amanda_Park); map.removeOverlays(Cosmopolis); map.removeOverlays(Elma); map.removeOverlays(Hoquiam); map.removeOverlays(Mccleary); map.removeOverlays(Montesano); map.removeOverlays(Oakville); map.removeOverlays(Ocean_Shores); map.removeOverlays(Pacific_Beach); map.removeOverlays(Satsop); map.removeOverlays(Taholah); map.removeOverlays(Westport); map.addOverlays(Aberdeen); centerByArray(Aberdeen, false, false); cntMarker += Aberdeen.length; map.addOverlays(Amanda_Park); centerByArray(Amanda_Park, false, false); cntMarker += Amanda_Park.length; map.addOverlays(Cosmopolis); centerByArray(Cosmopolis, false, false); cntMarker += Cosmopolis.length; map.addOverlays(Elma); centerByArray(Elma, false, false); cntMarker += Elma.length; map.addOverlays(Hoquiam); centerByArray(Hoquiam, false, false); cntMarker += Hoquiam.length; map.addOverlays(Mccleary); centerByArray(Mccleary, false, false); cntMarker += Mccleary.length; map.addOverlays(Montesano); centerByArray(Montesano, false, false); cntMarker += Montesano.length; map.addOverlays(Oakville); centerByArray(Oakville, false, false); cntMarker += Oakville.length; map.addOverlays(Ocean_Shores); centerByArray(Ocean_Shores, false, false); cntMarker += Ocean_Shores.length; map.addOverlays(Pacific_Beach); centerByArray(Pacific_Beach, false, false); cntMarker += Pacific_Beach.length; map.addOverlays(Satsop); centerByArray(Satsop, false, false); cntMarker += Satsop.length; map.addOverlays(Taholah); centerByArray(Taholah, false, false); cntMarker += Taholah.length; map.addOverlays(Westport); centerByArray(Westport, false, false); cntMarker += Westport.length; centerByArray(Aberdeen,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'); } }