function addMarkers()
{
mySelect = document.getElementById('selection');
Decatur = [];Decatur[Decatur.length] = createMarker(new GPoint(-84.22393036,33.74264908),"
",iconRd);
mySelect.options[mySelect.options.length] = new Option("Atherton Elementary School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.24116516,33.69052124),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bob Mathis Elementary School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.26840973,33.83910370),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Briarlake Elementary School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.22101593,33.72074127),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Canby Lane Elementary School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.29180908,33.68633652),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Cedar Grove Middle School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.21938324,33.67930222),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Chapel Hill Elementary School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.21526337,33.67855453),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Chapel Hill Middle School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.29729462,33.78188324),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Clairemont Elementary School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.29626465,33.75675964),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("College Heights Elementary School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.25803375,33.71933746),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Columbia Elementary School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.25179291,33.72834778),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Columbia High School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.25176239,33.69837570),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Columbia Middle School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.28789520,33.82836151),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Coralwood Education Center",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.20240021,33.72135925),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Decatur High School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.27976100,33.80058100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Dekalb Community School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.20304108,33.71976089),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Dekalb High School Of Technology, South Campus",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.27932300,33.69052800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Dekalb Regional Youth Detention Center",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.21723175,33.70940018),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Dekalb Transition School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.29492187,33.77457047),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Fairington Elementary School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.28426361,33.70593643),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Flat Shoals Elementary School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.27126312,33.76768875),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Forrest Hills Elementary School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.23381042,33.75126266),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Glen Haven Elementary School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.29008484,33.77583694),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Glennwood Elementary School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.27232361,33.75222778),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hooper Alexander Elementary School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.25605011,33.77297592),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("International Community Charter",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.28430176,33.71543884),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Kelley Lake Elementary School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.26589203,33.74426651),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Knollwood Elementary School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.27683258,33.81552887),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Laurel Ridge Elementary School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.30792999,33.72713470),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Leslie J. Steele Elementary School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.20251465,33.73269272),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Mary Mcleod Bethune Middle School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.26189423,33.80466461),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mclendon Elementary School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.29883575,33.71784210),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Mcnair Middle School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.28951263,33.80193710),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Medlock Elementary School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.25294495,33.75503540),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Midway Elementary School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.18206024,33.72442627),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Miller Grove Middle School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.22676849,33.66756821),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Narvie Harris Elementary School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.30536652,33.75602722),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Oakhurst At Fifth Avenue Elementary School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.30590057,33.76449966),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Oakhurst Elementary School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.26801000,33.68069500),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Oakview Elementary School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.24673462,33.74853897),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Peachcrest Elementary School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.22409058,33.70368576),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Rainbow Elementary School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.29938507,33.76858902),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Renfroe Middle School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.27230835,33.81868744),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Shamrock Middle School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.24789429,33.73266602),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Snapfinger Elementary School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.22285461,33.70250320),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Southwest Dekalb High School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.29435730,33.72580719),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Tilson Elementary School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.27983856,33.72765350),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Toney Elementary School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.23790741,33.74633789),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Towers High School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.25923157,33.72821045),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Wadsworth Elementary School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.30609131,33.78285599),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Westchester Elementary School",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.29003143,33.76591110),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Winnona Park Elementary School",'Decatur=' + Decatur.length);
maxLng = -84.18206024;
maxLat = 33.83910370;
minLng = -84.30792999;
minLat = 33.66756821;
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(Decatur);
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(Decatur);map.removeOverlays(Decatur);
map.addOverlays(Decatur);
centerByArray(Decatur, false, false);
cntMarker += Decatur.length;
centerByArray(Decatur,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');
}
}