function addMarkers() { mySelect = document.getElementById('selection'); Troy = [];Troy[Troy.length] = createMarker(new GPoint(-73.68350220,42.74592209),"
Alternative Learning Center
2920 5th Ave
Troy, NY 12180

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Alternative Learning Center",'Troy=' + Troy.length); Troy[Troy.length] = createMarker(new GPoint(-73.67787933,42.73600006),"
Ark Community Charter School (the)
762 River St
Troy, NY 12180

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ark Community Charter School (the)",'Troy=' + Troy.length); Troy[Troy.length] = createMarker(new GPoint(-73.68315887,42.66721725),"
Bell Top School
39 Reynolds Road
Troy, NY 12180

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bell Top School",'Troy=' + Troy.length); Troy[Troy.length] = createMarker(new GPoint(-73.66173553,42.70678329),"
Boys Group Home
500 Pawling Ave
Troy, NY 12180

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Boys Group Home",'Troy=' + Troy.length); Troy[Troy.length] = createMarker(new GPoint(-73.67916107,42.71107864),"
Carroll Hill School
112 Delaware Avenue
Troy, NY 12180

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Carroll Hill School",'Troy=' + Troy.length); Troy[Troy.length] = createMarker(new GPoint(-73.67089844,42.71252823),"
Exceptional Group Home
100 Spring Ave
Troy, NY 12180

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Exceptional Group Home",'Troy=' + Troy.length); Troy[Troy.length] = createMarker(new GPoint(-73.63816833,42.71226120),"
George Washington School
344 Menemsha Lane
Troy, NY 12180

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("George Washington School",'Troy=' + Troy.length); Troy[Troy.length] = createMarker(new GPoint(-73.66792297,42.71559525),"
Girls Group Home
7 Collins Ave
Troy, NY 12180

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Girls Group Home",'Troy=' + Troy.length); Troy[Troy.length] = createMarker(new GPoint(-73.67534637,42.76395798),"
Knickerbacker Middle School
320 Seventh Avenue
Troy, NY 12182

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Knickerbacker Middle School",'Troy=' + Troy.length); Troy[Troy.length] = createMarker(new GPoint(-73.67534637,42.76395798),"
Lansingburgh Senior High School
320 Seventh Avenue
Troy, NY 12182

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lansingburgh Senior High School",'Troy=' + Troy.length); Troy[Troy.length] = createMarker(new GPoint(-73.67855835,42.74507904),"
P.S. 2
470 10th Street
Troy, NY 12180

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("P.S. 2",'Troy=' + Troy.length); Troy[Troy.length] = createMarker(new GPoint(-73.69720459,42.71182632),"
P.S. 12
475 First Street
Troy, NY 12180

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("P.S. 12",'Troy=' + Troy.length); Troy[Troy.length] = createMarker(new GPoint(-73.66867065,42.72517014),"
P.S. 14
1700 Tibbits Avenue
Troy, NY 12180

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("P.S. 14",'Troy=' + Troy.length); Troy[Troy.length] = createMarker(new GPoint(-73.66648102,42.71576691),"
P.S. 16
40 Collins Avenue
Troy, NY 12180

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("P.S. 16",'Troy=' + Troy.length); Troy[Troy.length] = createMarker(new GPoint(-73.66246033,42.73788071),"
P.S. 18
412 Hoosick Street
Troy, NY 12180

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("P.S. 18",'Troy=' + Troy.length); Troy[Troy.length] = createMarker(new GPoint(-73.68182373,42.73477554),"
Pahl House, Inc
106-108 9th St
Troy, NY 12180

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pahl House, Inc",'Troy=' + Troy.length); Troy[Troy.length] = createMarker(new GPoint(-73.67285919,42.76663589),"
Rensselaer Park Elementary School
70 110th Street
Troy, NY 12182

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rensselaer Park Elementary School",'Troy=' + Troy.length); Troy[Troy.length] = createMarker(new GPoint(-73.65679932,42.73080063),"
Tamarac Elementary School
3992 N Y Route 2
Troy, NY 12180

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Tamarac Elementary School",'Troy=' + Troy.length); Troy[Troy.length] = createMarker(new GPoint(-73.65679932,42.73080063),"
Tamarac Middle School
3992 N Y Rt 2
Troy, NY 12180

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Tamarac Middle School",'Troy=' + Troy.length); Troy[Troy.length] = createMarker(new GPoint(-73.65679932,42.73080063),"
Tamarac Senior High School
3992 N Y Rt 2
Troy, NY 12180

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tamarac Senior High School",'Troy=' + Troy.length); Troy[Troy.length] = createMarker(new GPoint(-73.67378998,42.72581863),"
Troy High School
1950 Burdett Avenue
Troy, NY 12180

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Troy High School",'Troy=' + Troy.length); Troy[Troy.length] = createMarker(new GPoint(-73.66637421,42.78972244),"
Turnpike Elementary School
55 New Turnpike Road
Troy, NY 12182

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Turnpike Elementary School",'Troy=' + Troy.length); Troy[Troy.length] = createMarker(new GPoint(-73.67364502,42.72637177),"
W. Kenneth Doyle Middle School
1976 Burdett Avenue
Troy, NY 12180

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