function addMarkers(){
mySelect = document.getElementById('selection');
Alpharetta = [];Atlanta = [];Augusta = [];Bainbridge = [];Dacula = [];Dalton = [];Decatur = [];Douglasville = [];East_Point = [];Hinesville = [];La_Grange = [];Lake_Park = [];Loganville = [];Norcross = [];Peachtree_City = [];Quitman = [];Savannah = [];Stillmore = [];Thomasville = [];Tifton = [];Waynesboro = [];Winston = [];mySelect.options[mySelect.options.length] = new Option("Alpharetta schools",'all=Alpharetta');
mySelect.options[mySelect.options.length] = new Option("Atlanta schools",'all=Atlanta');
mySelect.options[mySelect.options.length] = new Option("Augusta schools",'all=Augusta');
mySelect.options[mySelect.options.length] = new Option("Bainbridge schools",'all=Bainbridge');
mySelect.options[mySelect.options.length] = new Option("Dacula schools",'all=Dacula');
mySelect.options[mySelect.options.length] = new Option("Dalton schools",'all=Dalton');
mySelect.options[mySelect.options.length] = new Option("Decatur schools",'all=Decatur');
mySelect.options[mySelect.options.length] = new Option("Douglasville schools",'all=Douglasville');
mySelect.options[mySelect.options.length] = new Option("East Point schools",'all=East_Point');
mySelect.options[mySelect.options.length] = new Option("Hinesville schools",'all=Hinesville');
mySelect.options[mySelect.options.length] = new Option("La Grange schools",'all=La_Grange');
mySelect.options[mySelect.options.length] = new Option("Lake Park schools",'all=Lake_Park');
mySelect.options[mySelect.options.length] = new Option("Loganville schools",'all=Loganville');
mySelect.options[mySelect.options.length] = new Option("Norcross schools",'all=Norcross');
mySelect.options[mySelect.options.length] = new Option("Peachtree City schools",'all=Peachtree_City');
mySelect.options[mySelect.options.length] = new Option("Quitman schools",'all=Quitman');
mySelect.options[mySelect.options.length] = new Option("Savannah schools",'all=Savannah');
mySelect.options[mySelect.options.length] = new Option("Stillmore schools",'all=Stillmore');
mySelect.options[mySelect.options.length] = new Option("Thomasville schools",'all=Thomasville');
mySelect.options[mySelect.options.length] = new Option("Tifton schools",'all=Tifton');
mySelect.options[mySelect.options.length] = new Option("Waynesboro schools",'all=Waynesboro');
mySelect.options[mySelect.options.length] = new Option("Winston schools",'all=Winston');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Alpharetta[Alpharetta.length] = createMarker(new GPoint(-84.29240600,34.06564900),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cre'me De La Creme",'Alpharetta=' + Alpharetta.length);
Atlanta[Atlanta.length] = createMarker(new GPoint(-84.38587400,33.76439300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Canterbury School",'Atlanta=' + Atlanta.length);
Atlanta[Atlanta.length] = createMarker(new GPoint(-84.38692000,33.83022700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Cathedral Preschool",'Atlanta=' + Atlanta.length);
Atlanta[Atlanta.length] = createMarker(new GPoint(-84.40160000,33.75473700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mount Vernon Baptist Church Academy",'Atlanta=' + Atlanta.length);
Atlanta[Atlanta.length] = createMarker(new GPoint(-84.42230000,33.86230000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Annes Day School",'Atlanta=' + Atlanta.length);
Atlanta[Atlanta.length] = createMarker(new GPoint(-84.50873800,33.69839000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ben Hill Umc Christian Academy",'Atlanta=' + Atlanta.length);
Atlanta[Atlanta.length] = createMarker(new GPoint(-84.42560700,33.75816500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Edelman Center",'Atlanta=' + Atlanta.length);
Augusta[Augusta.length] = createMarker(new GPoint(-82.08871400,33.48285200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Montessori School Of Augusta",'Augusta=' + Augusta.length);
Bainbridge[Bainbridge.length] = createMarker(new GPoint(-84.55623800,30.91650600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Morningside Cwe",'Bainbridge=' + Bainbridge.length);
Dacula[Dacula.length] = createMarker(new GPoint(-83.89002500,34.02640200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Child's World",'Dacula=' + Dacula.length);
Dalton[Dalton.length] = createMarker(new GPoint(-84.97107300,34.75423700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Rock Hill School",'Dalton=' + Dalton.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.29251600,33.77572100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Decatur First Umc Weekday Childrens Ministries",'Decatur=' + Decatur.length);
Decatur[Decatur.length] = createMarker(new GPoint(-84.29463900,33.77446300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Decatur Presbyterian Children's Community",'Decatur=' + Decatur.length);
Douglasville[Douglasville.length] = createMarker(new GPoint(-84.72968500,33.74082700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sunbrook Academy At Creekside",'Douglasville=' + Douglasville.length);
East_Point[East_Point.length] = createMarker(new GPoint(-84.47740200,33.66441100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mount Olive Early Learning Center",'East_Point=' + East_Point.length);
Hinesville[Hinesville.length] = createMarker(new GPoint(-81.59612700,31.84893000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Fumc Preschool And Kindergarten",'Hinesville=' + Hinesville.length);
La_Grange[La_Grange.length] = createMarker(new GPoint(-85.03797800,33.03936300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("First United Methodist - Elc",'La_Grange=' + La_Grange.length);
Lake_Park[Lake_Park.length] = createMarker(new GPoint(-83.24086200,30.70210500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Apostolic Christian Training",'Lake_Park=' + Lake_Park.length);
Loganville[Loganville.length] = createMarker(new GPoint(-83.86602300,33.82826400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bright Beginnings Preschool",'Loganville=' + Loganville.length);
Norcross[Norcross.length] = createMarker(new GPoint(-84.21955400,33.97815800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Creme De La Creme",'Norcross=' + Norcross.length);
Peachtree_City[Peachtree_City.length] = createMarker(new GPoint(-84.57090300,33.41454200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Andrew's Preschool And Kindergarten",'Peachtree_City=' + Peachtree_City.length);
Quitman[Quitman.length] = createMarker(new GPoint(-83.55457900,30.77950900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("First Baptist Kindergarten",'Quitman=' + Quitman.length);
Savannah[Savannah.length] = createMarker(new GPoint(-81.10895700,32.03952000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Emmanuel Christian School",'Savannah=' + Savannah.length);
Savannah[Savannah.length] = createMarker(new GPoint(-81.11509200,32.04838300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("West Side Academy",'Savannah=' + Savannah.length);
Stillmore[Stillmore.length] = createMarker(new GPoint(-82.21540000,32.44080000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("David Emanuel Academy",'Stillmore=' + Stillmore.length);
Thomasville[Thomasville.length] = createMarker(new GPoint(-84.04890000,30.75900000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Thomas Episcopal School",'Thomasville=' + Thomasville.length);
Tifton[Tifton.length] = createMarker(new GPoint(-83.53655500,31.47767900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mother Goose Kindergarten",'Tifton=' + Tifton.length);
Tifton[Tifton.length] = createMarker(new GPoint(-83.50957400,31.47276300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Northside Baptist Weekday Education Program",'Tifton=' + Tifton.length);
Waynesboro[Waynesboro.length] = createMarker(new GPoint(-82.01535400,33.09024500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Marie's Creative Kids Kindergarten",'Waynesboro=' + Waynesboro.length);
Winston[Winston.length] = createMarker(new GPoint(-84.81751700,33.72957600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Winston Academy Child Care Center",'Winston=' + Winston.length);
map.removeOverlays(Alpharetta);
map.removeOverlays(Atlanta);
map.removeOverlays(Augusta);
map.removeOverlays(Bainbridge);
map.removeOverlays(Dacula);
map.removeOverlays(Dalton);
map.removeOverlays(Decatur);
map.removeOverlays(Douglasville);
map.removeOverlays(East_Point);
map.removeOverlays(Hinesville);
map.removeOverlays(La_Grange);
map.removeOverlays(Lake_Park);
map.removeOverlays(Loganville);
map.removeOverlays(Norcross);
map.removeOverlays(Peachtree_City);
map.removeOverlays(Quitman);
map.removeOverlays(Savannah);
map.removeOverlays(Stillmore);
map.removeOverlays(Thomasville);
map.removeOverlays(Tifton);
map.removeOverlays(Waynesboro);
map.removeOverlays(Winston);
setTimeout(function(){map.addOverlays(Alpharetta)},1000);
setTimeout(function(){map.addOverlays(Atlanta)},1000);
setTimeout(function(){map.addOverlays(Augusta)},1000);
setTimeout(function(){map.addOverlays(Bainbridge)},1000);
setTimeout(function(){map.addOverlays(Dacula)},1000);
setTimeout(function(){map.addOverlays(Dalton)},1000);
setTimeout(function(){map.addOverlays(Decatur)},1000);
setTimeout(function(){map.addOverlays(Douglasville)},1000);
setTimeout(function(){map.addOverlays(East_Point)},1000);
setTimeout(function(){map.addOverlays(Hinesville)},1000);
setTimeout(function(){map.addOverlays(La_Grange)},1000);
setTimeout(function(){map.addOverlays(Lake_Park)},1000);
setTimeout(function(){map.addOverlays(Loganville)},1000);
setTimeout(function(){map.addOverlays(Norcross)},1000);
setTimeout(function(){map.addOverlays(Peachtree_City)},1000);
setTimeout(function(){map.addOverlays(Quitman)},1000);
setTimeout(function(){map.addOverlays(Savannah)},1000);
setTimeout(function(){map.addOverlays(Stillmore)},1000);
setTimeout(function(){map.addOverlays(Thomasville)},1000);
setTimeout(function(){map.addOverlays(Tifton)},1000);
setTimeout(function(){map.addOverlays(Waynesboro)},1000);
setTimeout(function(){map.addOverlays(Winston)},1000);
maxLng = -81.10895700;
maxLat = 34.75423700;
minLng = -85.03797800;
minLat = 30.70210500;
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,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//////' + showArray);
map.removeOverlays(Alpharetta);
map.removeOverlays(Atlanta);
map.removeOverlays(Augusta);
map.removeOverlays(Bainbridge);
map.removeOverlays(Dacula);
map.removeOverlays(Dalton);
map.removeOverlays(Decatur);
map.removeOverlays(Douglasville);
map.removeOverlays(East_Point);
map.removeOverlays(Hinesville);
map.removeOverlays(La_Grange);
map.removeOverlays(Lake_Park);
map.removeOverlays(Loganville);
map.removeOverlays(Norcross);
map.removeOverlays(Peachtree_City);
map.removeOverlays(Quitman);
map.removeOverlays(Savannah);
map.removeOverlays(Stillmore);
map.removeOverlays(Thomasville);
map.removeOverlays(Tifton);
map.removeOverlays(Waynesboro);
map.removeOverlays(Winston);
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(Alpharetta);map.removeOverlays(Alpharetta);
map.removeOverlays(Atlanta);
map.removeOverlays(Augusta);
map.removeOverlays(Bainbridge);
map.removeOverlays(Dacula);
map.removeOverlays(Dalton);
map.removeOverlays(Decatur);
map.removeOverlays(Douglasville);
map.removeOverlays(East_Point);
map.removeOverlays(Hinesville);
map.removeOverlays(La_Grange);
map.removeOverlays(Lake_Park);
map.removeOverlays(Loganville);
map.removeOverlays(Norcross);
map.removeOverlays(Peachtree_City);
map.removeOverlays(Quitman);
map.removeOverlays(Savannah);
map.removeOverlays(Stillmore);
map.removeOverlays(Thomasville);
map.removeOverlays(Tifton);
map.removeOverlays(Waynesboro);
map.removeOverlays(Winston);
map.addOverlays(Alpharetta);
centerByArray(Alpharetta, false, false);
cntMarker += Alpharetta.length;
map.addOverlays(Atlanta);
centerByArray(Atlanta, false, false);
cntMarker += Atlanta.length;
map.addOverlays(Augusta);
centerByArray(Augusta, false, false);
cntMarker += Augusta.length;
map.addOverlays(Bainbridge);
centerByArray(Bainbridge, false, false);
cntMarker += Bainbridge.length;
map.addOverlays(Dacula);
centerByArray(Dacula, false, false);
cntMarker += Dacula.length;
map.addOverlays(Dalton);
centerByArray(Dalton, false, false);
cntMarker += Dalton.length;
map.addOverlays(Decatur);
centerByArray(Decatur, false, false);
cntMarker += Decatur.length;
map.addOverlays(Douglasville);
centerByArray(Douglasville, false, false);
cntMarker += Douglasville.length;
map.addOverlays(East_Point);
centerByArray(East_Point, false, false);
cntMarker += East_Point.length;
map.addOverlays(Hinesville);
centerByArray(Hinesville, false, false);
cntMarker += Hinesville.length;
map.addOverlays(La_Grange);
centerByArray(La_Grange, false, false);
cntMarker += La_Grange.length;
map.addOverlays(Lake_Park);
centerByArray(Lake_Park, false, false);
cntMarker += Lake_Park.length;
map.addOverlays(Loganville);
centerByArray(Loganville, false, false);
cntMarker += Loganville.length;
map.addOverlays(Norcross);
centerByArray(Norcross, false, false);
cntMarker += Norcross.length;
map.addOverlays(Peachtree_City);
centerByArray(Peachtree_City, false, false);
cntMarker += Peachtree_City.length;
map.addOverlays(Quitman);
centerByArray(Quitman, false, false);
cntMarker += Quitman.length;
map.addOverlays(Savannah);
centerByArray(Savannah, false, false);
cntMarker += Savannah.length;
map.addOverlays(Stillmore);
centerByArray(Stillmore, false, false);
cntMarker += Stillmore.length;
map.addOverlays(Thomasville);
centerByArray(Thomasville, false, false);
cntMarker += Thomasville.length;
map.addOverlays(Tifton);
centerByArray(Tifton, false, false);
cntMarker += Tifton.length;
map.addOverlays(Waynesboro);
centerByArray(Waynesboro, false, false);
cntMarker += Waynesboro.length;
map.addOverlays(Winston);
centerByArray(Winston, false, false);
cntMarker += Winston.length;
centerByArray(Alpharetta,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=2&schools=&school_level=&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;
}