function addMarkers() { mySelect = document.getElementById('selection'); Levittown = [];Levittown[Levittown.length] = createMarker(new GPoint(-73.51584625,40.71854401),"
Abbey Lane School
239 Gardiners Avenue
Levittown, NY 11756

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Abbey Lane School",'Levittown=' + Levittown.length); Levittown[Levittown.length] = createMarker(new GPoint(-73.52623749,40.73125458),"
Div Ave Senior High School
120 Division Avenue
Levittown, NY 11756

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Div Ave Senior High School",'Levittown=' + Levittown.length); Levittown[Levittown.length] = createMarker(new GPoint(-73.51453400,40.70940018),"
Gardiners Ave School
610 Gardiners Avenue
Levittown, NY 11756

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Gardiners Ave School",'Levittown=' + Levittown.length); Levittown[Levittown.length] = createMarker(new GPoint(-73.51087189,40.70410156),"
Gen. Douglas Macarthur Senior High School
3369 Old Jerusalem Road
Levittown, NY 11756

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Gen. Douglas Macarthur Senior High School",'Levittown=' + Levittown.length); Levittown[Levittown.length] = createMarker(new GPoint(-73.49417114,40.72193527),"
Island Trees High School
59 Straight Lane
Levittown, NY 11756

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Island Trees High School",'Levittown=' + Levittown.length); Levittown[Levittown.length] = createMarker(new GPoint(-73.49797821,40.72310257),"
Island Trees Middle School
45 Wantagh Avenue South
Levittown, NY 11756

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Island Trees Middle School",'Levittown=' + Levittown.length); Levittown[Levittown.length] = createMarker(new GPoint(-73.50471497,40.73055267),"
J. Fred Sparke School
100 Robin Place
Levittown, NY 11756

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("J. Fred Sparke School",'Levittown=' + Levittown.length); Levittown[Levittown.length] = createMarker(new GPoint(-73.51126862,40.70422363),"
Jonas E. Salk Middle School
3359 Old Jerusalem Road
Levittown, NY 11756

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Jonas E. Salk Middle School",'Levittown=' + Levittown.length); Levittown[Levittown.length] = createMarker(new GPoint(-73.50987244,40.71829987),"
Levittown Memorial Spec Educ Center
150 Abbey Ln
Levittown, NY 11756

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Levittown Memorial Spec Educ Center",'Levittown=' + Levittown.length); Levittown[Levittown.length] = createMarker(new GPoint(-73.50218201,40.73054886),"
Michael F. Stokes School
101 Owl Place
Levittown, NY 11756

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Michael F. Stokes School",'Levittown=' + Levittown.length); Levittown[Levittown.length] = createMarker(new GPoint(-73.52471161,40.73843384),"
Northside School
35 Pelican Road
Levittown, NY 11756

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Northside School",'Levittown=' + Levittown.length); Levittown[Levittown.length] = createMarker(new GPoint(-73.52219391,40.72979355),"
Summit Lane School
4 Summit Lane
Levittown, NY 11756

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Summit Lane School",'Levittown=' + Levittown.length); Levittown[Levittown.length] = createMarker(new GPoint(-73.52435303,40.71861649),"
Wisdom Lane Middle School
120 Center Lane
Levittown, NY 11756

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