function addMarkers()
{
mySelect = document.getElementById('selection');
Staten_Island = [];Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.22676086,40.54792786),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Arthur Kill Corr Facil",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.08723450,40.61089706),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Concord Alternative High School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.15336600,40.60880500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Csi High School For International Studies",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.08117676,40.64454651),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Curtis High School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.06970978,40.60158539),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Geller House School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.08413696,40.60533905),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Group Home",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.08790588,40.61149216),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Group Home 17",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.13076019,40.60370636),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Group Home Family Style",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.10023499,40.57680130),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("I.S. 2 Egbert Intermediate School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.18631744,40.52433777),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("I.S. 7 E. Bernstein School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.14614868,40.54525757),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("I.S. 24 M. S. Barnes Intermediate School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.11713409,40.62797928),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("I.S. 27 A. S. Prall Intermediate School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.24308777,40.50857544),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("I.S. 34 Totten Intermediate School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.08200073,40.62033463),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("I.S. 49 B. A. Dreyfus Intermediate School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.14487457,40.62244034),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("I.S. 51 E. Markham Intermediate School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.09738922,40.63388062),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("I.S. 61 William Morris School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.15874481,40.59324646),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("I.S. 72 Rocco Laurie Intermediate School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.19774628,40.54403687),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("I.S. 75 Paulo Intermediate School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.11566162,40.63576508),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Market Street Group Home",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.22225189,40.50892258),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mission Of Immac Virgin",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.10741425,40.56936646),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("New Dorp High School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.24428558,40.50932693),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 1 Tottenville School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.21114349,40.52057266),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 3 Margaret Gioiosa School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.17800140,40.54280090),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 4 Maurice Wollin School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.18788147,40.53041077),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 5 Huguenot School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.23139191,40.51216888),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 6 Cpl A.f. Kivlehan School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.15203094,40.54803848),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 8 Shirley Solomon School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.09762573,40.59046173),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 11 Thomas Dongan School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.06987000,40.61309052),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 13 M. L. Lindenmeyer School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.07843018,40.62198639),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 14 Vanderbilt School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.07921800,40.64001800),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 16 John Driscoll School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.11750031,40.63589859),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 18 J. Greenleaf Whittier School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.12766266,40.63095856),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 19 Curtis School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.13316345,40.63635254),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 20 Port Richmond School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.14385223,40.63124847),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 21 Elm Park School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.15135956,40.62522125),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 22 Graniteville School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.13205719,40.57126999),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 23 Richmondtown School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.22250366,40.50897980),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("P.S. 25 South Richmond High School Mt Loretto",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.19083405,40.59159088),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 26 Carteret School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.11521149,40.61361313),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 29 Bardwell School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.13269806,40.61846542),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 30 Westerleigh School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.08546448,40.64139557),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 31 William T. Davis School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.15417480,40.55522537),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 32 Gifford School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.09986115,40.61361694),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 35 Clove Valley School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.18258667,40.54327011),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 36 John C. Drumgoole School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.15071869,40.56411362),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 37",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.09969330,40.57464600),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 38 George Cromwell School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.07132721,40.59750366),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 39 Francis J. Murphy Junior School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.10910034,40.57403564),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 41 New Dorp School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.16988373,40.55256271),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 42 Eltingville School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.15663147,40.63157654),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 44 Thomas C. Brown School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.10729980,40.62849045),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 45 John Tyler School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.08043671,40.59361267),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 46 Albert V. Maniscalco School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.09123230,40.60221100),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 48 William G. Wilcox School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.12448883,40.56177902),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 50 Frank Hankinson School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.08819580,40.58272934),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 52 John C. Thompson School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.13703156,40.55266953),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 53 Bay Terrace School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.13785553,40.60333252),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 54 Charles W. Leng School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.16400146,40.53668213),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 55 Henry M. Boehm School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.21385956,40.54252625),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 56 Louis De Sario School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.08264160,40.61123657),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 57 Hubert H. Humphrey School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.15119934,40.60380173),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 58 Ss Columbia School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.16203308,40.60991287),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 60 Alice Austen School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.15582275,40.59224319),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 69 Daniel Tompkins School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.10146332,40.60723877),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("P.S. 80 Petrides School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.09455109,40.64068222),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("P.S. 373",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-73.92050171,40.86750031),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("P.S. 721",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-75.45578003,39.71756744),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Penns Grove High School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.15062714,40.58388901),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Petrides School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-73.78717804,40.89761353),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Port Richmond High School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.07874298,40.64265442),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ralph Mckee High School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.07801819,40.57966232),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("South Beach Psych Center",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.22225189,40.50892258),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Spec Adol Unit Female Division",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.08387756,40.61772919),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Staten Island Group Home",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.14457703,40.59237289),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Staten Island Res Center",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.11498260,40.56760788),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Staten Island Technical High School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.12332916,40.59844589),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Susan E. Wagner High School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.19253540,40.52853012),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Tottenville High School",'Staten_Island=' + Staten_Island.length);
maxLng = -73.78717804;
maxLat = 40.89761353;
minLng = -75.45578003;
minLat = 39.71756744;
reCenterMap();
} // 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(Staten_Island);
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(Staten_Island);map.removeOverlays(Staten_Island);
map.addOverlays(Staten_Island);
centerByArray(Staten_Island, false, false);
cntMarker += Staten_Island.length;
centerByArray(Staten_Island,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');
}
}