function addMarkers() { mySelect = document.getElementById('selection'); Yuma = [];Wellton = [];San_Luis = [];Dateland = [];Somerton = [];Roll = [];Tucson = [];mySelect.options[mySelect.options.length] = new Option("Dateland schools",'all=Dateland'); mySelect.options[mySelect.options.length] = new Option("Roll schools",'all=Roll'); mySelect.options[mySelect.options.length] = new Option("San Luis schools",'all=San_Luis'); mySelect.options[mySelect.options.length] = new Option("Somerton schools",'all=Somerton'); mySelect.options[mySelect.options.length] = new Option("Tucson schools",'all=Tucson'); mySelect.options[mySelect.options.length] = new Option("Wellton schools",'all=Wellton'); mySelect.options[mySelect.options.length] = new Option("Yuma schools",'all=Yuma'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Yuma[Yuma.length] = createMarker(new GPoint(-114.62933350,32.69836426),"
",iconRd); mySelect.options[mySelect.options.length] = new Option("Alice Byrne Elementary School",'Yuma=' + Yuma.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.64900208,32.70190048),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Amerischools Academy - Yuma",'Yuma=' + Yuma.length); Wellton[Wellton.length] = createMarker(new GPoint(-114.02226257,32.68622208),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Antelope Union High School",'Wellton=' + Wellton.length); San_Luis[San_Luis.length] = createMarker(new GPoint(-114.77760315,32.49399948),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Arizona Desert Elementary School",'San_Luis=' + San_Luis.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.62390137,32.68700027),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Aspc-yuma",'Yuma=' + Yuma.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.65274048,32.67690659),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Az-tec High School",'Yuma=' + Yuma.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.65013885,32.67690277),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Az-tec High School (charter)",'Yuma=' + Yuma.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.61583710,32.68503952),"",iconRd); mySelect.options[mySelect.options.length] = new Option("C W Mcgraw Elementary School",'Yuma=' + Yuma.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.62464400,32.69855800),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Carpe Diem Academy",'Yuma=' + Yuma.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.62458038,32.72521973),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Castle Dome Middle School",'Yuma=' + Yuma.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.65290833,32.69133759),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Centennial Middle School",'Yuma=' + Yuma.length); San_Luis[San_Luis.length] = createMarker(new GPoint(-114.79183960,32.50757980),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Cesar Chavez Elementary School",'San_Luis=' + San_Luis.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.64430237,32.72798157),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Cibola High School",'Yuma=' + Yuma.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.62171936,32.66987991),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Crane Middle School",'Yuma=' + Yuma.length); Dateland[Dateland.length] = createMarker(new GPoint(-113.46530151,32.83010101),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Dateland Elementary School",'Dateland=' + Dateland.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.50446320,32.68449783),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Desert Mesa Elementary School",'Yuma=' + Yuma.length); Somerton[Somerton.length] = createMarker(new GPoint(-114.71849823,32.56829834),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Desert Sonora Elementary School",'Somerton=' + Somerton.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.61909485,32.67986298),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Desert View Academy",'Yuma=' + Yuma.length); San_Luis[San_Luis.length] = createMarker(new GPoint(-114.79183960,32.50757980),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Desert View Elementary School",'San_Luis=' + San_Luis.length); San_Luis[San_Luis.length] = createMarker(new GPoint(-111.95721600,32.08018300),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Ed Pastor Elementary 4",'San_Luis=' + San_Luis.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.66639709,32.69863510),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Educational Opportunity Center",'Yuma=' + Yuma.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.66639709,32.69863510),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Educational Opportunity Center (charter)",'Yuma=' + Yuma.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.62471008,32.71879959),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Fourth Avenue Junior High School",'Yuma=' + Yuma.length); San_Luis[San_Luis.length] = createMarker(new GPoint(-114.77760315,32.49399948),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Gadsden Elementary School",'San_Luis=' + San_Luis.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.64602300,32.67443400),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Gary A. Knox Elementary School",'Yuma=' + Yuma.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.63633728,32.71776199),"",iconRd); mySelect.options[mySelect.options.length] = new Option("George Washington Carver Elementary School",'Yuma=' + Yuma.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.61583710,32.68674469),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Gila Vista Junior High School",'Yuma=' + Yuma.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.61325836,32.68783569),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Gwyneth Ham Elementary School",'Yuma=' + Yuma.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.66757965,32.69879532),"",iconRd); mySelect.options[mySelect.options.length] = new Option("H L Suverkrup Elementary School",'Yuma=' + Yuma.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.62390137,32.68700027),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Harvest Preparatory Academy",'Yuma=' + Yuma.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.59423828,32.67870331),"",iconRd); mySelect.options[mySelect.options.length] = new Option("James B Rolle School",'Yuma=' + Yuma.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.62458038,32.72521973),"",iconRd); mySelect.options[mySelect.options.length] = new Option("James D Price School",'Yuma=' + Yuma.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.54779816,32.68510056),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Juniper Tree Academy (charter)",'Yuma=' + Yuma.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.63326263,32.67144775),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Kofa High School",'Yuma=' + Yuma.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.49562073,32.69268036),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Mary A Otondo Elementary School",'Yuma=' + Yuma.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.62476349,32.71803665),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Mary E Post Elementary School",'Yuma=' + Yuma.length); Roll[Roll.length] = createMarker(new GPoint(-113.97069550,32.75198364),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Mohawk Valley School",'Roll=' + Roll.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.63456726,32.70566177),"",iconRd); mySelect.options[mySelect.options.length] = new Option("O C Johnson School",'Yuma=' + Yuma.length); Somerton[Somerton.length] = createMarker(new GPoint(-114.71849823,32.56829834),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Orange Grove Elementary School",'Somerton=' + Somerton.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.62982178,32.67442703),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Palmcroft Elementary School",'Yuma=' + Yuma.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.64566040,32.71596146),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Pecan Grove Elementary School",'Yuma=' + Yuma.length); San_Luis[San_Luis.length] = createMarker(new GPoint(-114.79183960,32.50757980),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Ppep Tec - Cesar Chavez Learning Center",'San_Luis=' + San_Luis.length); Tucson[Tucson.length] = createMarker(new GPoint(-114.71849823,32.56829834),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Ppep Tec - Jose Yepez Learning Center",'Tucson=' + Tucson.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.65529633,32.69106293),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Pueblo Elementary School",'Yuma=' + Yuma.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.62915039,32.68644714),"",iconBl); mySelect.options[mySelect.options.length] = new Option("R Pete Woodard Junior High School",'Yuma=' + Yuma.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.66756439,32.71088791),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Rancho Viejo Elementary School",'Yuma=' + Yuma.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.62155914,32.68403625),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Ray Drysdale High School",'Yuma=' + Yuma.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.62155914,32.68403625),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Ray Drysdale Middle School",'Yuma=' + Yuma.length); San_Luis[San_Luis.length] = createMarker(new GPoint(-111.95721600,32.08018300),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Rio Colorado Elementary School",'San_Luis=' + San_Luis.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.46211500,32.67773200),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Ron Watson Middle School",'Yuma=' + Yuma.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.65913391,32.69850159),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Ronald Reagan Fundamental School",'Yuma=' + Yuma.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.62636566,32.71803665),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Roosevelt School",'Yuma=' + Yuma.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.66749200,32.70532400),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Salida Del Sol Elementary School",'Yuma=' + Yuma.length); San_Luis[San_Luis.length] = createMarker(new GPoint(-114.79183960,32.50757980),"",iconGr); mySelect.options[mySelect.options.length] = new Option("San Luis High School",'San_Luis=' + San_Luis.length); San_Luis[San_Luis.length] = createMarker(new GPoint(-111.95721600,32.08018300),"",iconBl); mySelect.options[mySelect.options.length] = new Option("San Luis Middle School",'San_Luis=' + San_Luis.length); Somerton[Somerton.length] = createMarker(new GPoint(-114.71849823,32.56829834),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Somerton Middle School",'Somerton=' + Somerton.length); San_Luis[San_Luis.length] = createMarker(new GPoint(-114.76099700,32.49556300),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Southwest Jr. High School",'San_Luis=' + San_Luis.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.38840900,32.67767800),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Sunrise Elementary School",'Yuma=' + Yuma.length); Somerton[Somerton.length] = createMarker(new GPoint(-114.71849823,32.56829834),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Tierra Del Sol Elementary School",'Somerton=' + Somerton.length); Somerton[Somerton.length] = createMarker(new GPoint(-114.70978200,32.59665000),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Valle Del Encanto Learning Center",'Somerton=' + Somerton.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.67617798,32.69096375),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Valley Horizon Elementary School",'Yuma=' + Yuma.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.62286377,32.68453217),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Vista Alternative School",'Yuma=' + Yuma.length); Wellton[Wellton.length] = createMarker(new GPoint(-114.19120026,32.77479935),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Wellton Elementary School",'Wellton=' + Wellton.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.62715912,32.71956253),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Yuma High School",'Yuma=' + Yuma.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(Dateland); map.removeOverlays(Roll); map.removeOverlays(San_Luis); map.removeOverlays(Somerton); map.removeOverlays(Tucson); map.removeOverlays(Wellton); map.removeOverlays(Yuma); 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(Yuma);map.removeOverlays(Dateland); map.removeOverlays(Roll); map.removeOverlays(San_Luis); map.removeOverlays(Somerton); map.removeOverlays(Tucson); map.removeOverlays(Wellton); map.removeOverlays(Yuma); map.addOverlays(Dateland); centerByArray(Dateland, false, false); cntMarker += Dateland.length; map.addOverlays(Roll); centerByArray(Roll, false, false); cntMarker += Roll.length; map.addOverlays(San_Luis); centerByArray(San_Luis, false, false); cntMarker += San_Luis.length; map.addOverlays(Somerton); centerByArray(Somerton, false, false); cntMarker += Somerton.length; map.addOverlays(Tucson); centerByArray(Tucson, false, false); cntMarker += Tucson.length; map.addOverlays(Wellton); centerByArray(Wellton, false, false); cntMarker += Wellton.length; map.addOverlays(Yuma); centerByArray(Yuma, false, false); cntMarker += Yuma.length; centerByArray(Yuma,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'); } }