function addMarkers() { mySelect = document.getElementById('selection'); Ash_Fork = [];Avondale = [];Aguila = [];Ajo = [];Alpine = [];Anthem = [];Apache_Junction = [];Arlington = [];Avondalewwwtuhsdorg = [];mySelect.options[mySelect.options.length] = new Option("Aguila schools",'all=Aguila'); mySelect.options[mySelect.options.length] = new Option("Ajo schools",'all=Ajo'); mySelect.options[mySelect.options.length] = new Option("Alpine schools",'all=Alpine'); mySelect.options[mySelect.options.length] = new Option("Anthem schools",'all=Anthem'); mySelect.options[mySelect.options.length] = new Option("Apache Junction schools",'all=Apache_Junction'); mySelect.options[mySelect.options.length] = new Option("Arlington schools",'all=Arlington'); mySelect.options[mySelect.options.length] = new Option("Ash Fork schools",'all=Ash_Fork'); mySelect.options[mySelect.options.length] = new Option("Avondale schools",'all=Avondale'); mySelect.options[mySelect.options.length] = new Option("Avondalewwwtuhsdorg schools",'all=Avondalewwwtuhsdorg'); Ash_Fork[Ash_Fork.length] = createMarker(new GPoint(-112.55339813,35.20650101),"
Academy Of Hope
47117 1st Street
Ash Fork, AZ 86320

[ View School Profile ]
",iconGr); Ash_Fork[Ash_Fork.length] = createMarker(new GPoint(-112.63732147,35.20240021),"
Academy Of Hope, The
M
Ash Fork, AZ 86320

[ View School Profile ]
",iconGr); Avondale[Avondale.length] = createMarker(new GPoint(-112.34425354,33.43913651),"
Agua Fria High School
530 E. Riley Dr.
Avondale, AZ 85323

[ View School Profile ]
",iconGr); Aguila[Aguila.length] = createMarker(new GPoint(-113.17819977,33.92020035),"
Aguila Elementary School
P.o. Box 218
Aguila, AZ 85320

[ View School Profile ]
",iconRd); Ajo[Ajo.length] = createMarker(new GPoint(-112.87220800,32.38552000),"
Ajo Elementary School
P.o. Box 68
Ajo, AZ 85321

[ View School Profile ]
",iconRd); Ajo[Ajo.length] = createMarker(new GPoint(-112.86288100,32.37298100),"
Ajo High School
P.o. Box 68
Ajo, AZ 85321

[ View School Profile ]
",iconGr); Alpine[Alpine.length] = createMarker(new GPoint(-109.13289642,33.82939911),"
Alpine Elementary School
Po Box 170
Alpine, AZ 85920

[ View School Profile ]
",iconRd); Anthem[Anthem.length] = createMarker(new GPoint(-112.13057709,33.85673523),"
Anthem School
41020 N. Freedom Way
Anthem, AZ 85086

[ View School Profile ]
",iconRd); Apache_Junction[Apache_Junction.length] = createMarker(new GPoint(-111.56298828,33.39316177),"
Apache Junction Alternative Education Center
1575 W. Southern
Apache Junction, AZ 85220

[ View School Profile ]
",iconBl); Apache_Junction[Apache_Junction.length] = createMarker(new GPoint(-111.56235400,33.42994000),"
Apache Junction High School
2525 S Ironwood Rd
Apache Junction, AZ 85220

[ View School Profile ]
",iconGr); Apache_Junction[Apache_Junction.length] = createMarker(new GPoint(-111.55624390,33.41496277),"
Apache Trail High School
945 West Apache Trail
Apache Junction, AZ 85220

[ View School Profile ]
",iconGr); Apache_Junction[Apache_Junction.length] = createMarker(new GPoint(-111.55624390,33.41496277),"
Apache Trail High School (charter)
945 W. Apache Trail
Apache Junction, AZ 85220

[ View School Profile ]
",iconGr); Apache_Junction[Apache_Junction.length] = createMarker(new GPoint(-111.55624390,33.41496277),"
Apex Academy
945 West Apache Trail
Apache Junction, AZ 85220

[ View School Profile ]
",iconRd); Anthem[Anthem.length] = createMarker(new GPoint(-10.00000000,10.00000000),"
Arizona Montessori Charter School At Anthem
42302 N. Vision Way
Anthem, AZ 85086

[ View School Profile ]
",iconRd); Arlington[Arlington.length] = createMarker(new GPoint(-112.78083801,33.29801178),"
Arlington Elementary School
9410 S. 355th Ave
Arlington, AZ 85322

[ View School Profile ]
",iconRd); Ash_Fork[Ash_Fork.length] = createMarker(new GPoint(-112.55339813,35.20650101),"
Ash Fork Elementary School
P.o. Box 247
Ash Fork, AZ 86320

[ View School Profile ]
",iconRd); Ash_Fork[Ash_Fork.length] = createMarker(new GPoint(-112.55339813,35.20650101),"
Ash Fork High School
P.o. Box 247
Ash Fork, AZ 86320

[ View School Profile ]
",iconGr); Ash_Fork[Ash_Fork.length] = createMarker(new GPoint(-112.55339813,35.20650101),"
Ash Fork Middle School
P O Box 247
Ash Fork, AZ 86320

[ View School Profile ]
",iconBl); Apache_Junction[Apache_Junction.length] = createMarker(new GPoint(-111.54519653,33.39194107),"
Avalon Elementary At San Marcos
1045 S. San Marcos
Apache Junction, AZ 85220

[ View School Profile ]
",iconRd); Avondale[Avondale.length] = createMarker(new GPoint(-112.35260773,33.43465042),"
Avondale Elementary School
45 S. Third Ave.
Avondale, AZ 85323

[ View School Profile ]
",iconRd); Avondale[Avondale.length] = createMarker(new GPoint(-112.34986115,33.44805527),"
Avondale Middle School
1406 N. Central Ave.
Avondale, AZ 85323

[ View School Profile ]
",iconBl); Avondale[Avondale.length] = createMarker(new GPoint(-112.31719971,33.45500183),"
Avondale Pre-school
235 W. Western Ave
Avondale, AZ 85323

[ View School Profile ]
",iconRd); Anthem[Anthem.length] = createMarker(new GPoint(-10.00000000,10.00000000),"
Boulder Creek High School
40404 Gavilan Peak Parkway
Anthem, AZ 85086

[ View School Profile ]
",iconGr); Avondale[Avondale.length] = createMarker(new GPoint(-112.30162048,33.48178101),"
Bradley Academy Of Excellence
200 North Dysart Road
Avondale, AZ 85323

[ View School Profile ]
",iconRd); Avondale[Avondale.length] = createMarker(new GPoint(-112.31044769,33.47116470),"
Canyon Breeze Elementary School
11675 W. Encant Blvd
Avondale, AZ 85323

[ View School Profile ]
",iconRd); Avondale[Avondale.length] = createMarker(new GPoint(-112.31186676,33.44311142),"
Collier Elementary School
350 S. 118th Ave.
Avondale, AZ 85323

[ View School Profile ]
",iconRd); Apache_Junction[Apache_Junction.length] = createMarker(new GPoint(-111.56323242,33.39212036),"
Desert Shadows Middle School
801 West Southern Avenue
Apache Junction, AZ 85220

[ View School Profile ]
",iconBl); Apache_Junction[Apache_Junction.length] = createMarker(new GPoint(-111.54611900,33.42279500),"
Desert Vista Elementary School
3701 E Broadway
Apache Junction, AZ 85219

[ View School Profile ]
",iconRd); Anthem[Anthem.length] = createMarker(new GPoint(-10.00000000,10.00000000),"
Diamond Canyon Elementary School
40004 Liberty Bell Way
Anthem, AZ 85086

[ View School Profile ]
",iconRd); Avondale[Avondale.length] = createMarker(new GPoint(-112.34986115,33.44013214),"
Estrella High School
510 N. Central Avenue
Avondale, AZ 85323

[ View School Profile ]
",iconGr); Avondale[Avondale.length] = createMarker(new GPoint(-112.34968567,33.43983459),"
Estrella High School (charter)
510 N. Central
Avondale, AZ 85323

[ View School Profile ]
",iconGr); Apache_Junction[Apache_Junction.length] = createMarker(new GPoint(-111.59703827,33.41496277),"
Excalibur Charter School
10839 E. Apache Trail 113
Apache Junction, AZ 85220

[ View School Profile ]
",iconGr); Apache_Junction[Apache_Junction.length] = createMarker(new GPoint(-111.57240295,33.41659927),"
Excalibur Charter School-camelot
10839 E. Apache Trail 113
Apache Junction, AZ 85220

[ View School Profile ]
",iconRd); Apache_Junction[Apache_Junction.length] = createMarker(new GPoint(-111.50525665,33.40776443),"
Four Peaks Elementary School
1755 N Idaho Road
Apache Junction, AZ 85219

[ View School Profile ]
",iconRd); Avondale[Avondale.length] = createMarker(new GPoint(-112.29373932,33.48876953),"
Garden Lakes Elementary School
10825 W. Garden Lakes Parkway
Avondale, AZ 85323

[ View School Profile ]
",iconRd); Anthem[Anthem.length] = createMarker(new GPoint(-112.14881897,33.82289886),"
Gavilan Peak Elementary School
2701 W. Memorial Dr.
Anthem, AZ 85086

[ View School Profile ]
",iconRd); Apache_Junction[Apache_Junction.length] = createMarker(new GPoint(-111.43806458,33.36201096),"
Gold Canyon Elementary School
5810 South Alameda Rd
Apache Junction, AZ 85219

[ View School Profile ]
",iconRd); Avondalewwwtuhsdorg[Avondalewwwtuhsdorg.length] = createMarker(new GPoint(-112.26268768,33.45016479),"
La Joya Community High School
11650 W. Whyman Avenue
Avondalewww.tuhsd.org, AZ 85353

[ View School Profile ]
",iconGr); Avondale[Avondale.length] = createMarker(new GPoint(-112.35178375,33.44633865),"
Lattie Coor School
1406 N. Central
Avondale, AZ 85323

[ View School Profile ]
",iconBl); Apache_Junction[Apache_Junction.length] = createMarker(new GPoint(-111.54519653,33.39194107),"
Morningstar Academy
1150 West Superstition Blvd
Apache Junction, AZ 85220

[ View School Profile ]
",iconGr); Apache_Junction[Apache_Junction.length] = createMarker(new GPoint(-111.42896271,33.34248352),"
Peralta Trail Elementary School
10965 E. Peralta Rd.
Apache Junction, AZ 85218

[ View School Profile ]
",iconRd); Avondale[Avondale.length] = createMarker(new GPoint(-112.34940338,33.43534088),"
Ppep Tec - 'lito' Pena Learning Center (charter)
12 E. Western Avenue
Avondale, AZ 85323

[ View School Profile ]
",iconGr); Avondale[Avondale.length] = createMarker(new GPoint(-112.31719971,33.45500183),"
Precision Academy (charter)
2517 N. 107th Ave.
Avondale, AZ 85323

[ View School Profile ]
",iconGr); Avondale[Avondale.length] = createMarker(new GPoint(-112.29741300,33.42448600),"
Quentin Elementary School
11050 West Whyman Avenue
Avondale, AZ 85323

[ View School Profile ]
",iconRd); Avondale[Avondale.length] = createMarker(new GPoint(-112.27983856,33.47176361),"
Rio Vista Elementary School
10237 W Encanto Blvd
Avondale, AZ 85323

[ View School Profile ]
",iconRd); Apache_Junction[Apache_Junction.length] = createMarker(new GPoint(-111.56356049,33.41007614),"
Superstition Mountain Elementary School
550 South Ironwood
Apache Junction, AZ 85220

[ View School Profile ]
",iconRd); Apache_Junction[Apache_Junction.length] = createMarker(new GPoint(-111.50782776,33.40056229),"
Thunder Mountain Middle School
3700 E. 16th Avenue
Apache Junction, AZ 85219

[ View School Profile ]
",iconBl); Avondale[Avondale.length] = createMarker(new GPoint(-112.29385376,33.48884964),"
Westview High School
10850 W. Garden Lakes Parkway
Avondale, AZ 85353

[ View School Profile ]
",iconGr); } // 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(Aguila); map.removeOverlays(Ajo); map.removeOverlays(Alpine); map.removeOverlays(Anthem); map.removeOverlays(Apache_Junction); map.removeOverlays(Arlington); map.removeOverlays(Ash_Fork); map.removeOverlays(Avondale); map.removeOverlays(Avondalewwwtuhsdorg); 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(Ash_Fork);map.removeOverlays(Aguila); map.removeOverlays(Ajo); map.removeOverlays(Alpine); map.removeOverlays(Anthem); map.removeOverlays(Apache_Junction); map.removeOverlays(Arlington); map.removeOverlays(Ash_Fork); map.removeOverlays(Avondale); map.removeOverlays(Avondalewwwtuhsdorg); map.addOverlays(Aguila); centerByArray(Aguila, false, false); cntMarker += Aguila.length; map.addOverlays(Ajo); centerByArray(Ajo, false, false); cntMarker += Ajo.length; map.addOverlays(Alpine); centerByArray(Alpine, false, false); cntMarker += Alpine.length; map.addOverlays(Anthem); centerByArray(Anthem, false, false); cntMarker += Anthem.length; map.addOverlays(Apache_Junction); centerByArray(Apache_Junction, false, false); cntMarker += Apache_Junction.length; map.addOverlays(Arlington); centerByArray(Arlington, false, false); cntMarker += Arlington.length; map.addOverlays(Ash_Fork); centerByArray(Ash_Fork, false, false); cntMarker += Ash_Fork.length; map.addOverlays(Avondale); centerByArray(Avondale, false, false); cntMarker += Avondale.length; map.addOverlays(Avondalewwwtuhsdorg); centerByArray(Avondalewwwtuhsdorg, false, false); cntMarker += Avondalewwwtuhsdorg.length; centerByArray(Ash_Fork,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'); } }