function addMarkers(){
mySelect = document.getElementById('selection');
White_Plains = [];New_Rochelle = [];Ossining = [];Yonkers = [];Briarcliff_Manor = [];Mount_Vernon = [];Mamaroneck = [];Tarrytown = [];Katonah = [];Lincolndale = [];Somers = [];Mount_Kisco = [];Purchase = [];Hartsdale = [];Dobbs_Ferry = [];Peekskill = [];Bedford = [];Rye = [];Yorktown_Heights = [];North_Salem = [];Bedford_Hills = [];Mt_Kisco = [];mySelect.options[mySelect.options.length] = new Option("Bedford schools",'all=Bedford');
mySelect.options[mySelect.options.length] = new Option("Bedford Hills schools",'all=Bedford_Hills');
mySelect.options[mySelect.options.length] = new Option("Briarcliff Manor schools",'all=Briarcliff_Manor');
mySelect.options[mySelect.options.length] = new Option("Dobbs Ferry schools",'all=Dobbs_Ferry');
mySelect.options[mySelect.options.length] = new Option("Hartsdale schools",'all=Hartsdale');
mySelect.options[mySelect.options.length] = new Option("Katonah schools",'all=Katonah');
mySelect.options[mySelect.options.length] = new Option("Lincolndale schools",'all=Lincolndale');
mySelect.options[mySelect.options.length] = new Option("Mamaroneck schools",'all=Mamaroneck');
mySelect.options[mySelect.options.length] = new Option("Mount Kisco schools",'all=Mount_Kisco');
mySelect.options[mySelect.options.length] = new Option("Mount Vernon schools",'all=Mount_Vernon');
mySelect.options[mySelect.options.length] = new Option("Mt Kisco schools",'all=Mt_Kisco');
mySelect.options[mySelect.options.length] = new Option("New Rochelle schools",'all=New_Rochelle');
mySelect.options[mySelect.options.length] = new Option("North Salem schools",'all=North_Salem');
mySelect.options[mySelect.options.length] = new Option("Ossining schools",'all=Ossining');
mySelect.options[mySelect.options.length] = new Option("Peekskill schools",'all=Peekskill');
mySelect.options[mySelect.options.length] = new Option("Purchase schools",'all=Purchase');
mySelect.options[mySelect.options.length] = new Option("Rye schools",'all=Rye');
mySelect.options[mySelect.options.length] = new Option("Somers schools",'all=Somers');
mySelect.options[mySelect.options.length] = new Option("Tarrytown schools",'all=Tarrytown');
mySelect.options[mySelect.options.length] = new Option("White Plains schools",'all=White_Plains');
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("---------------------------",'');
White_Plains[White_Plains.length] = createMarker(new GPoint(-73.75267000,41.00872100),"
",iconBl);
mySelect.options[mySelect.options.length] = new Option("Archbishop Stepinac High School",'White_Plains=' + White_Plains.length);
New_Rochelle[New_Rochelle.length] = createMarker(new GPoint(-73.78303800,40.90568100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Blessed Sacrament St Gabriel High School",'New_Rochelle=' + New_Rochelle.length);
Ossining[Ossining.length] = createMarker(new GPoint(-73.86302900,41.16758100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cardinal Mccloskey School",'Ossining=' + Ossining.length);
Yonkers[Yonkers.length] = createMarker(new GPoint(-73.90538500,40.91656200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Carol And Frank Biondi Edu",'Yonkers=' + Yonkers.length);
Yonkers[Yonkers.length] = createMarker(new GPoint(-73.90538500,40.91656200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Carol And Frank Biondi Educati",'Yonkers=' + Yonkers.length);
Yonkers[Yonkers.length] = createMarker(new GPoint(-73.90140400,40.93367000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("City Harvest Academy",'Yonkers=' + Yonkers.length);
Briarcliff_Manor[Briarcliff_Manor.length] = createMarker(new GPoint(-73.86184700,41.12846400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Clearview School Day Treatment",'Briarcliff_Manor=' + Briarcliff_Manor.length);
Yonkers[Yonkers.length] = createMarker(new GPoint(-73.86676700,40.97363200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ferncliff Manor",'Yonkers=' + Yonkers.length);
Mount_Vernon[Mount_Vernon.length] = createMarker(new GPoint(-73.84261700,40.91366500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Fortress Christian Academy",'Mount_Vernon=' + Mount_Vernon.length);
Mamaroneck[Mamaroneck.length] = createMarker(new GPoint(-73.75080000,40.92697700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("French American School Of New York (fasny)",'Mamaroneck=' + Mamaroneck.length);
White_Plains[White_Plains.length] = createMarker(new GPoint(-73.73386600,41.01401600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("German School New York",'White_Plains=' + White_Plains.length);
Tarrytown[Tarrytown.length] = createMarker(new GPoint(-73.84629800,41.06867100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hackley School",'Tarrytown=' + Tarrytown.length);
New_Rochelle[New_Rochelle.length] = createMarker(new GPoint(-73.78377400,40.90693800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Hallen School",'New_Rochelle=' + New_Rochelle.length);
Katonah[Katonah.length] = createMarker(new GPoint(-73.66663600,41.25489700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Harvey School",'Katonah=' + Katonah.length);
Yonkers[Yonkers.length] = createMarker(new GPoint(-73.89197400,40.95390100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hudson View Christian Academy",'Yonkers=' + Yonkers.length);
New_Rochelle[New_Rochelle.length] = createMarker(new GPoint(-73.79576200,40.96265000),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Iona Preparatory School",'New_Rochelle=' + New_Rochelle.length);
Lincolndale[Lincolndale.length] = createMarker(new GPoint(-73.72510000,41.31730000),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Ives School",'Lincolndale=' + Lincolndale.length);
Somers[Somers.length] = createMarker(new GPoint(-73.68687300,41.30108600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("John F Kennedy Catholic High School",'Somers=' + Somers.length);
Mount_Kisco[Mount_Kisco.length] = createMarker(new GPoint(-73.73001900,41.20455000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Karafin School Inc",'Mount_Kisco=' + Mount_Kisco.length);
Purchase[Purchase.length] = createMarker(new GPoint(-73.71889900,41.02857600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Keio Academy Of New York",'Purchase=' + Purchase.length);
Hartsdale[Hartsdale.length] = createMarker(new GPoint(-73.80924400,41.03269900),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Maria Regina High School",'Hartsdale=' + Hartsdale.length);
Dobbs_Ferry[Dobbs_Ferry.length] = createMarker(new GPoint(-73.87160900,41.01269400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Masters School",'Dobbs_Ferry=' + Dobbs_Ferry.length);
New_Rochelle[New_Rochelle.length] = createMarker(new GPoint(-73.79350400,40.92315300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("New Testament Church School",'New_Rochelle=' + New_Rochelle.length);
White_Plains[White_Plains.length] = createMarker(new GPoint(-73.79857200,41.05379900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ny School For The Deaf",'White_Plains=' + White_Plains.length);
Peekskill[Peekskill.length] = createMarker(new GPoint(-73.91620000,41.28890000),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Ohr Hameir Seminary - Tifereth Israel High School",'Peekskill=' + Peekskill.length);
Dobbs_Ferry[Dobbs_Ferry.length] = createMarker(new GPoint(-73.86998100,41.02042200),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Our Lady Of Victory Academy",'Dobbs_Ferry=' + Dobbs_Ferry.length);
Bedford[Bedford.length] = createMarker(new GPoint(-73.63698100,41.19037200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Rippowam Cisqua School",'Bedford=' + Bedford.length);
Rye[Rye.length] = createMarker(new GPoint(-73.68094800,40.98760000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Rye Country Day School",'Rye=' + Rye.length);
Yonkers[Yonkers.length] = createMarker(new GPoint(-73.88631600,40.94936200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sacred Heart High School",'Yonkers=' + Yonkers.length);
New_Rochelle[New_Rochelle.length] = createMarker(new GPoint(-73.76918400,40.91677700),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Salesian High School",'New_Rochelle=' + New_Rochelle.length);
Rye[Rye.length] = createMarker(new GPoint(-73.70583000,41.01291700),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("School Of The Holy Child",'Rye=' + Rye.length);
Hartsdale[Hartsdale.length] = createMarker(new GPoint(-73.80895500,41.03337400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Solomon Schechter School of Westchester",'Hartsdale=' + Hartsdale.length);
Yorktown_Heights[Yorktown_Heights.length] = createMarker(new GPoint(-73.78321900,41.26853200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Soundview Preparatory School",'Yorktown_Heights=' + Yorktown_Heights.length);
New_Rochelle[New_Rochelle.length] = createMarker(new GPoint(-73.78309300,40.93320200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Thornton-donovan School",'New_Rochelle=' + New_Rochelle.length);
New_Rochelle[New_Rochelle.length] = createMarker(new GPoint(-73.79675300,40.94782800),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("The Ursuline School",'New_Rochelle=' + New_Rochelle.length);
Mamaroneck[Mamaroneck.length] = createMarker(new GPoint(-73.73033600,40.93416500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Westchester Hebrew High School",'Mamaroneck=' + Mamaroneck.length);
Yonkers[Yonkers.length] = createMarker(new GPoint(-73.89213400,40.94133100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Westchester Sch. For Spec Children",'Yonkers=' + Yonkers.length);
North_Salem[North_Salem.length] = createMarker(new GPoint(-73.65664500,41.32619000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Westchstr Excptnl Chldrns School",'North_Salem=' + North_Salem.length);
White_Plains[White_Plains.length] = createMarker(new GPoint(-73.74054000,40.98994000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Windward School",'White_Plains=' + White_Plains.length);
Bedford_Hills[Bedford_Hills.length] = createMarker(new GPoint(-73.71058900,41.23708700),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Yeshiva And Mesivta Ohel Shmuel",'Bedford_Hills=' + Bedford_Hills.length);
Mt_Kisco[Mt_Kisco.length] = createMarker(new GPoint(-73.72580000,41.20350000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Yeshiva Farm Settlement School",'Mt_Kisco=' + Mt_Kisco.length);
Yonkers[Yonkers.length] = createMarker(new GPoint(-73.89494700,40.94213900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Yonkers Christian Academy",'Yonkers=' + Yonkers.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,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/////2/' + showArray);
map.removeOverlays(Bedford);
map.removeOverlays(Bedford_Hills);
map.removeOverlays(Briarcliff_Manor);
map.removeOverlays(Dobbs_Ferry);
map.removeOverlays(Hartsdale);
map.removeOverlays(Katonah);
map.removeOverlays(Lincolndale);
map.removeOverlays(Mamaroneck);
map.removeOverlays(Mount_Kisco);
map.removeOverlays(Mount_Vernon);
map.removeOverlays(Mt_Kisco);
map.removeOverlays(New_Rochelle);
map.removeOverlays(North_Salem);
map.removeOverlays(Ossining);
map.removeOverlays(Peekskill);
map.removeOverlays(Purchase);
map.removeOverlays(Rye);
map.removeOverlays(Somers);
map.removeOverlays(Tarrytown);
map.removeOverlays(White_Plains);
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(White_Plains);map.removeOverlays(Bedford);
map.removeOverlays(Bedford_Hills);
map.removeOverlays(Briarcliff_Manor);
map.removeOverlays(Dobbs_Ferry);
map.removeOverlays(Hartsdale);
map.removeOverlays(Katonah);
map.removeOverlays(Lincolndale);
map.removeOverlays(Mamaroneck);
map.removeOverlays(Mount_Kisco);
map.removeOverlays(Mount_Vernon);
map.removeOverlays(Mt_Kisco);
map.removeOverlays(New_Rochelle);
map.removeOverlays(North_Salem);
map.removeOverlays(Ossining);
map.removeOverlays(Peekskill);
map.removeOverlays(Purchase);
map.removeOverlays(Rye);
map.removeOverlays(Somers);
map.removeOverlays(Tarrytown);
map.removeOverlays(White_Plains);
map.removeOverlays(Yonkers);
map.removeOverlays(Yorktown_Heights);
map.addOverlays(Bedford);
centerByArray(Bedford, false, false);
cntMarker += Bedford.length;
map.addOverlays(Bedford_Hills);
centerByArray(Bedford_Hills, false, false);
cntMarker += Bedford_Hills.length;
map.addOverlays(Briarcliff_Manor);
centerByArray(Briarcliff_Manor, false, false);
cntMarker += Briarcliff_Manor.length;
map.addOverlays(Dobbs_Ferry);
centerByArray(Dobbs_Ferry, false, false);
cntMarker += Dobbs_Ferry.length;
map.addOverlays(Hartsdale);
centerByArray(Hartsdale, false, false);
cntMarker += Hartsdale.length;
map.addOverlays(Katonah);
centerByArray(Katonah, false, false);
cntMarker += Katonah.length;
map.addOverlays(Lincolndale);
centerByArray(Lincolndale, false, false);
cntMarker += Lincolndale.length;
map.addOverlays(Mamaroneck);
centerByArray(Mamaroneck, false, false);
cntMarker += Mamaroneck.length;
map.addOverlays(Mount_Kisco);
centerByArray(Mount_Kisco, false, false);
cntMarker += Mount_Kisco.length;
map.addOverlays(Mount_Vernon);
centerByArray(Mount_Vernon, false, false);
cntMarker += Mount_Vernon.length;
map.addOverlays(Mt_Kisco);
centerByArray(Mt_Kisco, false, false);
cntMarker += Mt_Kisco.length;
map.addOverlays(New_Rochelle);
centerByArray(New_Rochelle, false, false);
cntMarker += New_Rochelle.length;
map.addOverlays(North_Salem);
centerByArray(North_Salem, false, false);
cntMarker += North_Salem.length;
map.addOverlays(Ossining);
centerByArray(Ossining, false, false);
cntMarker += Ossining.length;
map.addOverlays(Peekskill);
centerByArray(Peekskill, false, false);
cntMarker += Peekskill.length;
map.addOverlays(Purchase);
centerByArray(Purchase, false, false);
cntMarker += Purchase.length;
map.addOverlays(Rye);
centerByArray(Rye, false, false);
cntMarker += Rye.length;
map.addOverlays(Somers);
centerByArray(Somers, false, false);
cntMarker += Somers.length;
map.addOverlays(Tarrytown);
centerByArray(Tarrytown, false, false);
cntMarker += Tarrytown.length;
map.addOverlays(White_Plains);
centerByArray(White_Plains, false, false);
cntMarker += White_Plains.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(White_Plains,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');
//window.open('/map.php?type=1&schools=&school_level=2&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;
}