function addMarkers() { mySelect = document.getElementById('selection'); Santa_Fe = [];Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.98281097,35.65986633),"
",iconGr); mySelect.options[mySelect.options.length] = new Option("Academy Charter",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.94000244,35.64720154),"",iconGr); mySelect.options[mySelect.options.length] = new Option("AcademyTech. & Classic High School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.93017578,35.68003082),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Acequia Madre Elementary School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.92089844,35.72639847),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Agua Fria Elementary School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.96083832,35.68401337),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Alameda Middle School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.95227814,35.68226242),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Alvord Elementary School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.91457367,35.67523193),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Atalaya Elementary School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.96107483,35.68463135),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Becc Elementary School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-106.04093170,35.62477493),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Caesar Chavez Elementary School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-106.04019928,35.62387085),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Capital High School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.93467712,35.65172958),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Capshaw Junior High School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.94177246,35.69113159),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Carlos Gilbert Elementary School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.92089844,35.72639847),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Chaparral Elementary School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.97212219,35.65732574),"",iconBl); mySelect.options[mySelect.options.length] = new Option("De Vargas Junior High School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.95095062,35.66371536),"",iconRd); mySelect.options[mySelect.options.length] = new Option("E J Martinez Elementary School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.93939972,35.64699936),"",iconRd); mySelect.options[mySelect.options.length] = new Option("El Dorado Elementary School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.98233032,35.65209961),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Francis X Nava Elementary School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.95579529,35.68865967),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Gonzales Elementary School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.96202850,35.66986084),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Kaune Elementary School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.92089844,35.72639847),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Kearny Elementary School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.92089844,35.72639847),"",iconGr); mySelect.options[mySelect.options.length] = new Option("La Nueva Vida",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.92089844,35.72639847),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Larragoite Elementary School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.93939972,35.64699936),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Monte Del Sol Charte High School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.96440125,35.63625336),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Ortiz Middle School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.93939972,35.64699936),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Pinon Elementary School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.92089844,35.72639847),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Pojoaque High School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.92089844,35.72639847),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Pojoaque Intermed Middle School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.92089844,35.72639847),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Pojoaque Middle School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.92089844,35.72639847),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Pojoaque Primary Elementary School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-106.03047943,35.63766479),"",iconRd); mySelect.options[mySelect.options.length] = new Option("R M Sweeney Elementary School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.94000244,35.64720154),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Ramirez Thomas Elementary School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.97767639,35.66382980),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Salazar Elementary School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-106.04989624,35.88339996),"",iconRd); mySelect.options[mySelect.options.length] = new Option("San Ildefonso Day School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.98475647,35.63582611),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Santa Fe High School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.98500061,35.80989838),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Santa Fe Indian School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.98469300,35.65875100),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Ser Program",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-106.06052399,35.63358307),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Sf County Jdc",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.91877300,35.67960000),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Sfe Hdst",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.95635223,35.67609406),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Ssps/nmsd Elementary School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.93715668,35.68666077),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Te Tsu Geh Oweenge Day School (tesuque)",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.92089844,35.72639847),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Turquoise Trail Elementary School",'Santa_Fe=' + Santa_Fe.length); Santa_Fe[Santa_Fe.length] = createMarker(new GPoint(-105.94055939,35.67940903),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Wood-gormley Elementary School",'Santa_Fe=' + Santa_Fe.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(Santa_Fe); 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(Santa_Fe);map.removeOverlays(Santa_Fe); map.addOverlays(Santa_Fe); centerByArray(Santa_Fe, false, false); cntMarker += Santa_Fe.length; centerByArray(Santa_Fe,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'); } }