function addMarkers() { mySelect = document.getElementById('selection'); Hermiston = [];Athena = [];Weston = [];Milton_freewater = [];Umatilla = [];Echo = [];Pendleton = [];Helix = [];Pilot_Rock = [];Stanfield = [];Ukiah = [];mySelect.options[mySelect.options.length] = new Option("Athena schools",'all=Athena'); mySelect.options[mySelect.options.length] = new Option("Echo schools",'all=Echo'); mySelect.options[mySelect.options.length] = new Option("Helix schools",'all=Helix'); mySelect.options[mySelect.options.length] = new Option("Hermiston schools",'all=Hermiston'); mySelect.options[mySelect.options.length] = new Option("Milton freewater schools",'all=Milton_freewater'); mySelect.options[mySelect.options.length] = new Option("Pendleton schools",'all=Pendleton'); mySelect.options[mySelect.options.length] = new Option("Pilot Rock schools",'all=Pilot_Rock'); mySelect.options[mySelect.options.length] = new Option("Stanfield schools",'all=Stanfield'); mySelect.options[mySelect.options.length] = new Option("Ukiah schools",'all=Ukiah'); mySelect.options[mySelect.options.length] = new Option("Umatilla schools",'all=Umatilla'); mySelect.options[mySelect.options.length] = new Option("Weston schools",'all=Weston'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Hermiston[Hermiston.length] = createMarker(new GPoint(-119.28755188,45.84243774),"
Armand Larive Middle School
199 E Ridgeway Ave
Hermiston, OR 97838

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Armand Larive Middle School",'Hermiston=' + Hermiston.length); Athena[Athena.length] = createMarker(new GPoint(-118.52790070,45.86780167),"
Athena Elementary School
375 S 5th St
Athena, OR 97813

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Athena Elementary School",'Athena=' + Athena.length); Weston[Weston.length] = createMarker(new GPoint(-118.42511800,45.80933500),"
Athena-weston Middle School
Po Box 188
Weston, OR 97886

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Athena-weston Middle School",'Weston=' + Weston.length); Milton_freewater[Milton_freewater.length] = createMarker(new GPoint(-118.39068604,45.93313599),"
Central Middle School
306 Sw 2nd Ave
Milton-freewater, OR 97862

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Central Middle School",'Milton_freewater=' + Milton_freewater.length); Umatilla[Umatilla.length] = createMarker(new GPoint(-119.33435059,45.91726303),"
Clara Brownell Middle School
1460 7th St
Umatilla, OR 97882

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Clara Brownell Middle School",'Umatilla=' + Umatilla.length); Hermiston[Hermiston.length] = createMarker(new GPoint(-119.30570221,45.82942963),"
Desert View Elementary School
1225 Sw 9th
Hermiston, OR 97838

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Desert View Elementary School",'Hermiston=' + Hermiston.length); Echo[Echo.length] = createMarker(new GPoint(-119.19060516,45.74026489),"
Echo School
600 E Gerone St
Echo, OR 97826

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Echo School",'Echo=' + Echo.length); Milton_freewater[Milton_freewater.length] = createMarker(new GPoint(-118.40161896,45.98016357),"
Ferndale Elementary School
53445 W Ferndale Rd
Milton-freewater, OR 97862

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ferndale Elementary School",'Milton_freewater=' + Milton_freewater.length); Milton_freewater[Milton_freewater.length] = createMarker(new GPoint(-118.39801025,45.94376373),"
Freewater Elementary School
17 Nw 8th Ave
Milton-freewater, OR 97862

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Freewater Elementary School",'Milton_freewater=' + Milton_freewater.length); Milton_freewater[Milton_freewater.length] = createMarker(new GPoint(-118.37827301,45.92173767),"
Grove Elementary School
129 Se 15th St
Milton-freewater, OR 97862

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Grove Elementary School",'Milton_freewater=' + Milton_freewater.length); Pendleton[Pendleton.length] = createMarker(new GPoint(-118.70120239,45.62490082),"
Hawthorne Elementary School
1308 Sw Emigrant Ave
Pendleton, OR 97801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hawthorne Elementary School",'Pendleton=' + Pendleton.length); Helix[Helix.length] = createMarker(new GPoint(-118.72949982,45.89509964),"
Helix School
Po Box 398
Helix, OR 97835

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Helix School",'Helix=' + Helix.length); Hermiston[Hermiston.length] = createMarker(new GPoint(-119.28831482,45.83634567),"
Hermiston High School
600 S 1st St
Hermiston, OR 97838

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hermiston High School",'Hermiston=' + Hermiston.length); Hermiston[Hermiston.length] = createMarker(new GPoint(-119.26969910,45.83753204),"
Highland Hills Elementary School
450 Se 10th St
Hermiston, OR 97838

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Highland Hills Elementary School",'Hermiston=' + Hermiston.length); Pendleton[Pendleton.length] = createMarker(new GPoint(-118.79759216,45.67269135),"
Lincoln Primary School
107 Nw 10th St
Pendleton, OR 97801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Primary School",'Pendleton=' + Pendleton.length); Pendleton[Pendleton.length] = createMarker(new GPoint(-118.82472229,45.64656830),"
Mckay Creek Elementary School
1539 Sw 44th St
Pendleton, OR 97801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mckay Creek Elementary School",'Pendleton=' + Pendleton.length); Milton_freewater[Milton_freewater.length] = createMarker(new GPoint(-118.39076996,45.93536758),"
Mcloughlin High School
120 S Main St
Milton-freewater, OR 97862

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mcloughlin High School",'Milton_freewater=' + Milton_freewater.length); Umatilla[Umatilla.length] = createMarker(new GPoint(-119.34621429,45.91084671),"
Mcnary Heights Elementary School
120 Columbia Ave
Umatilla, OR 97882

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mcnary Heights Elementary School",'Umatilla=' + Umatilla.length); Pendleton[Pendleton.length] = createMarker(new GPoint(-118.81900000,45.67356400),"
Nixyaawii Community School
Po Box 638
Pendleton, OR 97801

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Nixyaawii Community School",'Pendleton=' + Pendleton.length); Pendleton[Pendleton.length] = createMarker(new GPoint(-118.80481720,45.67362213),"
Pendleton High School
1800 Nw Carden Ave
Pendleton, OR 97801

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pendleton High School",'Pendleton=' + Pendleton.length); Pilot_Rock[Pilot_Rock.length] = createMarker(new GPoint(-118.86630249,45.37960052),"
Pilot Rock Elementary School
Po Box A
Pilot Rock, OR 97868

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pilot Rock Elementary School",'Pilot_Rock=' + Pilot_Rock.length); Pilot_Rock[Pilot_Rock.length] = createMarker(new GPoint(-118.86630249,45.37960052),"
Pilot Rock High School
Po Box Bb
Pilot Rock, OR 97868

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pilot Rock High School",'Pilot_Rock=' + Pilot_Rock.length); Hermiston[Hermiston.length] = createMarker(new GPoint(-119.29927063,45.84413910),"
Rocky Heights Elementary School
650 W Standard Ave
Hermiston, OR 97838

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rocky Heights Elementary School",'Hermiston=' + Hermiston.length); Hermiston[Hermiston.length] = createMarker(new GPoint(-119.26920319,45.84500122),"
Sandstone Middle School
400 Ne 10th St
Hermiston, OR 97838

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Sandstone Middle School",'Hermiston=' + Hermiston.length); Pendleton[Pendleton.length] = createMarker(new GPoint(-118.81519318,45.65406418),"
Sherwood Heights Elementary School
3111 Sw Marshall Ave
Pendleton, OR 97801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sherwood Heights Elementary School",'Pendleton=' + Pendleton.length); Stanfield[Stanfield.length] = createMarker(new GPoint(-119.22108459,45.78904343),"
Stanfield Elementary School
1120 N Main St
Stanfield, OR 97875

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Stanfield Elementary School",'Stanfield=' + Stanfield.length); Stanfield[Stanfield.length] = createMarker(new GPoint(-119.22108459,45.78904343),"
Stanfield Secondary School
1120 N Main St
Stanfield, OR 97875

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Stanfield Secondary School",'Stanfield=' + Stanfield.length); Pendleton[Pendleton.length] = createMarker(new GPoint(-118.78539276,45.65092087),"
Sunridge Middle School
700 Sw Runnion Ave
Pendleton, OR 97801

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Sunridge Middle School",'Pendleton=' + Pendleton.length); Hermiston[Hermiston.length] = createMarker(new GPoint(-119.28670502,45.84446335),"
Sunset Elementary School
300 E Catherine Ave
Hermiston, OR 97838

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sunset Elementary School",'Hermiston=' + Hermiston.length); Ukiah[Ukiah.length] = createMarker(new GPoint(-118.86750031,45.14030075),"
Ukiah School
Po Box 218
Ukiah, OR 97880

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ukiah School",'Ukiah=' + Ukiah.length); Umatilla[Umatilla.length] = createMarker(new GPoint(-119.33435059,45.91726303),"
Umatilla High School
1460 7th St
Umatilla, OR 97882

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Umatilla High School",'Umatilla=' + Umatilla.length); Pendleton[Pendleton.length] = createMarker(new GPoint(-118.77431488,45.67534637),"
Washington Elementary School
1205 Se Byers Ave
Pendleton, OR 97801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Washington Elementary School",'Pendleton=' + Pendleton.length); Pendleton[Pendleton.length] = createMarker(new GPoint(-118.80300903,45.67673874),"
West Hills Intermediate
1700 Nw 15th Dr
Pendleton, OR 97801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West Hills Intermediate",'Pendleton=' + Pendleton.length); Hermiston[Hermiston.length] = createMarker(new GPoint(-119.30039978,45.83688354),"
West Park Elementary School
555 Sw 7th St
Hermiston, OR 97838

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West Park Elementary School",'Hermiston=' + Hermiston.length); Weston[Weston.length] = createMarker(new GPoint(-118.28209686,45.79639816),"
Weston Elementary School
Po Box 188
Weston, OR 97886

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Weston Elementary School",'Weston=' + Weston.length); Athena[Athena.length] = createMarker(new GPoint(-118.52790070,45.86780167),"
Weston-mcewen High School
540 E Main St
Athena, OR 97813

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Weston-mcewen High School",'Athena=' + Athena.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(Athena); map.removeOverlays(Echo); map.removeOverlays(Helix); map.removeOverlays(Hermiston); map.removeOverlays(Milton_freewater); map.removeOverlays(Pendleton); map.removeOverlays(Pilot_Rock); map.removeOverlays(Stanfield); map.removeOverlays(Ukiah); map.removeOverlays(Umatilla); map.removeOverlays(Weston); 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(Hermiston);map.removeOverlays(Athena); map.removeOverlays(Echo); map.removeOverlays(Helix); map.removeOverlays(Hermiston); map.removeOverlays(Milton_freewater); map.removeOverlays(Pendleton); map.removeOverlays(Pilot_Rock); map.removeOverlays(Stanfield); map.removeOverlays(Ukiah); map.removeOverlays(Umatilla); map.removeOverlays(Weston); map.addOverlays(Athena); centerByArray(Athena, false, false); cntMarker += Athena.length; map.addOverlays(Echo); centerByArray(Echo, false, false); cntMarker += Echo.length; map.addOverlays(Helix); centerByArray(Helix, false, false); cntMarker += Helix.length; map.addOverlays(Hermiston); centerByArray(Hermiston, false, false); cntMarker += Hermiston.length; map.addOverlays(Milton_freewater); centerByArray(Milton_freewater, false, false); cntMarker += Milton_freewater.length; map.addOverlays(Pendleton); centerByArray(Pendleton, false, false); cntMarker += Pendleton.length; map.addOverlays(Pilot_Rock); centerByArray(Pilot_Rock, false, false); cntMarker += Pilot_Rock.length; map.addOverlays(Stanfield); centerByArray(Stanfield, false, false); cntMarker += Stanfield.length; map.addOverlays(Ukiah); centerByArray(Ukiah, false, false); cntMarker += Ukiah.length; map.addOverlays(Umatilla); centerByArray(Umatilla, false, false); cntMarker += Umatilla.length; map.addOverlays(Weston); centerByArray(Weston, false, false); cntMarker += Weston.length; centerByArray(Hermiston,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'); } }