function addMarkers() { mySelect = document.getElementById('selection'); Wenatchee = [];Leavenworth = [];Cashmere = [];Chelan = [];_Entiat_Way = [];Manson = [];Peshastin = [];Stehekin = [];mySelect.options[mySelect.options.length] = new Option("Cashmere schools",'all=Cashmere'); mySelect.options[mySelect.options.length] = new Option("Chelan schools",'all=Chelan'); mySelect.options[mySelect.options.length] = new Option("Leavenworth schools",'all=Leavenworth'); mySelect.options[mySelect.options.length] = new Option("Manson schools",'all=Manson'); mySelect.options[mySelect.options.length] = new Option("Peshastin schools",'all=Peshastin'); mySelect.options[mySelect.options.length] = new Option("Stehekin schools",'all=Stehekin'); mySelect.options[mySelect.options.length] = new Option("Wenatchee schools",'all=Wenatchee'); mySelect.options[mySelect.options.length] = new Option(" Entiat Way schools",'all=_Entiat_Way'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Wenatchee[Wenatchee.length] = createMarker(new GPoint(-120.30860138,47.40682220),"
Abraham Lincoln Elementary School
1224 Methow St.
Wenatchee, WA 98801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Abraham Lincoln Elementary School",'Wenatchee=' + Wenatchee.length); Leavenworth[Leavenworth.length] = createMarker(new GPoint(-120.66574097,47.76946259),"
Beaver Valley School
19265 Beaver Valley Rd
Leavenworth, WA 98826

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Beaver Valley School",'Leavenworth=' + Leavenworth.length); Leavenworth[Leavenworth.length] = createMarker(new GPoint(-120.65122986,47.60248566),"
Cascade High School
10190 Chumstick Hwy
Leavenworth, WA 98826

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cascade High School",'Leavenworth=' + Leavenworth.length); Cashmere[Cashmere.length] = createMarker(new GPoint(-120.47830963,47.51632309),"
Cashmere High School
329 Tigner Road
Cashmere, WA 98815

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cashmere High School",'Cashmere=' + Cashmere.length); Cashmere[Cashmere.length] = createMarker(new GPoint(-120.47797394,47.51687622),"
Cashmere Middle School
300 Tigner Road
Cashmere, WA 98815

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Cashmere Middle School",'Cashmere=' + Cashmere.length); Chelan[Chelan.length] = createMarker(new GPoint(-120.02737100,47.84736400),"
Chelan High School
Po Box 369
Chelan, WA 98816

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Chelan High School",'Chelan=' + Chelan.length); Chelan[Chelan.length] = createMarker(new GPoint(-120.01879883,47.83559036),"
Chelan Middle School
Po Box 369
Chelan, WA 98816

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Chelan Middle School",'Chelan=' + Chelan.length); Chelan[Chelan.length] = createMarker(new GPoint(-120.01379400,47.83983000),"
Chelan Prepatory High School
324 E Johnson
Chelan, WA 98816

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Chelan Prepatory High School",'Chelan=' + Chelan.length); Wenatchee[Wenatchee.length] = createMarker(new GPoint(-120.31987762,47.41847229),"
Columbia Elementary School
600 Alaska St
Wenatchee, WA 98801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Columbia Elementary School",'Wenatchee=' + Wenatchee.length); _Entiat_Way[_Entiat_Way.length] = createMarker(new GPoint(-120.22630310,47.66403580),"
Entiat Junior Senior High School
2650 Entiat Way
2650 Entiat Way, WA 98822

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Entiat Junior Senior High School",'_Entiat_Way=' + _Entiat_Way.length); Wenatchee[Wenatchee.length] = createMarker(new GPoint(-120.33772278,47.44253540),"
Foothills Middle School
1410 Maple St
Wenatchee, WA 98801

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Foothills Middle School",'Wenatchee=' + Wenatchee.length); Chelan[Chelan.length] = createMarker(new GPoint(-120.01379400,47.83983000),"
Glacier Valley High School
Po Box 369
Chelan, WA 98816

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Glacier Valley High School",'Chelan=' + Chelan.length); Chelan[Chelan.length] = createMarker(new GPoint(-120.05010223,47.86240005),"
Holden Village Community School
Hcoo Stop 2
Chelan, WA 98816

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Holden Village Community School",'Chelan=' + Chelan.length); Leavenworth[Leavenworth.length] = createMarker(new GPoint(-120.65777588,47.60107803),"
Icicle River Middle School
10195 Titus Rd
Leavenworth, WA 98826

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Icicle River Middle School",'Leavenworth=' + Leavenworth.length); Wenatchee[Wenatchee.length] = createMarker(new GPoint(-120.34640503,47.43233871),"
John Newbery Elementary School
850 Western
Wenatchee, WA 98801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("John Newbery Elementary School",'Wenatchee=' + Wenatchee.length); Wenatchee[Wenatchee.length] = createMarker(new GPoint(-120.31576538,47.42235565),"
Juvenile Transition School
316 Washington St
Wenatchee, WA 98801

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Juvenile Transition School",'Wenatchee=' + Wenatchee.length); Chelan[Chelan.length] = createMarker(new GPoint(-120.01418304,47.84056473),"
Lake Chelan Preschool
Po Box 369
Chelan, WA 98816

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lake Chelan Preschool",'Chelan=' + Chelan.length); Wenatchee[Wenatchee.length] = createMarker(new GPoint(-120.32999420,47.43747711),"
Lewis And Clark Elementary School
1130 Princeton
Wenatchee, WA 98801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lewis And Clark Elementary School",'Wenatchee=' + Wenatchee.length); Manson[Manson.length] = createMarker(new GPoint(-120.15362549,47.89030838),"
Manson Elementary School
Box A
Manson, WA 98831

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Manson Elementary School",'Manson=' + Manson.length); Manson[Manson.length] = createMarker(new GPoint(-10.00000000,10.00000000),"
Manson Junior Senior High School
Po Box A
Manson, WA 98831

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Manson Junior Senior High School",'Manson=' + Manson.length); Wenatchee[Wenatchee.length] = createMarker(new GPoint(-120.29878235,47.39807510),"
Mission View Elementary School
60 Terminal Avenue
Wenatchee, WA 98801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mission View Elementary School",'Wenatchee=' + Wenatchee.length); Chelan[Chelan.length] = createMarker(new GPoint(-120.01248169,47.83993530),"
Morgen Owings Elementary School
Po Box 369
Chelan, WA 98816

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Morgen Owings Elementary School",'Chelan=' + Chelan.length); Wenatchee[Wenatchee.length] = createMarker(new GPoint(-120.32553101,47.42633820),"
Orchard Middle School
1024 Orchard Ave
Wenatchee, WA 98801

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Orchard Middle School",'Wenatchee=' + Wenatchee.length); Leavenworth[Leavenworth.length] = createMarker(new GPoint(-120.66360474,47.59729385),"
Osborn Elementary School
225 Central Ave
Leavenworth, WA 98826

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Osborn Elementary School",'Leavenworth=' + Leavenworth.length); _Entiat_Way[_Entiat_Way.length] = createMarker(new GPoint(-120.22630310,47.66403580),"
Paul Rumburg Elementary School
2650 Entiat Way
2650 Entiat Way, WA 98822

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Paul Rumburg Elementary School",'_Entiat_Way=' + _Entiat_Way.length); Peshastin[Peshastin.length] = createMarker(new GPoint(-120.60182953,47.56866455),"
Peshastin Dryden Elementary School
P O Box 373
Peshastin, WA 98847

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Peshastin Dryden Elementary School",'Peshastin=' + Peshastin.length); Wenatchee[Wenatchee.length] = createMarker(new GPoint(-120.32274628,47.41173553),"
Pioneer Middle School
1620 Russell St
Wenatchee, WA 98801

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Pioneer Middle School",'Wenatchee=' + Wenatchee.length); Wenatchee[Wenatchee.length] = createMarker(new GPoint(-120.31145477,47.42090607),"
Skill Source High School
233 Chelan St
Wenatchee, WA 98801

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Skill Source High School",'Wenatchee=' + Wenatchee.length); Wenatchee[Wenatchee.length] = createMarker(new GPoint(-120.33554077,47.42238998),"
Special Education School
112 So. Elliott Street
Wenatchee, WA 98801

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Special Education School",'Wenatchee=' + Wenatchee.length); Stehekin[Stehekin.length] = createMarker(new GPoint(-120.65720367,48.30884933),"
Stehekin Elementary School
Po Box 37
Stehekin, WA 98852

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Stehekin Elementary School",'Stehekin=' + Stehekin.length); Wenatchee[Wenatchee.length] = createMarker(new GPoint(-120.34599304,47.47303009),"
Sunnyslope Elementary School
3109 School Street
Wenatchee, WA 98801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sunnyslope Elementary School",'Wenatchee=' + Wenatchee.length); Cashmere[Cashmere.length] = createMarker(new GPoint(-120.46967316,47.51742554),"
Vale Elementary School
101 Pioneer Avenue
Cashmere, WA 98815

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Vale Elementary School",'Cashmere=' + Cashmere.length); Wenatchee[Wenatchee.length] = createMarker(new GPoint(-120.31388855,47.42409515),"
Valley Academy Of Learning
11 N Chelan Avenue
Wenatchee, WA 98801

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Valley Academy Of Learning",'Wenatchee=' + Wenatchee.length); Wenatchee[Wenatchee.length] = createMarker(new GPoint(-120.32939148,47.46583939),"
Vocational Skills Center North Central
327 E Penny Road Ste D
Wenatchee, WA 98801

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Vocational Skills Center North Central",'Wenatchee=' + Wenatchee.length); Wenatchee[Wenatchee.length] = createMarker(new GPoint(-120.33552551,47.42256165),"
Washington Elementary School
1401 Washington St.
Wenatchee, WA 98801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Washington Elementary School",'Wenatchee=' + Wenatchee.length); Wenatchee[Wenatchee.length] = createMarker(new GPoint(-120.32743835,47.41149139),"
Wenatchee High School
1101 Millerdale Ave
Wenatchee, WA 98801

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wenatchee High School",'Wenatchee=' + Wenatchee.length); Wenatchee[Wenatchee.length] = createMarker(new GPoint(-120.33805847,47.43256378),"
Westside High School
1521 Ninth
Wenatchee, WA 98801

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Westside High School",'Wenatchee=' + Wenatchee.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(Cashmere); map.removeOverlays(Chelan); map.removeOverlays(Leavenworth); map.removeOverlays(Manson); map.removeOverlays(Peshastin); map.removeOverlays(Stehekin); map.removeOverlays(Wenatchee); map.removeOverlays(_Entiat_Way); 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(Wenatchee);map.removeOverlays(Cashmere); map.removeOverlays(Chelan); map.removeOverlays(Leavenworth); map.removeOverlays(Manson); map.removeOverlays(Peshastin); map.removeOverlays(Stehekin); map.removeOverlays(Wenatchee); map.removeOverlays(_Entiat_Way); map.addOverlays(Cashmere); centerByArray(Cashmere, false, false); cntMarker += Cashmere.length; map.addOverlays(Chelan); centerByArray(Chelan, false, false); cntMarker += Chelan.length; map.addOverlays(Leavenworth); centerByArray(Leavenworth, false, false); cntMarker += Leavenworth.length; map.addOverlays(Manson); centerByArray(Manson, false, false); cntMarker += Manson.length; map.addOverlays(Peshastin); centerByArray(Peshastin, false, false); cntMarker += Peshastin.length; map.addOverlays(Stehekin); centerByArray(Stehekin, false, false); cntMarker += Stehekin.length; map.addOverlays(Wenatchee); centerByArray(Wenatchee, false, false); cntMarker += Wenatchee.length; map.addOverlays(_Entiat_Way); centerByArray(_Entiat_Way, false, false); cntMarker += _Entiat_Way.length; centerByArray(Wenatchee,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'); } }