function addMarkers(){
mySelect = document.getElementById('selection');
Staten_Island = [];mySelect.options[mySelect.options.length] = new Option("Staten Island schools",'all=Staten_Island');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.08566000,40.59686100),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Academy Of St Dorothy",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.12612600,40.62800700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Blessed Sacrament School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.09131500,40.63116100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Building Blocks Montessori School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.10421300,40.64522700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Childrens Harbor Montessori School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.07705500,40.64291100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Childrens Life Christian Academy",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.14850100,40.63336100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Eden II School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.13108000,40.61441700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("El Bethel Christian Academy",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.16768500,40.55272500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Eltingville Lutheran School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.22993600,40.52440800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Gateway Academy",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.07615600,40.59597100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Holy Rosary Elementary School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.08281300,40.62429700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Immaculate Conception School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.15027600,40.61503000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Jewish Foundation School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.14024900,40.60241600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Jewish Foundation School-ecc",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.08537100,40.63467300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Miraj Islamic School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.08537200,40.63471300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mi'raj Islamic School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.11471100,40.57152100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("New Dorp Christian Academy",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.08823000,40.62937400),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Notre Dame Academy Elementary School",'Staten_Island=' + Staten_Island.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);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.15269400,40.60884700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Oakdale Academy Campus",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.24313200,40.50938700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Our Lady Help Of Christians",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.08632800,40.63148300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Our Lady Of Good Counsel",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.12554100,40.63317400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Our Lady Of Mt Carmel-st Benedicta School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.11810500,40.57621700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Our Lady Queen Of Peace School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.19010300,40.53294700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Our Lady Star Of The Sea",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.15027600,40.61503000),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Rabbi Jacob Joseph School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.13755700,40.57299100),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Rabbi Jacob Joseph School For Boys",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.11409900,40.63357900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sacred Heart School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.09683800,40.59076400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Ann School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.06763200,40.61589700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Mary's School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.13953000,40.57248700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Patrick School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.09784800,40.64131600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Paul's School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.14356900,40.62796800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Roch School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.09045200,40.60697400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Sylvester School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.21027100,40.52644800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ss Joseph & Thomas School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.14708900,40.63014300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Adalbert School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.11828800,40.56395500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Charles School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.10859200,40.58183300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Christopher School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.15083300,40.54672800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Clare School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.06866800,40.60223400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St John Villa Academy-elem",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.12157300,40.61111400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Johns Lutheran School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.07201800,40.61447200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Joseph Parochial School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.09473200,40.57173400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Margaret Mary School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.08314100,40.64769100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Peter's Es",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.13094700,40.60483800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Rita School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.15130000,40.60420000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Teresa School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.11045900,40.59335600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Staten Island Academy",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.13626800,40.61243600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Staten Island Montessori School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.15178800,40.56721000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Tanglewood School",'Staten_Island=' + Staten_Island.length);
Staten_Island[Staten_Island.length] = createMarker(new GPoint(-74.08098500,40.63046000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Trinity Lutheran School",'Staten_Island=' + Staten_Island.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/////1/' + 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');
//window.open('/map.php?type=1&schools=&school_level=1&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;
}