function addMarkers() { mySelect = document.getElementById('selection'); Langley = [];Oak_Harbor = [];Coupeville = [];Camano_Island = [];_S_Oak_Harbor_St = [];mySelect.options[mySelect.options.length] = new Option("Camano Island schools",'all=Camano_Island'); mySelect.options[mySelect.options.length] = new Option("Coupeville schools",'all=Coupeville'); mySelect.options[mySelect.options.length] = new Option("Langley schools",'all=Langley'); mySelect.options[mySelect.options.length] = new Option("Oak Harbor schools",'all=Oak_Harbor'); mySelect.options[mySelect.options.length] = new Option(" S Oak Harbor St schools",'all=_S_Oak_Harbor_St'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Langley[Langley.length] = createMarker(new GPoint(-122.44110107,48.03170013),"
Bayview Alternative School
Po Box 311
Langley, WA 98260

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bayview Alternative School",'Langley=' + Langley.length); Oak_Harbor[Oak_Harbor.length] = createMarker(new GPoint(-122.66620636,48.29480362),"
Broadview Elementary School
473 Sw Fairhaven Dr.
Oak Harbor, WA 98277

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Broadview Elementary School",'Oak_Harbor=' + Oak_Harbor.length); Coupeville[Coupeville.length] = createMarker(new GPoint(-122.64913940,48.17652130),"
Cedar Program
2 South Main
Coupeville, WA 98239

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cedar Program",'Coupeville=' + Coupeville.length); Oak_Harbor[Oak_Harbor.length] = createMarker(new GPoint(-122.67181396,48.32931519),"
Clover Valley Elementary School
600 Cherokee Dr.
Oak Harbor, WA 98277

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Clover Valley Elementary School",'Oak_Harbor=' + Oak_Harbor.length); Coupeville[Coupeville.length] = createMarker(new GPoint(-122.68630981,48.21211624),"
Coupeville Elementary School
6 South Main
Coupeville, WA 98239

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Coupeville Elementary School",'Coupeville=' + Coupeville.length); Coupeville[Coupeville.length] = createMarker(new GPoint(-122.68598938,48.20734787),"
Coupeville High School
501 South Main
Coupeville, WA 98239

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Coupeville High School",'Coupeville=' + Coupeville.length); Coupeville[Coupeville.length] = createMarker(new GPoint(-122.68598938,48.20734787),"
Coupeville Middle School
501 South Main
Coupeville, WA 98239

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Coupeville Middle School",'Coupeville=' + Coupeville.length); Oak_Harbor[Oak_Harbor.length] = createMarker(new GPoint(-122.59700775,48.30712128),"
Crescent Harbor Elementary School
330 E. Crescent Harbor Rd.
Oak Harbor, WA 98277

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Crescent Harbor Elementary School",'Oak_Harbor=' + Oak_Harbor.length); Camano_Island[Camano_Island.length] = createMarker(new GPoint(-122.47039032,48.14526367),"
Elger Bay Elementary School
1810 Elger Bay Rd
Camano Island, WA 98282

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Elger Bay Elementary School",'Camano_Island=' + Camano_Island.length); Oak_Harbor[Oak_Harbor.length] = createMarker(new GPoint(-122.67601013,48.30063629),"
Hillcrest Elementary School
1500 Nw 2nd Ave.
Oak Harbor, WA 98277

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hillcrest Elementary School",'Oak_Harbor=' + Oak_Harbor.length); _S_Oak_Harbor_St[_S_Oak_Harbor_St.length] = createMarker(new GPoint(-122.64308929,48.29660034),"
Homeconnection
350 S. Oak Harbor St.
350 S. Oak Harbor St., WA 98277

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Homeconnection",'_S_Oak_Harbor_St=' + _S_Oak_Harbor_St.length); Langley[Langley.length] = createMarker(new GPoint(-122.44110107,48.03170013),"
Langley Middle School
Po Box 370
Langley, WA 98260

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Langley Middle School",'Langley=' + Langley.length); Oak_Harbor[Oak_Harbor.length] = createMarker(new GPoint(-122.64308929,48.29660034),"
Midway School
200 Se Midway Blvd.
Oak Harbor, WA 98277

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Midway School",'Oak_Harbor=' + Oak_Harbor.length); Oak_Harbor[Oak_Harbor.length] = createMarker(new GPoint(-122.64720154,48.29907990),"
North Whidbey Middle School
67 Ne Izett St.
Oak Harbor, WA 98277

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("North Whidbey Middle School",'Oak_Harbor=' + Oak_Harbor.length); Oak_Harbor[Oak_Harbor.length] = createMarker(new GPoint(-122.64350128,48.29693604),"
Oak Harbor Elementary School
151 Se Midway Blvd.
Oak Harbor, WA 98277

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Oak Harbor Elementary School",'Oak_Harbor=' + Oak_Harbor.length); Oak_Harbor[Oak_Harbor.length] = createMarker(new GPoint(-122.66865540,48.30063629),"
Oak Harbor High School
950 Nw 2nd Ave.
Oak Harbor, WA 98277

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oak Harbor High School",'Oak_Harbor=' + Oak_Harbor.length); Oak_Harbor[Oak_Harbor.length] = createMarker(new GPoint(-122.65962219,48.29316711),"
Oak Harbor Middle School
150 Sw Sixth Ave.
Oak Harbor, WA 98277

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Oak Harbor Middle School",'Oak_Harbor=' + Oak_Harbor.length); Oak_Harbor[Oak_Harbor.length] = createMarker(new GPoint(-122.63423157,48.30080414),"
Olympic View Elementary School
380 Ne Regatta Dr.
Oak Harbor, WA 98277

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Olympic View Elementary School",'Oak_Harbor=' + Oak_Harbor.length); Langley[Langley.length] = createMarker(new GPoint(-122.44110107,48.03170013),"
South Whidbey High School
Po Box 390
Langley, WA 98260

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("South Whidbey High School",'Langley=' + Langley.length); Langley[Langley.length] = createMarker(new GPoint(-122.44110107,48.03170013),"
South Whidbey Intermediate School
Po Box 308
Langley, WA 98260

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("South Whidbey Intermediate School",'Langley=' + Langley.length); Langley[Langley.length] = createMarker(new GPoint(-122.44110107,48.03170013),"
South Whidbey Primary School
Po Box 350
Langley, WA 98260

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("South Whidbey Primary School",'Langley=' + Langley.length); Langley[Langley.length] = createMarker(new GPoint(-122.44110107,48.03170013),"
South Whidbey Special Services
Po Box 346
Langley, WA 98260

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("South Whidbey Special Services",'Langley=' + Langley.length); Oak_Harbor[Oak_Harbor.length] = createMarker(new GPoint(-122.64308929,48.29660034),"
Special Education
350 S. Oak Harbor St.
Oak Harbor, WA 98277

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Special Education",'Oak_Harbor=' + Oak_Harbor.length); Oak_Harbor[Oak_Harbor.length] = createMarker(new GPoint(-122.63559900,48.29807300),"
Toddler Learning Center
Po Box 633
Oak Harbor, WA 98277

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Toddler Learning Center",'Oak_Harbor=' + Oak_Harbor.length); Oak_Harbor[Oak_Harbor.length] = createMarker(new GPoint(-122.64308929,48.29660034),"
Transition School
200 Se Midway Blvd.
Oak Harbor, WA 98277

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Transition School",'Oak_Harbor=' + Oak_Harbor.length); Camano_Island[Camano_Island.length] = createMarker(new GPoint(-122.47174072,48.23419189),"
Utsalady Elementary School
608 Arrowhead
Camano Island, WA 98282

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Utsalady Elementary School",'Camano_Island=' + Camano_Island.length); Langley[Langley.length] = createMarker(new GPoint(-122.44110107,48.03170013),"
Whidbey Island Academy Shared School
Po Box 346
Langley, WA 98260

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Whidbey Island Academy Shared School",'Langley=' + Langley.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(Camano_Island); map.removeOverlays(Coupeville); map.removeOverlays(Langley); map.removeOverlays(Oak_Harbor); map.removeOverlays(_S_Oak_Harbor_St); 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(Langley);map.removeOverlays(Camano_Island); map.removeOverlays(Coupeville); map.removeOverlays(Langley); map.removeOverlays(Oak_Harbor); map.removeOverlays(_S_Oak_Harbor_St); map.addOverlays(Camano_Island); centerByArray(Camano_Island, false, false); cntMarker += Camano_Island.length; map.addOverlays(Coupeville); centerByArray(Coupeville, false, false); cntMarker += Coupeville.length; map.addOverlays(Langley); centerByArray(Langley, false, false); cntMarker += Langley.length; map.addOverlays(Oak_Harbor); centerByArray(Oak_Harbor, false, false); cntMarker += Oak_Harbor.length; map.addOverlays(_S_Oak_Harbor_St); centerByArray(_S_Oak_Harbor_St, false, false); cntMarker += _S_Oak_Harbor_St.length; centerByArray(Langley,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'); } }