function addMarkers(){ mySelect = document.getElementById('selection'); Toppenish = [];Sunnyside = [];Zillah = [];Yakima = [];Grandview = [];Harrah = [];Naches = [];Selah = [];mySelect.options[mySelect.options.length] = new Option("Grandview schools",'all=Grandview'); mySelect.options[mySelect.options.length] = new Option("Harrah schools",'all=Harrah'); mySelect.options[mySelect.options.length] = new Option("Naches schools",'all=Naches'); mySelect.options[mySelect.options.length] = new Option("Selah schools",'all=Selah'); mySelect.options[mySelect.options.length] = new Option("Sunnyside schools",'all=Sunnyside'); mySelect.options[mySelect.options.length] = new Option("Toppenish schools",'all=Toppenish'); mySelect.options[mySelect.options.length] = new Option("Yakima schools",'all=Yakima'); mySelect.options[mySelect.options.length] = new Option("Zillah schools",'all=Zillah'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Toppenish[Toppenish.length] = createMarker(new GPoint(-120.30595900,46.38060000),"
Best Self-lincoln Elementary School
309 North Alder Street
Toppenish, WA 98948
Co-ed school, K-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Best Self-lincoln Elementary School",'Toppenish=' + Toppenish.length); Sunnyside[Sunnyside.length] = createMarker(new GPoint(-120.00320000,46.32830000),"
Calvary Lutheran School
Po Box 507
Sunnyside, WA 98944
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Calvary Lutheran School",'Sunnyside=' + Sunnyside.length); Zillah[Zillah.length] = createMarker(new GPoint(-120.26410000,46.42480000),"
Christian Worship Center Academy
Po Box 747
Zillah, WA 98953
Co-ed school, PK-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Christian Worship Center Academy",'Zillah=' + Zillah.length); Yakima[Yakima.length] = createMarker(new GPoint(-120.51579900,46.58315500),"
Grace Lutheran School
1207 S 7th Avenue
Yakima, WA 98902
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Grace Lutheran School",'Yakima=' + Yakima.length); Grandview[Grandview.length] = createMarker(new GPoint(-119.89469700,46.25706300),"
Grandview Adventist Jr. Academy
106 North Elm Street
Grandview, WA 98930
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Grandview Adventist Jr. Academy",'Grandview=' + Grandview.length); Harrah[Harrah.length] = createMarker(new GPoint(-120.61120000,46.40180000),"
Harrah Community Christian School
Po Box 68
Harrah, WA 98933
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Harrah Community Christian School",'Harrah=' + Harrah.length); Yakima[Yakima.length] = createMarker(new GPoint(-120.56712400,46.60572200),"
Montessori Society O
511 N 44th Avenue
Yakima, WA 98908
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Montessori Society O",'Yakima=' + Yakima.length); Naches[Naches.length] = createMarker(new GPoint(-120.92119600,46.80211000),"
Nile Christian School/hope Academy
370 Flying H Loop
Naches, WA 98937
Co-ed school, 4-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Nile Christian School/hope Academy",'Naches=' + Naches.length); Yakima[Yakima.length] = createMarker(new GPoint(-120.59405300,46.60023500),"
Oakridge Montessori School
6403 Summitview Avenue
Yakima, WA 98908
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oakridge Montessori School",'Yakima=' + Yakima.length); Yakima[Yakima.length] = createMarker(new GPoint(-120.45913800,46.59573700),"
Riverside Christian School
721 Keys Road
Yakima, WA 98901
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Riverside Christian School",'Yakima=' + Yakima.length); Sunnyside[Sunnyside.length] = createMarker(new GPoint(-120.01319800,46.31906500),"
St. Joseph School-sunnyside
907 South Sixth Street
Sunnyside, WA 98944
Co-ed school, KG-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Joseph School-sunnyside",'Sunnyside=' + Sunnyside.length); Yakima[Yakima.length] = createMarker(new GPoint(-120.52530500,46.59606300),"
St. Paul Cathedral School
1214 West Chestnut Avenue
Yakima, WA 98902
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Paul Cathedral School",'Yakima=' + Yakima.length); Selah[Selah.length] = createMarker(new GPoint(-120.54689900,46.69115900),"
Selah Bible Baptist School
20 Tibbling Rd
Selah, WA 98942
Co-ed school, KG-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Selah Bible Baptist School",'Selah=' + Selah.length); Yakima[Yakima.length] = createMarker(new GPoint(-120.51846400,46.59090100),"
St John Of Kronstadt Orthodox Christian School
704 South 9th Avenue
Yakima, WA 98902
Co-ed school, K-3
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St John Of Kronstadt Orthodox Christian School",'Yakima=' + Yakima.length); Yakima[Yakima.length] = createMarker(new GPoint(-120.50306300,46.60590700),"
St Joseph-marquette Catholic School
202 N 4th Street
Yakima, WA 98901
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Joseph-marquette Catholic School",'Yakima=' + Yakima.length); Yakima[Yakima.length] = createMarker(new GPoint(-86.80710000,33.51670000),"
St Paul Cathedral School
1214 West Chestnut Avenue
Yakima, WA 98902
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Paul Cathedral School",'Yakima=' + Yakima.length); Sunnyside[Sunnyside.length] = createMarker(new GPoint(-120.00969800,46.33086300),"
Sunnyside Christian High School
1820 Sheller Road
Sunnyside, WA 98944
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sunnyside Christian High School",'Sunnyside=' + Sunnyside.length); Sunnyside[Sunnyside.length] = createMarker(new GPoint(-120.00942400,46.33097500),"
Sunnyside Christian School
811 North Avenue
Sunnyside, WA 98944
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sunnyside Christian School",'Sunnyside=' + Sunnyside.length); Sunnyside[Sunnyside.length] = createMarker(new GPoint(-120.00069200,46.32086300),"
Trinity Reformed Christian School
1505 Grant Avenue
Sunnyside, WA 98944
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Trinity Reformed Christian School",'Sunnyside=' + Sunnyside.length); Yakima[Yakima.length] = createMarker(new GPoint(-120.57627900,46.61779700),"
Yakima Adventist Christian School
1200 City Reservoir Road
Yakima, WA 98908
Co-ed school, K-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Yakima Adventist Christian School",'Yakima=' + Yakima.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,11); /* 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/////1/' + showArray); map.removeOverlays(Grandview); map.removeOverlays(Harrah); map.removeOverlays(Naches); map.removeOverlays(Selah); map.removeOverlays(Sunnyside); map.removeOverlays(Toppenish); map.removeOverlays(Yakima); map.removeOverlays(Zillah); 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(Toppenish);map.removeOverlays(Grandview); map.removeOverlays(Harrah); map.removeOverlays(Naches); map.removeOverlays(Selah); map.removeOverlays(Sunnyside); map.removeOverlays(Toppenish); map.removeOverlays(Yakima); map.removeOverlays(Zillah); map.addOverlays(Grandview); centerByArray(Grandview, false, false); cntMarker += Grandview.length; map.addOverlays(Harrah); centerByArray(Harrah, false, false); cntMarker += Harrah.length; map.addOverlays(Naches); centerByArray(Naches, false, false); cntMarker += Naches.length; map.addOverlays(Selah); centerByArray(Selah, false, false); cntMarker += Selah.length; map.addOverlays(Sunnyside); centerByArray(Sunnyside, false, false); cntMarker += Sunnyside.length; map.addOverlays(Toppenish); centerByArray(Toppenish, false, false); cntMarker += Toppenish.length; map.addOverlays(Yakima); centerByArray(Yakima, false, false); cntMarker += Yakima.length; map.addOverlays(Zillah); centerByArray(Zillah, false, false); cntMarker += Zillah.length; centerByArray(Toppenish,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'); //window.open('/map.php?type=1&schools=&school_level=1&radius=&zipcode=&school_type_search=&school_type_code='); } } function createMarker(point, label, icon) { var marker = new GMarker(point, icon); var html = label; GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); return marker; }