function addMarkers()
{
mySelect = document.getElementById('selection');
Rex = [];Conley = [];Jonesboro = [];Forest_Park = [];Riverdale = [];Lovejoy = [];Ellenwood = [];Hampton = [];Morrow = [];Lake_City = [];College_Park = [];Fayetteville = [];mySelect.options[mySelect.options.length] = new Option("College Park schools",'all=College_Park');
mySelect.options[mySelect.options.length] = new Option("Conley schools",'all=Conley');
mySelect.options[mySelect.options.length] = new Option("Ellenwood schools",'all=Ellenwood');
mySelect.options[mySelect.options.length] = new Option("Fayetteville schools",'all=Fayetteville');
mySelect.options[mySelect.options.length] = new Option("Forest Park schools",'all=Forest_Park');
mySelect.options[mySelect.options.length] = new Option("Hampton schools",'all=Hampton');
mySelect.options[mySelect.options.length] = new Option("Jonesboro schools",'all=Jonesboro');
mySelect.options[mySelect.options.length] = new Option("Lake City schools",'all=Lake_City');
mySelect.options[mySelect.options.length] = new Option("Lovejoy schools",'all=Lovejoy');
mySelect.options[mySelect.options.length] = new Option("Morrow schools",'all=Morrow');
mySelect.options[mySelect.options.length] = new Option("Rex schools",'all=Rex');
mySelect.options[mySelect.options.length] = new Option("Riverdale schools",'all=Riverdale');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Rex[Rex.length] = createMarker(new GPoint(-84.28647614,33.59046173),"
",iconBl);
mySelect.options[mySelect.options.length] = new Option("Adamson Middle School",'Rex=' + Rex.length);
Conley[Conley.length] = createMarker(new GPoint(-84.33364868,33.63992310),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Anderson Elementary School",'Conley=' + Conley.length);
Jonesboro[Jonesboro.length] = createMarker(new GPoint(-84.34564972,33.52685547),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Arnold Elementary School",'Jonesboro=' + Jonesboro.length);
Forest_Park[Forest_Park.length] = createMarker(new GPoint(-84.34947968,33.60287476),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Babb Middle School",'Forest_Park=' + Forest_Park.length);
Jonesboro[Jonesboro.length] = createMarker(new GPoint(-84.36395264,33.49353790),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Brown Elementary School",'Jonesboro=' + Jonesboro.length);
Jonesboro[Jonesboro.length] = createMarker(new GPoint(-84.39403534,33.53493118),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Callaway Elementary School",'Jonesboro=' + Jonesboro.length);
Riverdale[Riverdale.length] = createMarker(new GPoint(-84.41711426,33.56362152),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Church Street Elementary School",'Riverdale=' + Riverdale.length);
Jonesboro[Jonesboro.length] = createMarker(new GPoint(-84.41883850,33.51424026),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Clayton County Alternative Center",'Jonesboro=' + Jonesboro.length);
Lovejoy[Lovejoy.length] = createMarker(new GPoint(-84.30527300,33.43371600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Clayton Regional Youth Detention Center",'Lovejoy=' + Lovejoy.length);
Ellenwood[Ellenwood.length] = createMarker(new GPoint(-84.30024719,33.61260986),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("East Clayton Elementary School",'Ellenwood=' + Ellenwood.length);
Forest_Park[Forest_Park.length] = createMarker(new GPoint(-84.34854889,33.63246536),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Edmonds Elementary School",'Forest_Park=' + Forest_Park.length);
Jonesboro[Jonesboro.length] = createMarker(new GPoint(-84.41883850,33.51424026),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Flint River School",'Jonesboro=' + Jonesboro.length);
Forest_Park[Forest_Park.length] = createMarker(new GPoint(-84.35710144,33.61806107),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Forest Park High School",'Forest_Park=' + Forest_Park.length);
Forest_Park[Forest_Park.length] = createMarker(new GPoint(-84.35983276,33.62143707),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Forest Park Middle School",'Forest_Park=' + Forest_Park.length);
Forest_Park[Forest_Park.length] = createMarker(new GPoint(-84.37251282,33.61228180),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Fountain Elementary School",'Forest_Park=' + Forest_Park.length);
Riverdale[Riverdale.length] = createMarker(new GPoint(-84.39168549,33.56462479),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Harper Elementary School",'Riverdale=' + Riverdale.length);
Hampton[Hampton.length] = createMarker(new GPoint(-84.36758423,33.46258545),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hawthorne Elementary School",'Hampton=' + Hampton.length);
Morrow[Morrow.length] = createMarker(new GPoint(-84.35199738,33.58641052),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Haynie Elementary School",'Morrow=' + Morrow.length);
Forest_Park[Forest_Park.length] = createMarker(new GPoint(-84.37066650,33.63256454),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hendrix Drive Elementary School",'Forest_Park=' + Forest_Park.length);
Forest_Park[Forest_Park.length] = createMarker(new GPoint(-84.34882355,33.63834763),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Huie Elementary School",'Forest_Park=' + Forest_Park.length);
Jonesboro[Jonesboro.length] = createMarker(new GPoint(-84.41883850,33.51424026),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("James Jackson Elementary School",'Jonesboro=' + Jonesboro.length);
Jonesboro[Jonesboro.length] = createMarker(new GPoint(-84.34015656,33.54444122),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Jonesboro High School",'Jonesboro=' + Jonesboro.length);
Jonesboro[Jonesboro.length] = createMarker(new GPoint(-84.35826111,33.52493668),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Jonesboro Middle School",'Jonesboro=' + Jonesboro.length);
Hampton[Hampton.length] = createMarker(new GPoint(-84.35833740,33.45591736),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Kemp Elementary School",'Hampton=' + Hampton.length);
Hampton[Hampton.length] = createMarker(new GPoint(-84.35854600,33.45251800),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Kemp Primary",'Hampton=' + Hampton.length);
Jonesboro[Jonesboro.length] = createMarker(new GPoint(-84.38581848,33.53977966),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Kendrick Middle School",'Jonesboro=' + Jonesboro.length);
Jonesboro[Jonesboro.length] = createMarker(new GPoint(-84.35876465,33.54843521),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Kilpatrick Elementary School",'Jonesboro=' + Jonesboro.length);
Lake_City[Lake_City.length] = createMarker(new GPoint(-84.35667419,33.60807037),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lake City Elementary School",'Lake_City=' + Lake_City.length);
Riverdale[Riverdale.length] = createMarker(new GPoint(-84.41644287,33.54219818),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lake Ridge Elementary School",'Riverdale=' + Riverdale.length);
Jonesboro[Jonesboro.length] = createMarker(new GPoint(-84.35691833,33.52478409),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lee Street Elementary School",'Jonesboro=' + Jonesboro.length);
Riverdale[Riverdale.length] = createMarker(new GPoint(-84.41523900,33.58106500),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lewis Academy Of Excellence",'Riverdale=' + Riverdale.length);
Lovejoy[Lovejoy.length] = createMarker(new GPoint(-84.34004974,33.44886398),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lovejoy High School",'Lovejoy=' + Lovejoy.length);
Lovejoy[Lovejoy.length] = createMarker(new GPoint(-84.34005737,33.44170380),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Lovejoy Middle School",'Lovejoy=' + Lovejoy.length);
Jonesboro[Jonesboro.length] = createMarker(new GPoint(-84.32925415,33.52443314),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("M. D. Roberts Middle School",'Jonesboro=' + Jonesboro.length);
College_Park[College_Park.length] = createMarker(new GPoint(-84.41250100,33.59411200),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Martin Luther King, Jr. Elementary School",'College_Park=' + College_Park.length);
Morrow[Morrow.length] = createMarker(new GPoint(-84.34067535,33.58841324),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Morrow Elementary School",'Morrow=' + Morrow.length);
Morrow[Morrow.length] = createMarker(new GPoint(-84.31346893,33.59551620),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Morrow High School",'Morrow=' + Morrow.length);
Morrow[Morrow.length] = createMarker(new GPoint(-84.31576538,33.59222412),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Morrow Middle School",'Morrow=' + Morrow.length);
Jonesboro[Jonesboro.length] = createMarker(new GPoint(-84.29494476,33.55524826),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mount Zion Elementary School",'Jonesboro=' + Jonesboro.length);
Jonesboro[Jonesboro.length] = createMarker(new GPoint(-84.30761719,33.55410385),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mount Zion High School",'Jonesboro=' + Jonesboro.length);
Jonesboro[Jonesboro.length] = createMarker(new GPoint(-114.30248400,42.52863000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mundy's Mill High School",'Jonesboro=' + Jonesboro.length);
Jonesboro[Jonesboro.length] = createMarker(new GPoint(-116.47494200,43.86461500),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Mundy's Mill Middle School",'Jonesboro=' + Jonesboro.length);
College_Park[College_Park.length] = createMarker(new GPoint(-84.43926239,33.60826111),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("North Clayton High School",'College_Park=' + College_Park.length);
College_Park[College_Park.length] = createMarker(new GPoint(-84.44655609,33.60371780),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("North Clayton Middle School",'College_Park=' + College_Park.length);
College_Park[College_Park.length] = createMarker(new GPoint(-84.44660950,33.60530472),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Northcutt Elementary School",'College_Park=' + College_Park.length);
Riverdale[Riverdale.length] = createMarker(new GPoint(-84.44670868,33.57749939),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Oliver Elementary School",'Riverdale=' + Riverdale.length);
Riverdale[Riverdale.length] = createMarker(new GPoint(-84.41481018,33.52217102),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pointe South Elementary School",'Riverdale=' + Riverdale.length);
Jonesboro[Jonesboro.length] = createMarker(new GPoint(-84.37294769,33.51777649),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Pointe South Middle School",'Jonesboro=' + Jonesboro.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-111.73213900,42.40748500),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("River's Edge Elementary School",'Fayetteville=' + Fayetteville.length);
Riverdale[Riverdale.length] = createMarker(new GPoint(-84.40856934,33.57329941),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Riverdale Elementary School",'Riverdale=' + Riverdale.length);
Riverdale[Riverdale.length] = createMarker(new GPoint(-84.40106964,33.55714417),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Riverdale High School",'Riverdale=' + Riverdale.length);
Riverdale[Riverdale.length] = createMarker(new GPoint(-84.40730100,33.56389200),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Riverdale Middle School",'Riverdale=' + Riverdale.length);
Rex[Rex.length] = createMarker(new GPoint(-84.29078674,33.58136749),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Roberta T. Smith Elementary School",'Rex=' + Rex.length);
Riverdale[Riverdale.length] = createMarker(new GPoint(-84.39169300,33.56446000),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Sequoyah Middle School",'Riverdale=' + Riverdale.length);
Forest_Park[Forest_Park.length] = createMarker(new GPoint(-84.36419200,33.61023900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("South Metro Psychoeducational Program",'Forest_Park=' + Forest_Park.length);
Jonesboro[Jonesboro.length] = createMarker(new GPoint(-84.34534454,33.51424789),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Suder Elementary School",'Jonesboro=' + Jonesboro.length);
Jonesboro[Jonesboro.length] = createMarker(new GPoint(-84.37408447,33.53580093),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Swint Elementary School",'Jonesboro=' + Jonesboro.length);
Morrow[Morrow.length] = createMarker(new GPoint(-84.36116400,33.57144800),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Tara Elementary School",'Morrow=' + Morrow.length);
Morrow[Morrow.length] = createMarker(new GPoint(-84.31900700,33.59339800),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Thurgood Marshall Elementary School",'Morrow=' + Morrow.length);
College_Park[College_Park.length] = createMarker(new GPoint(-84.43196106,33.60312653),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("West Clayton Elementary School",'College_Park=' + College_Park.length);
Morrow[Morrow.length] = createMarker(new GPoint(-84.31834412,33.58286285),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("William M. Mcgarrah Elementary School",'Morrow=' + Morrow.length);
Jonesboro[Jonesboro.length] = createMarker(new GPoint(-84.41883850,33.51424026),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Worktec",'Jonesboro=' + Jonesboro.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,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(College_Park);
map.removeOverlays(Conley);
map.removeOverlays(Ellenwood);
map.removeOverlays(Fayetteville);
map.removeOverlays(Forest_Park);
map.removeOverlays(Hampton);
map.removeOverlays(Jonesboro);
map.removeOverlays(Lake_City);
map.removeOverlays(Lovejoy);
map.removeOverlays(Morrow);
map.removeOverlays(Rex);
map.removeOverlays(Riverdale);
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(Rex);map.removeOverlays(College_Park);
map.removeOverlays(Conley);
map.removeOverlays(Ellenwood);
map.removeOverlays(Fayetteville);
map.removeOverlays(Forest_Park);
map.removeOverlays(Hampton);
map.removeOverlays(Jonesboro);
map.removeOverlays(Lake_City);
map.removeOverlays(Lovejoy);
map.removeOverlays(Morrow);
map.removeOverlays(Rex);
map.removeOverlays(Riverdale);
map.addOverlays(College_Park);
centerByArray(College_Park, false, false);
cntMarker += College_Park.length;
map.addOverlays(Conley);
centerByArray(Conley, false, false);
cntMarker += Conley.length;
map.addOverlays(Ellenwood);
centerByArray(Ellenwood, false, false);
cntMarker += Ellenwood.length;
map.addOverlays(Fayetteville);
centerByArray(Fayetteville, false, false);
cntMarker += Fayetteville.length;
map.addOverlays(Forest_Park);
centerByArray(Forest_Park, false, false);
cntMarker += Forest_Park.length;
map.addOverlays(Hampton);
centerByArray(Hampton, false, false);
cntMarker += Hampton.length;
map.addOverlays(Jonesboro);
centerByArray(Jonesboro, false, false);
cntMarker += Jonesboro.length;
map.addOverlays(Lake_City);
centerByArray(Lake_City, false, false);
cntMarker += Lake_City.length;
map.addOverlays(Lovejoy);
centerByArray(Lovejoy, false, false);
cntMarker += Lovejoy.length;
map.addOverlays(Morrow);
centerByArray(Morrow, false, false);
cntMarker += Morrow.length;
map.addOverlays(Rex);
centerByArray(Rex, false, false);
cntMarker += Rex.length;
map.addOverlays(Riverdale);
centerByArray(Riverdale, false, false);
cntMarker += Riverdale.length;
centerByArray(Rex,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');
}
}