function addMarkers() { mySelect = document.getElementById('selection'); Shelton = [];Belfair = [];Elma = [];_Shelton_Springs_Rd = [];mySelect.options[mySelect.options.length] = new Option("Belfair schools",'all=Belfair'); mySelect.options[mySelect.options.length] = new Option("Elma schools",'all=Elma'); mySelect.options[mySelect.options.length] = new Option("Shelton schools",'all=Shelton'); mySelect.options[mySelect.options.length] = new Option(" Shelton Springs Rd schools",'all=_Shelton_Springs_Rd'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Shelton[Shelton.length] = createMarker(new GPoint(-123.07610321,47.20452118),"
Alternative Education Learning Program
807 W. Pine St.
Shelton, WA 98584

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Alternative Education Learning Program",'Shelton=' + Shelton.length); Belfair[Belfair.length] = createMarker(new GPoint(-122.82685852,47.45138931),"
Belfair Elementary School
Ne22900 Hwy 3
Belfair, WA 98528

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Belfair Elementary School",'Belfair=' + Belfair.length); Shelton[Shelton.length] = createMarker(new GPoint(-123.09799194,47.20093536),"
Bordeaux Elementary School
350 E. University Ave.
Shelton, WA 98584

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bordeaux Elementary School",'Shelton=' + Shelton.length); Shelton[Shelton.length] = createMarker(new GPoint(-123.10967255,47.21466827),"
Choice High School
807 W. Pine St.
Shelton, WA 98584

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Choice High School",'Shelton=' + Shelton.length); Shelton[Shelton.length] = createMarker(new GPoint(-123.10827637,47.21578979),"
Evergreen Elementary School
900 W. Franklin St.
Shelton, WA 98584

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Evergreen Elementary School",'Shelton=' + Shelton.length); Shelton[Shelton.length] = createMarker(new GPoint(-122.91910553,47.32180405),"
Grapeview Middle School
822 E Mason Benson Rd
Shelton, WA 98546

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Grapeview Middle School",'Shelton=' + Shelton.length); Belfair[Belfair.length] = createMarker(new GPoint(-122.84280396,47.41423798),"
Hawkins Middle School
300 E. Campus Dr.
Belfair, WA 98528

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Hawkins Middle School",'Belfair=' + Belfair.length); Shelton[Shelton.length] = createMarker(new GPoint(-123.16072845,47.33388901),"
Hood Canal Elementary & Junior High School
111 N. Hwy 106
Shelton, WA 98584

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hood Canal Elementary & Junior High School",'Shelton=' + Shelton.length); Elma[Elma.length] = createMarker(new GPoint(-123.43150330,47.20105743),"
Mary M Knight Elementary School
2987 W Matlock Brady Rd
Elma, WA 98541

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mary M Knight Elementary School",'Elma=' + Elma.length); Elma[Elma.length] = createMarker(new GPoint(-123.43150330,47.20105743),"
Mary M Knight High School
2987 W Matlock Brady Rd
Elma, WA 98541

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mary M Knight High School",'Elma=' + Elma.length); Shelton[Shelton.length] = createMarker(new GPoint(-123.10457611,47.21580887),"
Mason County Detention Center
411 N. 5th St.
Shelton, WA 98584

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mason County Detention Center",'Shelton=' + Shelton.length); Belfair[Belfair.length] = createMarker(new GPoint(-122.84173584,47.41375351),"
Mission Creek Youth Camp School
71 E Campus Dr
Belfair, WA 98528

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mission Creek Youth Camp School",'Belfair=' + Belfair.length); Shelton[Shelton.length] = createMarker(new GPoint(-123.11868286,47.22714615),"
Mountain View Elementary School
534 E. ''k'' St.
Shelton, WA 98584

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mountain View Elementary School",'Shelton=' + Shelton.length); Belfair[Belfair.length] = createMarker(new GPoint(-122.84367371,47.41472626),"
North Mason Homelink Program
71 East Campus Dr.
Belfair, WA 98528

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("North Mason Homelink Program",'Belfair=' + Belfair.length); Belfair[Belfair.length] = createMarker(new GPoint(-122.84367371,47.41472626),"
North Mason Options High School
71 E. Campus Dr.
Belfair, WA 98528

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("North Mason Options High School",'Belfair=' + Belfair.length); Belfair[Belfair.length] = createMarker(new GPoint(-122.84239960,47.41410828),"
North Mason Senior High School
200 E. Campus Dr.
Belfair, WA 98528

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("North Mason Senior High School",'Belfair=' + Belfair.length); Shelton[Shelton.length] = createMarker(new GPoint(-123.11649900,47.22783000),"
Olympic Middle School
800 E K St
Shelton, WA 98584

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Olympic Middle School",'Shelton=' + Shelton.length); Shelton[Shelton.length] = createMarker(new GPoint(-123.00438690,47.25868988),"
Pioneer Intermediate/middle School
611 E Agate Rd.
Shelton, WA 98584

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Pioneer Intermediate/middle School",'Shelton=' + Shelton.length); Shelton[Shelton.length] = createMarker(new GPoint(-123.00212097,47.25874710),"
Pioneer Primary School
110 E Spencer Lake Rd.
Shelton, WA 98584

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pioneer Primary School",'Shelton=' + Shelton.length); Belfair[Belfair.length] = createMarker(new GPoint(-122.84510040,47.45963287),"
Sand Hill Elementary School
Ne 791 Sand Hill Rd.
Belfair, WA 98528

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sand Hill Elementary School",'Belfair=' + Belfair.length); Shelton[Shelton.length] = createMarker(new GPoint(-123.10967255,47.21466827),"
Shelton Alternative Middle School
807 W. Pine St.
Shelton, WA 98584

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Shelton Alternative Middle School",'Shelton=' + Shelton.length); _Shelton_Springs_Rd[_Shelton_Springs_Rd.length] = createMarker(new GPoint(-123.12170410,47.23713684),"
Shelton High School
3737 Shelton Springs Rd.
3737 Shelton Springs Rd., WA 98584

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Shelton High School",'_Shelton_Springs_Rd=' + _Shelton_Springs_Rd.length); Shelton[Shelton.length] = createMarker(new GPoint(-123.11230469,47.22998810),"
Shelton Middle School
3301 Shelton Springs Rd.
Shelton, WA 98584

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Shelton Middle School",'Shelton=' + Shelton.length); Shelton[Shelton.length] = createMarker(new GPoint(-123.05494690,47.19789886),"
Southside Elementary School
161 Se Collier Rd
Shelton, WA 98584

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Southside Elementary School",'Shelton=' + Shelton.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(Belfair); map.removeOverlays(Elma); map.removeOverlays(Shelton); map.removeOverlays(_Shelton_Springs_Rd); 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(Shelton);map.removeOverlays(Belfair); map.removeOverlays(Elma); map.removeOverlays(Shelton); map.removeOverlays(_Shelton_Springs_Rd); map.addOverlays(Belfair); centerByArray(Belfair, false, false); cntMarker += Belfair.length; map.addOverlays(Elma); centerByArray(Elma, false, false); cntMarker += Elma.length; map.addOverlays(Shelton); centerByArray(Shelton, false, false); cntMarker += Shelton.length; map.addOverlays(_Shelton_Springs_Rd); centerByArray(_Shelton_Springs_Rd, false, false); cntMarker += _Shelton_Springs_Rd.length; centerByArray(Shelton,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'); } }