function addMarkers() { mySelect = document.getElementById('selection'); Arlington = [];mySelect.options[mySelect.options.length] = new Option("Arlington schools",'all=Arlington'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Arlington[Arlington.length] = createMarker(new GPoint(-77.09731293,38.83884048),"
",iconRd); mySelect.options[mySelect.options.length] = new Option("Abingdon Elementary School",'Arlington=' + Arlington.length); Arlington[Arlington.length] = createMarker(new GPoint(-77.10312653,38.88935471),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Arlington Science Focus School",'Arlington=' + Arlington.length); Arlington[Arlington.length] = createMarker(new GPoint(-77.12256622,38.87945557),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Arlington Traditional Elementary School",'Arlington=' + Arlington.length); Arlington[Arlington.length] = createMarker(new GPoint(-77.13597870,38.87343979),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Ashlawn Elementary School",'Arlington=' + Arlington.length); Arlington[Arlington.length] = createMarker(new GPoint(-77.10862732,38.86213303),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Barcroft Elementary School",'Arlington=' + Arlington.length); Arlington[Arlington.length] = createMarker(new GPoint(-77.11141968,38.87328339),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Barrett Elementary School",'Arlington=' + Arlington.length); Arlington[Arlington.length] = createMarker(new GPoint(-77.12616730,38.85749817),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Campbell Elementary School",'Arlington=' + Arlington.length); Arlington[Arlington.length] = createMarker(new GPoint(-77.13156891,38.86187363),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Carlin Springs Elementary School",'Arlington=' + Arlington.length); Arlington[Arlington.length] = createMarker(new GPoint(-77.10723114,38.84921265),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Claremont Center",'Arlington=' + Arlington.length); Arlington[Arlington.length] = createMarker(new GPoint(-77.11315918,38.90208054),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Claremont Immersion School",'Arlington=' + Arlington.length); Arlington[Arlington.length] = createMarker(new GPoint(-77.08573151,38.84891129),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Drew Model Elementary School",'Arlington=' + Arlington.length); Arlington[Arlington.length] = createMarker(new GPoint(-77.08709717,38.89302063),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Francis Scott Key Elementary School",'Arlington=' + Arlington.length); Arlington[Arlington.length] = createMarker(new GPoint(-77.11957550,38.89203262),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Glebe Elementary School",'Arlington=' + Arlington.length); Arlington[Arlington.length] = createMarker(new GPoint(-77.06754303,38.84804535),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Gunston Middle School",'Arlington=' + Arlington.length); Arlington[Arlington.length] = createMarker(new GPoint(-77.08969116,38.86627197),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Henry Elementary School",'Arlington=' + Arlington.length); Arlington[Arlington.length] = createMarker(new GPoint(-77.07229614,38.86088181),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Hoffman-boston Elementary School",'Arlington=' + Arlington.length); Arlington[Arlington.length] = createMarker(new GPoint(-77.13929749,38.91637802),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Jamestown Elementary School",'Arlington=' + Arlington.length); Arlington[Arlington.length] = createMarker(new GPoint(-77.09696960,38.86919403),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Jefferson Middle School",'Arlington=' + Arlington.length); Arlington[Arlington.length] = createMarker(new GPoint(-77.12889099,38.86437607),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Kenmore Middle School",'Arlington=' + Arlington.length); Arlington[Arlington.length] = createMarker(new GPoint(-77.08954620,38.87427902),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Long Branch Elementary School",'Arlington=' + Arlington.length); Arlington[Arlington.length] = createMarker(new GPoint(-77.14566803,38.87866211),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Mckinley Elementary School",'Arlington=' + Arlington.length); Arlington[Arlington.length] = createMarker(new GPoint(-77.15074158,38.90114212),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Nottingham Elementary School",'Arlington=' + Arlington.length); Arlington[Arlington.length] = createMarker(new GPoint(-77.06976318,38.85076141),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Oakridge Elementary School",'Arlington=' + Arlington.length); Arlington[Arlington.length] = createMarker(new GPoint(-77.09797668,38.85686111),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Randolph Elementary School",'Arlington=' + Arlington.length); Arlington[Arlington.length] = createMarker(new GPoint(-77.11082458,38.90045547),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Stratford Program",'Arlington=' + Arlington.length); Arlington[Arlington.length] = createMarker(new GPoint(-77.13804626,38.88338089),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Swanson Middle School",'Arlington=' + Arlington.length); Arlington[Arlington.length] = createMarker(new GPoint(-77.11306000,38.90633774),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Taylor Elementary School",'Arlington=' + Arlington.length); Arlington[Arlington.length] = createMarker(new GPoint(-77.08777618,38.86540985),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Tech Ed & Career Center",'Arlington=' + Arlington.length); Arlington[Arlington.length] = createMarker(new GPoint(-77.15921021,38.89358139),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Tuckahoe Elementary School",'Arlington=' + Arlington.length); Arlington[Arlington.length] = createMarker(new GPoint(-77.10820007,38.84611893),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Wakefield High School",'Arlington=' + Arlington.length); Arlington[Arlington.length] = createMarker(new GPoint(-77.10839081,38.88762665),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Washington Lee High School",'Arlington=' + Arlington.length); Arlington[Arlington.length] = createMarker(new GPoint(-77.14568329,38.90979385),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Williamsburg Middle School",'Arlington=' + Arlington.length); Arlington[Arlington.length] = createMarker(new GPoint(-77.13945007,38.90225220),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Yorktown High School",'Arlington=' + Arlington.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(Arlington); 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(Arlington);map.removeOverlays(Arlington); map.addOverlays(Arlington); centerByArray(Arlington, false, false); cntMarker += Arlington.length; centerByArray(Arlington,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'); } }