function addMarkers(){
mySelect = document.getElementById('selection');
Bronx = [];Scarsdale = [];East_Meadow = [];NEW_YORK = [];Yaphank = [];New_Rochelle = [];West_Babylon = [];East_Islip = [];Medford = [];Baldwinsville = [];Pittsford = [];Croton_On_Hudson = [];Yonkers = [];Plainview = [];New_York = [];Long_Island_City = [];Staten_Island = [];Albany = [];Rochester = [];Lake_Ronkonkoma = [];Rome = [];Binghamton = [];Yorktown_Heights = [];Northport = [];Poughkeepsie = [];Spring_Valley = [];mySelect.options[mySelect.options.length] = new Option("Albany schools",'all=Albany');
mySelect.options[mySelect.options.length] = new Option("Baldwinsville schools",'all=Baldwinsville');
mySelect.options[mySelect.options.length] = new Option("Binghamton schools",'all=Binghamton');
mySelect.options[mySelect.options.length] = new Option("Bronx schools",'all=Bronx');
mySelect.options[mySelect.options.length] = new Option("Croton On Hudson schools",'all=Croton_On_Hudson');
mySelect.options[mySelect.options.length] = new Option("East Islip schools",'all=East_Islip');
mySelect.options[mySelect.options.length] = new Option("East Meadow schools",'all=East_Meadow');
mySelect.options[mySelect.options.length] = new Option("Lake Ronkonkoma schools",'all=Lake_Ronkonkoma');
mySelect.options[mySelect.options.length] = new Option("Long Island City schools",'all=Long_Island_City');
mySelect.options[mySelect.options.length] = new Option("Medford schools",'all=Medford');
mySelect.options[mySelect.options.length] = new Option("NEW YORK schools",'all=NEW_YORK');
mySelect.options[mySelect.options.length] = new Option("New Rochelle schools",'all=New_Rochelle');
mySelect.options[mySelect.options.length] = new Option("New York schools",'all=New_York');
mySelect.options[mySelect.options.length] = new Option("Northport schools",'all=Northport');
mySelect.options[mySelect.options.length] = new Option("Pittsford schools",'all=Pittsford');
mySelect.options[mySelect.options.length] = new Option("Plainview schools",'all=Plainview');
mySelect.options[mySelect.options.length] = new Option("Poughkeepsie schools",'all=Poughkeepsie');
mySelect.options[mySelect.options.length] = new Option("Rochester schools",'all=Rochester');
mySelect.options[mySelect.options.length] = new Option("Rome schools",'all=Rome');
mySelect.options[mySelect.options.length] = new Option("Scarsdale schools",'all=Scarsdale');
mySelect.options[mySelect.options.length] = new Option("Spring Valley schools",'all=Spring_Valley');
mySelect.options[mySelect.options.length] = new Option("Staten Island schools",'all=Staten_Island');
mySelect.options[mySelect.options.length] = new Option("West Babylon schools",'all=West_Babylon');
mySelect.options[mySelect.options.length] = new Option("Yaphank schools",'all=Yaphank');
mySelect.options[mySelect.options.length] = new Option("Yonkers schools",'all=Yonkers');
mySelect.options[mySelect.options.length] = new Option("Yorktown Heights schools",'all=Yorktown_Heights');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Bronx[Bronx.length] = createMarker(new GPoint(-73.84732200,40.87086000),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Academy Of Learning",'Bronx=' + Bronx.length);
Scarsdale[Scarsdale.length] = createMarker(new GPoint(-73.80366000,40.99121600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Alcott School",'Scarsdale=' + Scarsdale.length);
East_Meadow[East_Meadow.length] = createMarker(new GPoint(-73.54496400,40.70570800),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Big Chiff Nursery School & Cam",'East_Meadow=' + East_Meadow.length);
NEW_YORK[NEW_YORK.length] = createMarker(new GPoint(-73.97407900,40.73725300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The British International School of New York",'NEW_YORK=' + NEW_YORK.length);
Yaphank[Yaphank.length] = createMarker(new GPoint(-72.91720000,40.83590000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Brookhavencountrydayschool",'Yaphank=' + Yaphank.length);
New_Rochelle[New_Rochelle.length] = createMarker(new GPoint(-73.79785000,40.90921900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Caring Place, Inc.",'New_Rochelle=' + New_Rochelle.length);
West_Babylon[West_Babylon.length] = createMarker(new GPoint(-73.34278000,40.70082700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Carousel School Inc",'West_Babylon=' + West_Babylon.length);
East_Islip[East_Islip.length] = createMarker(new GPoint(-73.18170600,40.73876400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Chatterbox Day School",'East_Islip=' + East_Islip.length);
Medford[Medford.length] = createMarker(new GPoint(-73.01981600,40.82084900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Childrens Garden Day Care Center",'Medford=' + Medford.length);
Baldwinsville[Baldwinsville.length] = createMarker(new GPoint(-76.30753600,43.17669400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Childtime Learning Center",'Baldwinsville=' + Baldwinsville.length);
Pittsford[Pittsford.length] = createMarker(new GPoint(-77.46738700,43.05983900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Crayon Campus Inc",'Pittsford=' + Pittsford.length);
Croton_On_Hudson[Croton_On_Hudson.length] = createMarker(new GPoint(-73.88870000,41.21480000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Croton Montessori School",'Croton_On_Hudson=' + Croton_On_Hudson.length);
Yonkers[Yonkers.length] = createMarker(new GPoint(-73.88410100,40.97118500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Eyes Ears Of The World Inc",'Yonkers=' + Yonkers.length);
Plainview[Plainview.length] = createMarker(new GPoint(-73.47971000,40.78528600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hickory Hill Day School & Camp",'Plainview=' + Plainview.length);
New_York[New_York.length] = createMarker(new GPoint(-73.95617400,40.78324400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Horace Mann School",'New_York=' + New_York.length);
Long_Island_City[Long_Island_City.length] = createMarker(new GPoint(-73.93510700,40.74482200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lagcc Early Childhood Learning",'Long_Island_City=' + Long_Island_City.length);
Long_Island_City[Long_Island_City.length] = createMarker(new GPoint(-73.92174300,40.75857200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Most Precious Blood School",'Long_Island_City=' + Long_Island_City.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.16281000,40.54122200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Oakdale Academy",'Staten_Island=' + Staten_Island.length);
Scarsdale[Scarsdale.length] = createMarker(new GPoint(-73.81650700,40.98173000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Our Lady Of Fatima",'Scarsdale=' + Scarsdale.length);
Albany[Albany.length] = createMarker(new GPoint(-73.79200100,42.66478100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pine Hills Montessori Daycare",'Albany=' + Albany.length);
Long_Island_City[Long_Island_City.length] = createMarker(new GPoint(-73.93283900,40.76381100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Queensview Nursery School & Kindergarten",'Long_Island_City=' + Long_Island_City.length);
Rochester[Rochester.length] = createMarker(new GPoint(-77.67501100,43.09076800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Rit - Margaret's House",'Rochester=' + Rochester.length);
Lake_Ronkonkoma[Lake_Ronkonkoma.length] = createMarker(new GPoint(-73.11902400,40.83170700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Marys Playtime Programme",'Lake_Ronkonkoma=' + Lake_Ronkonkoma.length);
Albany[Albany.length] = createMarker(new GPoint(-73.78694800,42.64104400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Matthew Lutheran School",'Albany=' + Albany.length);
Rome[Rome.length] = createMarker(new GPoint(-75.45170200,43.21271900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Peter S Elementary School",'Rome=' + Rome.length);
Binghamton[Binghamton.length] = createMarker(new GPoint(-75.93848500,42.10050700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Thomas Aquinas",'Binghamton=' + Binghamton.length);
Yorktown_Heights[Yorktown_Heights.length] = createMarker(new GPoint(-73.78928900,41.27891300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Seed Day Care Center (the)",'Yorktown_Heights=' + Yorktown_Heights.length);
Northport[Northport.length] = createMarker(new GPoint(-73.34164200,40.90176400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Trinity Regional School",'Northport=' + Northport.length);
New_York[New_York.length] = createMarker(new GPoint(-73.96134600,40.79652100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Twin Parks Montessori Schools",'New_York=' + New_York.length);
New_York[New_York.length] = createMarker(new GPoint(-73.97528100,40.79293000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("West Side Montessori School",'New_York=' + New_York.length);
Poughkeepsie[Poughkeepsie.length] = createMarker(new GPoint(-73.89780000,41.68580000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Wimpfheimer Nursery School",'Poughkeepsie=' + Poughkeepsie.length);
Spring_Valley[Spring_Valley.length] = createMarker(new GPoint(-74.04111700,41.12494900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Yeshiua Of Rockland County",'Spring_Valley=' + Spring_Valley.length);
map.removeOverlays(Albany);
map.removeOverlays(Baldwinsville);
map.removeOverlays(Binghamton);
map.removeOverlays(Bronx);
map.removeOverlays(Croton_On_Hudson);
map.removeOverlays(East_Islip);
map.removeOverlays(East_Meadow);
map.removeOverlays(Lake_Ronkonkoma);
map.removeOverlays(Long_Island_City);
map.removeOverlays(Medford);
map.removeOverlays(NEW_YORK);
map.removeOverlays(New_Rochelle);
map.removeOverlays(New_York);
map.removeOverlays(Northport);
map.removeOverlays(Pittsford);
map.removeOverlays(Plainview);
map.removeOverlays(Poughkeepsie);
map.removeOverlays(Rochester);
map.removeOverlays(Rome);
map.removeOverlays(Scarsdale);
map.removeOverlays(Spring_Valley);
map.removeOverlays(Staten_Island);
map.removeOverlays(West_Babylon);
map.removeOverlays(Yaphank);
map.removeOverlays(Yonkers);
map.removeOverlays(Yorktown_Heights);
setTimeout(function(){map.addOverlays(Albany)},1000);
setTimeout(function(){map.addOverlays(Baldwinsville)},1000);
setTimeout(function(){map.addOverlays(Binghamton)},1000);
setTimeout(function(){map.addOverlays(Bronx)},1000);
setTimeout(function(){map.addOverlays(Croton_On_Hudson)},1000);
setTimeout(function(){map.addOverlays(East_Islip)},1000);
setTimeout(function(){map.addOverlays(East_Meadow)},1000);
setTimeout(function(){map.addOverlays(Lake_Ronkonkoma)},1000);
setTimeout(function(){map.addOverlays(Long_Island_City)},1000);
setTimeout(function(){map.addOverlays(Medford)},1000);
setTimeout(function(){map.addOverlays(NEW_YORK)},1000);
setTimeout(function(){map.addOverlays(New_Rochelle)},1000);
setTimeout(function(){map.addOverlays(New_York)},1000);
setTimeout(function(){map.addOverlays(Northport)},1000);
setTimeout(function(){map.addOverlays(Pittsford)},1000);
setTimeout(function(){map.addOverlays(Plainview)},1000);
setTimeout(function(){map.addOverlays(Poughkeepsie)},1000);
setTimeout(function(){map.addOverlays(Rochester)},1000);
setTimeout(function(){map.addOverlays(Rome)},1000);
setTimeout(function(){map.addOverlays(Scarsdale)},1000);
setTimeout(function(){map.addOverlays(Spring_Valley)},1000);
setTimeout(function(){map.addOverlays(Staten_Island)},1000);
setTimeout(function(){map.addOverlays(West_Babylon)},1000);
setTimeout(function(){map.addOverlays(Yaphank)},1000);
setTimeout(function(){map.addOverlays(Yonkers)},1000);
setTimeout(function(){map.addOverlays(Yorktown_Heights)},1000);
maxLng = -72.91720000;
maxLat = 43.21271900;
minLng = -77.67501100;
minLat = 40.54122200;
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,11);
/*
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(Albany);
map.removeOverlays(Baldwinsville);
map.removeOverlays(Binghamton);
map.removeOverlays(Bronx);
map.removeOverlays(Croton_On_Hudson);
map.removeOverlays(East_Islip);
map.removeOverlays(East_Meadow);
map.removeOverlays(Lake_Ronkonkoma);
map.removeOverlays(Long_Island_City);
map.removeOverlays(Medford);
map.removeOverlays(NEW_YORK);
map.removeOverlays(New_Rochelle);
map.removeOverlays(New_York);
map.removeOverlays(Northport);
map.removeOverlays(Pittsford);
map.removeOverlays(Plainview);
map.removeOverlays(Poughkeepsie);
map.removeOverlays(Rochester);
map.removeOverlays(Rome);
map.removeOverlays(Scarsdale);
map.removeOverlays(Spring_Valley);
map.removeOverlays(Staten_Island);
map.removeOverlays(West_Babylon);
map.removeOverlays(Yaphank);
map.removeOverlays(Yonkers);
map.removeOverlays(Yorktown_Heights);
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(Bronx);map.removeOverlays(Albany);
map.removeOverlays(Baldwinsville);
map.removeOverlays(Binghamton);
map.removeOverlays(Bronx);
map.removeOverlays(Croton_On_Hudson);
map.removeOverlays(East_Islip);
map.removeOverlays(East_Meadow);
map.removeOverlays(Lake_Ronkonkoma);
map.removeOverlays(Long_Island_City);
map.removeOverlays(Medford);
map.removeOverlays(NEW_YORK);
map.removeOverlays(New_Rochelle);
map.removeOverlays(New_York);
map.removeOverlays(Northport);
map.removeOverlays(Pittsford);
map.removeOverlays(Plainview);
map.removeOverlays(Poughkeepsie);
map.removeOverlays(Rochester);
map.removeOverlays(Rome);
map.removeOverlays(Scarsdale);
map.removeOverlays(Spring_Valley);
map.removeOverlays(Staten_Island);
map.removeOverlays(West_Babylon);
map.removeOverlays(Yaphank);
map.removeOverlays(Yonkers);
map.removeOverlays(Yorktown_Heights);
map.addOverlays(Albany);
centerByArray(Albany, false, false);
cntMarker += Albany.length;
map.addOverlays(Baldwinsville);
centerByArray(Baldwinsville, false, false);
cntMarker += Baldwinsville.length;
map.addOverlays(Binghamton);
centerByArray(Binghamton, false, false);
cntMarker += Binghamton.length;
map.addOverlays(Bronx);
centerByArray(Bronx, false, false);
cntMarker += Bronx.length;
map.addOverlays(Croton_On_Hudson);
centerByArray(Croton_On_Hudson, false, false);
cntMarker += Croton_On_Hudson.length;
map.addOverlays(East_Islip);
centerByArray(East_Islip, false, false);
cntMarker += East_Islip.length;
map.addOverlays(East_Meadow);
centerByArray(East_Meadow, false, false);
cntMarker += East_Meadow.length;
map.addOverlays(Lake_Ronkonkoma);
centerByArray(Lake_Ronkonkoma, false, false);
cntMarker += Lake_Ronkonkoma.length;
map.addOverlays(Long_Island_City);
centerByArray(Long_Island_City, false, false);
cntMarker += Long_Island_City.length;
map.addOverlays(Medford);
centerByArray(Medford, false, false);
cntMarker += Medford.length;
map.addOverlays(NEW_YORK);
centerByArray(NEW_YORK, false, false);
cntMarker += NEW_YORK.length;
map.addOverlays(New_Rochelle);
centerByArray(New_Rochelle, false, false);
cntMarker += New_Rochelle.length;
map.addOverlays(New_York);
centerByArray(New_York, false, false);
cntMarker += New_York.length;
map.addOverlays(Northport);
centerByArray(Northport, false, false);
cntMarker += Northport.length;
map.addOverlays(Pittsford);
centerByArray(Pittsford, false, false);
cntMarker += Pittsford.length;
map.addOverlays(Plainview);
centerByArray(Plainview, false, false);
cntMarker += Plainview.length;
map.addOverlays(Poughkeepsie);
centerByArray(Poughkeepsie, false, false);
cntMarker += Poughkeepsie.length;
map.addOverlays(Rochester);
centerByArray(Rochester, false, false);
cntMarker += Rochester.length;
map.addOverlays(Rome);
centerByArray(Rome, false, false);
cntMarker += Rome.length;
map.addOverlays(Scarsdale);
centerByArray(Scarsdale, false, false);
cntMarker += Scarsdale.length;
map.addOverlays(Spring_Valley);
centerByArray(Spring_Valley, false, false);
cntMarker += Spring_Valley.length;
map.addOverlays(Staten_Island);
centerByArray(Staten_Island, false, false);
cntMarker += Staten_Island.length;
map.addOverlays(West_Babylon);
centerByArray(West_Babylon, false, false);
cntMarker += West_Babylon.length;
map.addOverlays(Yaphank);
centerByArray(Yaphank, false, false);
cntMarker += Yaphank.length;
map.addOverlays(Yonkers);
centerByArray(Yonkers, false, false);
cntMarker += Yonkers.length;
map.addOverlays(Yorktown_Heights);
centerByArray(Yorktown_Heights, false, false);
cntMarker += Yorktown_Heights.length;
centerByArray(Bronx,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///19708,20209,18880,20309,18619,18953,18865,18747,20202,19319,19491,19741,18870,20399,36237,19230,30515,20537,20485,20678,19161,20716,20702,20252,18639,19611,20565,19585,20400,18801,19010,19867,/all');
//window.open('/map.php?type=2&schools=19708,20209,18880,20309,18619,18953,18865,18747,20202,19319,19491,19741,18870,20399,36237,19230,30515,20537,20485,20678,19161,20716,20702,20252,18639,19611,20565,19585,20400,18801,19010,19867,&school_level=&radius=&zipcode=&school_type_search=&school_type_code=');
}
}
function createMarker(point, label, icon)
{
var marker = new GMarker(point, icon);
var html = label;
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(html);
});
return marker;
}