function addMarkers()
{
mySelect = document.getElementById('selection');
Syracuse = [];Syracuse[Syracuse.length] = createMarker(new GPoint(-76.14418030,43.03566742),"
",iconRd);
mySelect.options[mySelect.options.length] = new Option("Applied Sci Magnet At M L K Community School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.15037537,43.02982330),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Beard School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.17235565,43.03023529),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bellevue Elementary School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.16481018,43.04506683),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Blodgett Elementary School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.09624481,43.09959030),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Boces Onondaga-cortland-madison Elementary School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.18118286,43.03388214),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Catholic Charities Of Syracuse",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.14367676,43.04761887),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Central Ny Charter School For Math &",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.21154785,43.04486465),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Cherry Road Elementary School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.14340210,43.00920105),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Clary Math/science Magnet Middle School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.17405701,43.01950455),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Corcoran High School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.14957428,43.01994324),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Danforth Magnet Elementary School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.17274475,43.03916550),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Delaware Elementary School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.13324738,43.05536652),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Dr. Edwin E. Weeks Elementary School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.12242889,43.03026199),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Edward Smith Elementary School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.09848022,43.04690170),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Elmcrest Childrens Ctr/girls Campus",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.15972900,43.02042389),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Elmwood Elementary School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.14333344,42.99676514),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Frank G. Mccarthy School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.14665222,43.06252670),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Franklin Magnet School - Arts & Musi",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.17295074,43.05206680),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Frazer School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.14735413,43.00502777),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Friendship House",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.17433167,43.04408646),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("George Fowler High School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.14938354,43.07405472),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Grant Middle School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.09564209,43.04762650),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("H.w. Smith Elementary School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.12004852,43.05876541),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Henninger High School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.18458557,43.01140976),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hillbrook Detention Home",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.13468933,43.02396774),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hughes Academy Magnet School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.11094666,43.06166458),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Huntington School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.14018250,43.04553604),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hutchings Child & Youth Svcs",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.17533875,43.03181076),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("James A. Shea Middle School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.14996338,43.08267975),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lemoyne Elementary School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.12574768,43.06382751),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Lincoln Middle School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.13244629,43.08406448),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lyncourt School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.14313507,43.01780319),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mckinley-brighton Magnet Elementary School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.14727783,42.98686600),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Meachem Elementary School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.09745789,43.04271698),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Nottingham High School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.14119720,43.04606247),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ocdmh Day Treatment Prog For Chldrn",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.18137360,43.00650787),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Onondaga Hill Middle School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.23443604,43.04124832),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Onondaga Road Elementary School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.18764496,43.05346680),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Porter School Of Technical & Career Explo",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.16481018,43.04506683),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Prekindergarten Prog",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.17063141,43.01965332),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Roberts School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.14754486,43.10076523),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Roxboro Road Elementary School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.14870453,43.10061646),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Roxboro Road Middle School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.12754822,43.07024765),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Salem Hyde Elementary School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.15786743,43.04175949),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Seymour Magnet School - Intntl Human",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.10614777,43.04586411),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Solace Elementary School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.14734650,43.04813004),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Southside Academy Charter School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.17320251,43.05329895),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Syracuse Acad-sci Charter School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.11583710,43.04517746),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("T. Aaron Levy Middle School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.14539337,43.07911682),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Umr Group Home",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.15354919,43.00686646),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Van Duyn Elementary School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.22274780,43.04216766),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Walberta Park Primary School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.13944244,43.07516479),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Webster Elementary School",'Syracuse=' + Syracuse.length);
Syracuse[Syracuse.length] = createMarker(new GPoint(-76.20178223,43.02911758),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Westhill Senior High School",'Syracuse=' + Syracuse.length);
maxLng = -76.09564209;
maxLat = 43.10076523;
minLng = -76.23443604;
minLat = 42.98686600;
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(Syracuse);
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(Syracuse);map.removeOverlays(Syracuse);
map.addOverlays(Syracuse);
centerByArray(Syracuse, false, false);
cntMarker += Syracuse.length;
centerByArray(Syracuse,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');
}
}