function addMarkers()
{
mySelect = document.getElementById('selection');
Silver_Spring = [];Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.07183600,39.06450800),"
",iconBl);
mySelect.options[mySelect.options.length] = new Option("A. Mario Loiderman Middle School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.04998016,39.09045029),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Argyle Middle School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.05574799,39.08276749),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bel Pre Elementary School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-76.97344208,39.11033630),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Briggs Chaney Middle School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-76.98432922,39.00815582),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Broad Acres Elementary School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.00283813,39.03874207),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Burnt Mills Elementary School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-76.99389648,39.06950378),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Cannon Road Elementary School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-76.95112610,39.08426666),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Cloverly Elementary School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.02973938,39.04924393),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Col. E. Brooke Lee Middle School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-76.98678589,39.02701569),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Cresthaven Elementary School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-76.98616791,39.09131622),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Dr. Charles R. Drew Elementary School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.01441956,38.99199677),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("East Silver Spring Elementary School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.00266266,39.01215744),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Eastern Middle School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-76.95722961,39.09129715),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Fairland Elementary School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.02094269,39.03402710),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Forest Knolls Elementary School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-76.99079132,39.02827072),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Francis Scott Key Middle School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-76.94494629,39.06313324),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Galway Elementary School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.02646000,39.04779500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Gateway To College Program",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.06307220,39.07586288),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Georgian Forest Elementary School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.11361694,39.02263641),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Glen Haven Elementary School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.04000092,39.06082916),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Glenallan Elementary School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-76.94489288,39.07960129),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Greencastle Elementary School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.07720947,39.07601929),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Harmony Hills Elementary School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.06219482,39.05017853),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Highland Elementary School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.01066589,39.00457001),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Highland View Elementary School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-76.99259949,39.05583572),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Jackson Road Elementary School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.01460266,39.11407852),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("James Hubert Blake High School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.03712463,39.06518936),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("John F. Kennedy High School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.05280304,39.02004242),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mckenney Hills Center",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.01075745,39.01928711),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Montgomery Blair High School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-76.99408722,39.00654221),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Montgomery Knolls Elementary School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-76.99169159,38.99741364),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("New Hampshire Estates Elementary School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.02394300,39.03393700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Northwood High School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.00126648,39.00419617),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Oak View Elementary School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.05577087,39.02972031),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Oakland Terrace Elementary School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.00541687,39.02073288),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pine Crest Elementary School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.04542542,39.00067139),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Rosemary Hills Elementary School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.01231384,38.99982834),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Silver Spring International Middle School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.01594543,39.00126266),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sligo Creek Elementary School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.03101349,39.02500916),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Sligo Middle School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.00360870,39.05792236),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Springbrook High School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.01471710,39.09185791),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Stonegate Elementary School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.06322479,39.08731079),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Strathmore Elementary School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.01468658,38.98484802),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Takoma Park Middle School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.06818500,39.06102500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Thomas Edison High School Of Technology",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.08551025,39.04730988),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Viers Mill Elementary School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.06578827,39.06480789),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Weller Road Elementary School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.01671600,39.07467651),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Westover Elementary School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.06712341,39.06212616),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Wheaton High School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-76.99552917,39.05527496),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("White Oak Middle School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-76.95867920,39.07449722),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("William Tyler Page Elementary School",'Silver_Spring=' + Silver_Spring.length);
Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-77.04669800,39.00598500),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Woodlin Elementary School",'Silver_Spring=' + Silver_Spring.length);
maxLng = -76.94489288;
maxLat = 39.11407852;
minLng = -77.11361694;
minLat = 38.98484802;
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(Silver_Spring);
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(Silver_Spring);map.removeOverlays(Silver_Spring);
map.addOverlays(Silver_Spring);
centerByArray(Silver_Spring, false, false);
cntMarker += Silver_Spring.length;
centerByArray(Silver_Spring,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');
}
}