function addMarkers() { mySelect = document.getElementById('selection'); Connell = [];Pasco = [];Kahlotus = [];mySelect.options[mySelect.options.length] = new Option("Connell schools",'all=Connell'); mySelect.options[mySelect.options.length] = new Option("Kahlotus schools",'all=Kahlotus'); mySelect.options[mySelect.options.length] = new Option("Pasco schools",'all=Pasco'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Connell[Connell.length] = createMarker(new GPoint(-119.15296936,46.59487152),"
Basin City Elementary School
Po Box 829
Connell, WA 99326

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Basin City Elementary School",'Connell=' + Connell.length); Connell[Connell.length] = createMarker(new GPoint(-118.87079620,46.67269897),"
Camp Outlook
Po Box 829
Connell, WA 99326

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Camp Outlook",'Connell=' + Connell.length); Connell[Connell.length] = createMarker(new GPoint(-118.87079620,46.67269897),"
Connell Elementary School
Po Box 829
Connell, WA 99326

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Connell Elementary School",'Connell=' + Connell.length); Connell[Connell.length] = createMarker(new GPoint(-118.87079620,46.67269897),"
Connell High School
Po Box 829
Connell, WA 99326

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Connell High School",'Connell=' + Connell.length); Pasco[Pasco.length] = createMarker(new GPoint(-119.19719696,46.43057632),"
Edwin Markham Elementary School
4031 Elm Road
Pasco, WA 99301

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Edwin Markham Elementary School",'Pasco=' + Pasco.length); Pasco[Pasco.length] = createMarker(new GPoint(-119.07298279,46.24473572),"
Ellen Ochoa Middle School
1801 E Sheppard St
Pasco, WA 99301

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Ellen Ochoa Middle School",'Pasco=' + Pasco.length); Pasco[Pasco.length] = createMarker(new GPoint(-119.11057281,46.23826218),"
Emerson Elementary School
1616 W Octave St
Pasco, WA 99301

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Emerson Elementary School",'Pasco=' + Pasco.length); Pasco[Pasco.length] = createMarker(new GPoint(-119.14411926,46.26786804),"
James Mcgee Elementary School
4601 N Horizon Drive
Pasco, WA 99301

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("James Mcgee Elementary School",'Pasco=' + Pasco.length); Kahlotus[Kahlotus.length] = createMarker(new GPoint(-118.55670166,46.64153671),"
Kahlotus Elementary & High School
Po Box 69
Kahlotus, WA 99335

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kahlotus Elementary & High School",'Kahlotus=' + Kahlotus.length); Pasco[Pasco.length] = createMarker(new GPoint(-119.10227966,46.23048019),"
Longfellow Elementary School
301 North 10th Avenue
Pasco, WA 99301

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Longfellow Elementary School",'Pasco=' + Pasco.length); Pasco[Pasco.length] = createMarker(new GPoint(-119.14320374,46.24444580),"
Mark Twain Elementary School
1801 N Road 40
Pasco, WA 99301

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mark Twain Elementary School",'Pasco=' + Pasco.length); Pasco[Pasco.length] = createMarker(new GPoint(-119.20082000,46.25624200),"
Maya Angelou Elementary School
6001 N Road 84
Pasco, WA 99301

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Maya Angelou Elementary School",'Pasco=' + Pasco.length); Pasco[Pasco.length] = createMarker(new GPoint(-119.20610046,46.25372696),"
Mcloughlin Middle School
2803 N Road 88
Pasco, WA 99301

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mcloughlin Middle School",'Pasco=' + Pasco.length); Connell[Connell.length] = createMarker(new GPoint(-119.00186157,46.57396317),"
Mesa Elementary School
Po Box 829
Connell, WA 99326

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mesa Elementary School",'Connell=' + Connell.length); Pasco[Pasco.length] = createMarker(new GPoint(-119.12908173,46.25338745),"
New Horizons High School
3110 Argent Road
Pasco, WA 99301

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Horizons High School",'Pasco=' + Pasco.length); Connell[Connell.length] = createMarker(new GPoint(-118.87079620,46.67269897),"
Palouse Junction High School
Po Box 829
Connell, WA 99326

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Palouse Junction High School",'Connell=' + Connell.length); Pasco[Pasco.length] = createMarker(new GPoint(-118.57599640,46.53578186),"
Pasco Early Childhood Elementary School
1215 W Lewis
Pasco, WA 99301

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pasco Early Childhood Elementary School",'Pasco=' + Pasco.length); Pasco[Pasco.length] = createMarker(new GPoint(-119.10279846,46.23778915),"
Pasco Senior High School
1108 N 10th Avenue
Pasco, WA 99301

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pasco Senior High School",'Pasco=' + Pasco.length); Pasco[Pasco.length] = createMarker(new GPoint(-119.11959076,46.24541855),"
Robert Frost Elementary School
1915 North 22nd Avenue
Pasco, WA 99301

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Robert Frost Elementary School",'Pasco=' + Pasco.length); Connell[Connell.length] = createMarker(new GPoint(-118.87079620,46.67269897),"
Robert L Olds Junior High School
Po Box 829
Connell, WA 99326

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Robert L Olds Junior High School",'Connell=' + Connell.length); Pasco[Pasco.length] = createMarker(new GPoint(-119.12249756,46.23456955),"
Rowena Chess Elementary School
715 N 24th Ave
Pasco, WA 99301

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rowena Chess Elementary School",'Pasco=' + Pasco.length); Pasco[Pasco.length] = createMarker(new GPoint(-119.20079803,46.25113297),"
Ruth Livingston Elementary School
2515 Road 84
Pasco, WA 99301

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ruth Livingston Elementary School",'Pasco=' + Pasco.length); Connell[Connell.length] = createMarker(new GPoint(-118.87079620,46.67269897),"
Special Education Elementary School
Po Box 829
Connell, WA 99326

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Special Education Elementary School",'Connell=' + Connell.length); Pasco[Pasco.length] = createMarker(new GPoint(-118.71759033,46.44226837),"
Star Elementary School
24180 Pasco-kahlotus Rd.
Pasco, WA 99301

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Star Elementary School",'Pasco=' + Pasco.length); Pasco[Pasco.length] = createMarker(new GPoint(-119.12027740,46.23862457),"
Stevens Middle School
1120 N 22nd Avenue
Pasco, WA 99301

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Stevens Middle School",'Pasco=' + Pasco.length); Pasco[Pasco.length] = createMarker(new GPoint(-119.07590600,46.23370800),"
Virgie Robinson Elementary School
125 S. Wehe Ave
Pasco, WA 99301

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Virgie Robinson Elementary School",'Pasco=' + Pasco.length); Pasco[Pasco.length] = createMarker(new GPoint(-119.07599640,46.23968506),"
Whittier Elementary School
616 N Wehe Avenue
Pasco, WA 99301

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