function addMarkers() { mySelect = document.getElementById('selection'); Lake_Havasu_City = [];Lake_Havasu_City[Lake_Havasu_City.length] = createMarker(new GPoint(-114.27629852,34.46788788),"
Arrowhead West
3456 Thunderhead Dr.
Lake Havasu City, AZ 86406

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Arrowhead West",'Lake_Havasu_City=' + Lake_Havasu_City.length); Lake_Havasu_City[Lake_Havasu_City.length] = createMarker(new GPoint(-72.61089325,41.79253769),"
Daytona Middle School
98 Swanson Plaza
Lake Havasu City, AZ 86403

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Daytona Middle School",'Lake_Havasu_City=' + Lake_Havasu_City.length); Lake_Havasu_City[Lake_Havasu_City.length] = createMarker(new GPoint(-114.29371643,34.45474625),"
Desert Technology High School
3155 Maricopa Ave.
Lake Havasu City, AZ 86406

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Desert Technology High School",'Lake_Havasu_City=' + Lake_Havasu_City.length); Lake_Havasu_City[Lake_Havasu_City.length] = createMarker(new GPoint(-113.94029999,34.54529953),"
Desert Technology High School (charter)
2818 Sweetwater Ave
Lake Havasu City, AZ 86406

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Desert Technology High School (charter)",'Lake_Havasu_City=' + Lake_Havasu_City.length); Lake_Havasu_City[Lake_Havasu_City.length] = createMarker(new GPoint(-114.32885900,34.50204300),"
Distant Learning
2200 Havasupai Boulevard
Lake Havasu City, AZ 86403

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Distant Learning",'Lake_Havasu_City=' + Lake_Havasu_City.length); Lake_Havasu_City[Lake_Havasu_City.length] = createMarker(new GPoint(-114.31659698,34.50933075),"
Havasupai Elementary School
880 Cashmere Dr
Lake Havasu City, AZ 86404

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Havasupai Elementary School",'Lake_Havasu_City=' + Lake_Havasu_City.length); Lake_Havasu_City[Lake_Havasu_City.length] = createMarker(new GPoint(-114.29114532,34.50021362),"
Jamaica Elementary School
3437 Jamaica Blvd. So.
Lake Havasu City, AZ 86406

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Jamaica Elementary School",'Lake_Havasu_City=' + Lake_Havasu_City.length); Lake_Havasu_City[Lake_Havasu_City.length] = createMarker(new GPoint(-114.34825400,34.50978000),"
Lake Havasu Charter School
1055 Empire Drive
Lake Havasu City, AZ 86404

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lake Havasu Charter School",'Lake_Havasu_City=' + Lake_Havasu_City.length); Lake_Havasu_City[Lake_Havasu_City.length] = createMarker(new GPoint(-114.32857513,34.51807404),"
Lake Havasu High School
2675 S. Palo Verde Blvd.
Lake Havasu City, AZ 86403

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lake Havasu High School",'Lake_Havasu_City=' + Lake_Havasu_City.length); Lake_Havasu_City[Lake_Havasu_City.length] = createMarker(new GPoint(-114.34249878,34.51604080),"
Nautilus Elementary School
1425 Patrician Drive
Lake Havasu City, AZ 86404

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Nautilus Elementary School",'Lake_Havasu_City=' + Lake_Havasu_City.length); Lake_Havasu_City[Lake_Havasu_City.length] = createMarker(new GPoint(-114.27205658,34.46321487),"
Oro Grande Elementary School
1250 Pawnee Drive
Lake Havasu City, AZ 86406

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Oro Grande Elementary School",'Lake_Havasu_City=' + Lake_Havasu_City.length); Lake_Havasu_City[Lake_Havasu_City.length] = createMarker(new GPoint(-114.33370209,34.48569870),"
Smoketree Elementary School
2395 Smoketree Ave
Lake Havasu City, AZ 86403

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Smoketree Elementary School",'Lake_Havasu_City=' + Lake_Havasu_City.length); Lake_Havasu_City[Lake_Havasu_City.length] = createMarker(new GPoint(-114.29924011,34.48526382),"
Starline Elementary School
3150 Starline Dr.
Lake Havasu City, AZ 86406

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Starline Elementary School",'Lake_Havasu_City=' + Lake_Havasu_City.length); Lake_Havasu_City[Lake_Havasu_City.length] = createMarker(new GPoint(-114.26841736,34.48860168),"
Telesis Preparatory
2598 Starlite Lane
Lake Havasu City, AZ 86403

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Telesis Preparatory",'Lake_Havasu_City=' + Lake_Havasu_City.length); Lake_Havasu_City[Lake_Havasu_City.length] = createMarker(new GPoint(-114.31716156,34.49159622),"
Telesis Preparatory Academy
2598 Starlite Lane
Lake Havasu City, AZ 86403

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Telesis Preparatory Academy",'Lake_Havasu_City=' + Lake_Havasu_City.length); Lake_Havasu_City[Lake_Havasu_City.length] = createMarker(new GPoint(-114.33370209,34.48569870),"
Telesis Preparatory Academy (charter)
2598 Starlite Lane
Lake Havasu City, AZ 86403

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Telesis Preparatory Academy (charter)",'Lake_Havasu_City=' + Lake_Havasu_City.length); Lake_Havasu_City[Lake_Havasu_City.length] = createMarker(new GPoint(-114.29033661,34.47067642),"
Thunderbolt Middle School
695 Thunderbolt Avenue
Lake Havasu City, AZ 86406

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Thunderbolt Middle School",'Lake_Havasu_City=' + Lake_Havasu_City.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(Lake_Havasu_City); 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(Lake_Havasu_City);map.removeOverlays(Lake_Havasu_City); map.addOverlays(Lake_Havasu_City); centerByArray(Lake_Havasu_City, false, false); cntMarker += Lake_Havasu_City.length; centerByArray(Lake_Havasu_City,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'); } }