function addMarkers(){
mySelect = document.getElementById('selection');
Elmont = [];Cedarhurst = [];Woodbury = [];Roosevelt = [];Woodmere = [];Oyster_Bay = [];Merrick = [];East_Norwich = [];Long_Beach = [];Lawrence = [];Uniondale = [];Albertson = [];Hicksville = [];Bethpage = [];Brookville = [];Roslyn = [];Hewlett = [];Mill_Neck = [];Bellmore = [];Great_Neck = [];Syosset = [];Port_Washington = [];Locust_Valley = [];Hempstead = [];Manhasset = [];Glen_Cove = [];Valley_Stream = [];Garden_City = [];Freeport = [];mySelect.options[mySelect.options.length] = new Option("Albertson schools",'all=Albertson');
mySelect.options[mySelect.options.length] = new Option("Bellmore schools",'all=Bellmore');
mySelect.options[mySelect.options.length] = new Option("Bethpage schools",'all=Bethpage');
mySelect.options[mySelect.options.length] = new Option("Brookville schools",'all=Brookville');
mySelect.options[mySelect.options.length] = new Option("Cedarhurst schools",'all=Cedarhurst');
mySelect.options[mySelect.options.length] = new Option("East Norwich schools",'all=East_Norwich');
mySelect.options[mySelect.options.length] = new Option("Elmont schools",'all=Elmont');
mySelect.options[mySelect.options.length] = new Option("Freeport schools",'all=Freeport');
mySelect.options[mySelect.options.length] = new Option("Garden City schools",'all=Garden_City');
mySelect.options[mySelect.options.length] = new Option("Glen Cove schools",'all=Glen_Cove');
mySelect.options[mySelect.options.length] = new Option("Great Neck schools",'all=Great_Neck');
mySelect.options[mySelect.options.length] = new Option("Hempstead schools",'all=Hempstead');
mySelect.options[mySelect.options.length] = new Option("Hewlett schools",'all=Hewlett');
mySelect.options[mySelect.options.length] = new Option("Hicksville schools",'all=Hicksville');
mySelect.options[mySelect.options.length] = new Option("Lawrence schools",'all=Lawrence');
mySelect.options[mySelect.options.length] = new Option("Locust Valley schools",'all=Locust_Valley');
mySelect.options[mySelect.options.length] = new Option("Long Beach schools",'all=Long_Beach');
mySelect.options[mySelect.options.length] = new Option("Manhasset schools",'all=Manhasset');
mySelect.options[mySelect.options.length] = new Option("Merrick schools",'all=Merrick');
mySelect.options[mySelect.options.length] = new Option("Mill Neck schools",'all=Mill_Neck');
mySelect.options[mySelect.options.length] = new Option("Oyster Bay schools",'all=Oyster_Bay');
mySelect.options[mySelect.options.length] = new Option("Port Washington schools",'all=Port_Washington');
mySelect.options[mySelect.options.length] = new Option("Roosevelt schools",'all=Roosevelt');
mySelect.options[mySelect.options.length] = new Option("Roslyn schools",'all=Roslyn');
mySelect.options[mySelect.options.length] = new Option("Syosset schools",'all=Syosset');
mySelect.options[mySelect.options.length] = new Option("Uniondale schools",'all=Uniondale');
mySelect.options[mySelect.options.length] = new Option("Valley Stream schools",'all=Valley_Stream');
mySelect.options[mySelect.options.length] = new Option("Woodbury schools",'all=Woodbury');
mySelect.options[mySelect.options.length] = new Option("Woodmere schools",'all=Woodmere');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Elmont[Elmont.length] = createMarker(new GPoint(-73.72054800,40.69078500),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bible Baptist Academy",'Elmont=' + Elmont.length);
Cedarhurst[Cedarhurst.length] = createMarker(new GPoint(-73.72423000,40.62409100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bible Baptist Academy",'Cedarhurst=' + Cedarhurst.length);
Woodbury[Woodbury.length] = createMarker(new GPoint(-73.47972000,40.82244000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Center For Developmental D",'Woodbury=' + Woodbury.length);
Roosevelt[Roosevelt.length] = createMarker(new GPoint(-73.57515500,40.67950000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Children's Learning Center",'Roosevelt=' + Roosevelt.length);
Woodmere[Woodmere.length] = createMarker(new GPoint(-73.72443700,40.63438400),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Drs Yeshiva High School For Boys",'Woodmere=' + Woodmere.length);
Oyster_Bay[Oyster_Bay.length] = createMarker(new GPoint(-73.49679000,40.85766100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("East Woods School",'Oyster_Bay=' + Oyster_Bay.length);
Merrick[Merrick.length] = createMarker(new GPoint(-73.55527500,40.66602600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Grace Christian Academy",'Merrick=' + Merrick.length);
East_Norwich[East_Norwich.length] = createMarker(new GPoint(-73.53458500,40.84047500),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Harmony Heights",'East_Norwich=' + East_Norwich.length);
Oyster_Bay[Oyster_Bay.length] = createMarker(new GPoint(-73.51677900,40.85425000),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Harmony Heights School",'Oyster_Bay=' + Oyster_Bay.length);
Long_Beach[Long_Beach.length] = createMarker(new GPoint(-73.66082300,40.58883700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Harriet Eisman Community School",'Long_Beach=' + Long_Beach.length);
Cedarhurst[Cedarhurst.length] = createMarker(new GPoint(-73.71995700,40.62426600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hebrew Academy Five Towns Rockaway High School",'Cedarhurst=' + Cedarhurst.length);
Lawrence[Lawrence.length] = createMarker(new GPoint(-73.73996400,40.61230900),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Hebrew Academy Long Bch High School Boys",'Lawrence=' + Lawrence.length);
Uniondale[Uniondale.length] = createMarker(new GPoint(-73.60629800,40.72084000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hebrew Academy Of Nassau County",'Uniondale=' + Uniondale.length);
Albertson[Albertson.length] = createMarker(new GPoint(-73.64111500,40.77124900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Henry Viscardi School",'Albertson=' + Albertson.length);
Hicksville[Hicksville.length] = createMarker(new GPoint(-73.53209200,40.75086300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Holy Trinity Diocesan High School",'Hicksville=' + Hicksville.length);
Uniondale[Uniondale.length] = createMarker(new GPoint(-73.58746600,40.71911300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Kellenberg Memorial High School",'Uniondale=' + Uniondale.length);
Woodmere[Woodmere.length] = createMarker(new GPoint(-73.71432200,40.63429900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lawrence Woodmere Academy",'Woodmere=' + Woodmere.length);
Bethpage[Bethpage.length] = createMarker(new GPoint(-73.48480000,40.73970000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Long Island Christian Academy",'Bethpage=' + Bethpage.length);
Brookville[Brookville.length] = createMarker(new GPoint(-73.55051500,40.81933300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Long Island Lutheran Middle & High School",'Brookville=' + Brookville.length);
Roslyn[Roslyn.length] = createMarker(new GPoint(-73.67014500,40.76415300),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Mesiuta Of Roslyn.",'Roslyn=' + Roslyn.length);
Hewlett[Hewlett.length] = createMarker(new GPoint(-73.70750900,40.64144700),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Mesivta Ateres Yaakov",'Hewlett=' + Hewlett.length);
Long_Beach[Long_Beach.length] = createMarker(new GPoint(-73.67020300,40.58632500),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Mesivta Of Long Beach",'Long_Beach=' + Long_Beach.length);
Mill_Neck[Mill_Neck.length] = createMarker(new GPoint(-73.56690000,40.87334000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mill Neck Manor School For Deaf",'Mill_Neck=' + Mill_Neck.length);
Bethpage[Bethpage.length] = createMarker(new GPoint(-73.48324100,40.72176600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("New Jeresalem Christian Academy",'Bethpage=' + Bethpage.length);
Bellmore[Bellmore.length] = createMarker(new GPoint(-73.52306000,40.65745300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("New Jerusalem Christian Academy",'Bellmore=' + Bellmore.length);
Great_Neck[Great_Neck.length] = createMarker(new GPoint(-73.70442000,40.78220600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("North Shore Hebrew Academy High School",'Great_Neck=' + Great_Neck.length);
Syosset[Syosset.length] = createMarker(new GPoint(-73.48230800,40.82208100),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Our Lady Of Mercy Academy",'Syosset=' + Syosset.length);
Port_Washington[Port_Washington.length] = createMarker(new GPoint(-73.68322500,40.82924000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Port Washington Christian School",'Port_Washington=' + Port_Washington.length);
Locust_Valley[Locust_Valley.length] = createMarker(new GPoint(-73.58581700,40.86778500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Portledge School",'Locust_Valley=' + Locust_Valley.length);
Merrick[Merrick.length] = createMarker(new GPoint(-73.56044600,40.68429900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Progressive School Of Long Island",'Merrick=' + Merrick.length);
Hewlett[Hewlett.length] = createMarker(new GPoint(-73.70087400,40.63810700),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Reenas Bais Yaakov",'Hewlett=' + Hewlett.length);
Hempstead[Hempstead.length] = createMarker(new GPoint(-73.63384900,40.70733300),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sacred Heart Academy",'Hempstead=' + Hempstead.length);
Oyster_Bay[Oyster_Bay.length] = createMarker(new GPoint(-73.52770000,40.86818000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Dominic High School",'Oyster_Bay=' + Oyster_Bay.length);
Manhasset[Manhasset.length] = createMarker(new GPoint(-73.69816000,40.79106100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Mary's High School",'Manhasset=' + Manhasset.length);
Glen_Cove[Glen_Cove.length] = createMarker(new GPoint(-73.61957800,40.85680100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Solomon Schechter Day School Of Nassau County",'Glen_Cove=' + Glen_Cove.length);
Lawrence[Lawrence.length] = createMarker(new GPoint(-73.74042500,40.61210700),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Tiferet High School For Girls (gamala)",'Lawrence=' + Lawrence.length);
Cedarhurst[Cedarhurst.length] = createMarker(new GPoint(-73.72376700,40.61895500),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Torah Academy Of Lawrence-cedarhurst",'Cedarhurst=' + Cedarhurst.length);
Syosset[Syosset.length] = createMarker(new GPoint(-73.50343400,40.79523700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Torah Academy Of Long Island",'Syosset=' + Syosset.length);
Long_Beach[Long_Beach.length] = createMarker(new GPoint(-73.67020300,40.58632500),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Torah High School Long Beach",'Long_Beach=' + Long_Beach.length);
Valley_Stream[Valley_Stream.length] = createMarker(new GPoint(-73.69822100,40.66324200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Valley Stream Christian Academy",'Valley_Stream=' + Valley_Stream.length);
Port_Washington[Port_Washington.length] = createMarker(new GPoint(-73.68022700,40.81364900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Vincent Smith School",'Port_Washington=' + Port_Washington.length);
Garden_City[Garden_City.length] = createMarker(new GPoint(-73.68422000,40.71700000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Waldorf School Of Garden City",'Garden_City=' + Garden_City.length);
Freeport[Freeport.length] = createMarker(new GPoint(-73.58875500,40.65251000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Woodward Children's Center",'Freeport=' + Freeport.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(Albertson);
map.removeOverlays(Bellmore);
map.removeOverlays(Bethpage);
map.removeOverlays(Brookville);
map.removeOverlays(Cedarhurst);
map.removeOverlays(East_Norwich);
map.removeOverlays(Elmont);
map.removeOverlays(Freeport);
map.removeOverlays(Garden_City);
map.removeOverlays(Glen_Cove);
map.removeOverlays(Great_Neck);
map.removeOverlays(Hempstead);
map.removeOverlays(Hewlett);
map.removeOverlays(Hicksville);
map.removeOverlays(Lawrence);
map.removeOverlays(Locust_Valley);
map.removeOverlays(Long_Beach);
map.removeOverlays(Manhasset);
map.removeOverlays(Merrick);
map.removeOverlays(Mill_Neck);
map.removeOverlays(Oyster_Bay);
map.removeOverlays(Port_Washington);
map.removeOverlays(Roosevelt);
map.removeOverlays(Roslyn);
map.removeOverlays(Syosset);
map.removeOverlays(Uniondale);
map.removeOverlays(Valley_Stream);
map.removeOverlays(Woodbury);
map.removeOverlays(Woodmere);
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(Elmont);map.removeOverlays(Albertson);
map.removeOverlays(Bellmore);
map.removeOverlays(Bethpage);
map.removeOverlays(Brookville);
map.removeOverlays(Cedarhurst);
map.removeOverlays(East_Norwich);
map.removeOverlays(Elmont);
map.removeOverlays(Freeport);
map.removeOverlays(Garden_City);
map.removeOverlays(Glen_Cove);
map.removeOverlays(Great_Neck);
map.removeOverlays(Hempstead);
map.removeOverlays(Hewlett);
map.removeOverlays(Hicksville);
map.removeOverlays(Lawrence);
map.removeOverlays(Locust_Valley);
map.removeOverlays(Long_Beach);
map.removeOverlays(Manhasset);
map.removeOverlays(Merrick);
map.removeOverlays(Mill_Neck);
map.removeOverlays(Oyster_Bay);
map.removeOverlays(Port_Washington);
map.removeOverlays(Roosevelt);
map.removeOverlays(Roslyn);
map.removeOverlays(Syosset);
map.removeOverlays(Uniondale);
map.removeOverlays(Valley_Stream);
map.removeOverlays(Woodbury);
map.removeOverlays(Woodmere);
map.addOverlays(Albertson);
centerByArray(Albertson, false, false);
cntMarker += Albertson.length;
map.addOverlays(Bellmore);
centerByArray(Bellmore, false, false);
cntMarker += Bellmore.length;
map.addOverlays(Bethpage);
centerByArray(Bethpage, false, false);
cntMarker += Bethpage.length;
map.addOverlays(Brookville);
centerByArray(Brookville, false, false);
cntMarker += Brookville.length;
map.addOverlays(Cedarhurst);
centerByArray(Cedarhurst, false, false);
cntMarker += Cedarhurst.length;
map.addOverlays(East_Norwich);
centerByArray(East_Norwich, false, false);
cntMarker += East_Norwich.length;
map.addOverlays(Elmont);
centerByArray(Elmont, false, false);
cntMarker += Elmont.length;
map.addOverlays(Freeport);
centerByArray(Freeport, false, false);
cntMarker += Freeport.length;
map.addOverlays(Garden_City);
centerByArray(Garden_City, false, false);
cntMarker += Garden_City.length;
map.addOverlays(Glen_Cove);
centerByArray(Glen_Cove, false, false);
cntMarker += Glen_Cove.length;
map.addOverlays(Great_Neck);
centerByArray(Great_Neck, false, false);
cntMarker += Great_Neck.length;
map.addOverlays(Hempstead);
centerByArray(Hempstead, false, false);
cntMarker += Hempstead.length;
map.addOverlays(Hewlett);
centerByArray(Hewlett, false, false);
cntMarker += Hewlett.length;
map.addOverlays(Hicksville);
centerByArray(Hicksville, false, false);
cntMarker += Hicksville.length;
map.addOverlays(Lawrence);
centerByArray(Lawrence, false, false);
cntMarker += Lawrence.length;
map.addOverlays(Locust_Valley);
centerByArray(Locust_Valley, false, false);
cntMarker += Locust_Valley.length;
map.addOverlays(Long_Beach);
centerByArray(Long_Beach, false, false);
cntMarker += Long_Beach.length;
map.addOverlays(Manhasset);
centerByArray(Manhasset, false, false);
cntMarker += Manhasset.length;
map.addOverlays(Merrick);
centerByArray(Merrick, false, false);
cntMarker += Merrick.length;
map.addOverlays(Mill_Neck);
centerByArray(Mill_Neck, false, false);
cntMarker += Mill_Neck.length;
map.addOverlays(Oyster_Bay);
centerByArray(Oyster_Bay, false, false);
cntMarker += Oyster_Bay.length;
map.addOverlays(Port_Washington);
centerByArray(Port_Washington, false, false);
cntMarker += Port_Washington.length;
map.addOverlays(Roosevelt);
centerByArray(Roosevelt, false, false);
cntMarker += Roosevelt.length;
map.addOverlays(Roslyn);
centerByArray(Roslyn, false, false);
cntMarker += Roslyn.length;
map.addOverlays(Syosset);
centerByArray(Syosset, false, false);
cntMarker += Syosset.length;
map.addOverlays(Uniondale);
centerByArray(Uniondale, false, false);
cntMarker += Uniondale.length;
map.addOverlays(Valley_Stream);
centerByArray(Valley_Stream, false, false);
cntMarker += Valley_Stream.length;
map.addOverlays(Woodbury);
centerByArray(Woodbury, false, false);
cntMarker += Woodbury.length;
map.addOverlays(Woodmere);
centerByArray(Woodmere, false, false);
cntMarker += Woodmere.length;
centerByArray(Elmont,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;
}