function addMarkers(){
mySelect = document.getElementById('selection');
Lithia_Springs = [];Dahlonega = [];Thomasville = [];Marietta = [];Conyers = [];Mcintyre = [];Covington = [];Lincolnton = [];Norcross = [];Grovetown = [];Jersey = [];Hazlehurst = [];Moultrie = [];Waynesboro = [];Twin_City = [];Valdosta = [];Loganville = [];Rockmart = [];Powder_Springs = [];Blackshear = [];mySelect.options[mySelect.options.length] = new Option("Blackshear schools",'all=Blackshear');
mySelect.options[mySelect.options.length] = new Option("Conyers schools",'all=Conyers');
mySelect.options[mySelect.options.length] = new Option("Covington schools",'all=Covington');
mySelect.options[mySelect.options.length] = new Option("Dahlonega schools",'all=Dahlonega');
mySelect.options[mySelect.options.length] = new Option("Grovetown schools",'all=Grovetown');
mySelect.options[mySelect.options.length] = new Option("Hazlehurst schools",'all=Hazlehurst');
mySelect.options[mySelect.options.length] = new Option("Jersey schools",'all=Jersey');
mySelect.options[mySelect.options.length] = new Option("Lincolnton schools",'all=Lincolnton');
mySelect.options[mySelect.options.length] = new Option("Lithia Springs schools",'all=Lithia_Springs');
mySelect.options[mySelect.options.length] = new Option("Loganville schools",'all=Loganville');
mySelect.options[mySelect.options.length] = new Option("Marietta schools",'all=Marietta');
mySelect.options[mySelect.options.length] = new Option("Mcintyre schools",'all=Mcintyre');
mySelect.options[mySelect.options.length] = new Option("Moultrie schools",'all=Moultrie');
mySelect.options[mySelect.options.length] = new Option("Norcross schools",'all=Norcross');
mySelect.options[mySelect.options.length] = new Option("Powder Springs schools",'all=Powder_Springs');
mySelect.options[mySelect.options.length] = new Option("Rockmart schools",'all=Rockmart');
mySelect.options[mySelect.options.length] = new Option("Thomasville schools",'all=Thomasville');
mySelect.options[mySelect.options.length] = new Option("Twin City schools",'all=Twin_City');
mySelect.options[mySelect.options.length] = new Option("Valdosta schools",'all=Valdosta');
mySelect.options[mySelect.options.length] = new Option("Waynesboro schools",'all=Waynesboro');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Lithia_Springs[Lithia_Springs.length] = createMarker(new GPoint(-84.64001400,33.78331100),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Atlanta West Pentecostal Academy",'Lithia_Springs=' + Lithia_Springs.length);
Dahlonega[Dahlonega.length] = createMarker(new GPoint(-83.98372400,34.43849900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bay Creek Christian Academy",'Dahlonega=' + Dahlonega.length);
Thomasville[Thomasville.length] = createMarker(new GPoint(-83.99009700,30.92316800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Calvary Christian School",'Thomasville=' + Thomasville.length);
Marietta[Marietta.length] = createMarker(new GPoint(-84.56853900,33.90053000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cobb County Christian Schools",'Marietta=' + Marietta.length);
Conyers[Conyers.length] = createMarker(new GPoint(-83.97671900,33.68140500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Conyers Apostolic Christian Academy",'Conyers=' + Conyers.length);
Mcintyre[Mcintyre.length] = createMarker(new GPoint(-83.19940000,32.87720000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cornerstone Christian Academy",'Mcintyre=' + Mcintyre.length);
Covington[Covington.length] = createMarker(new GPoint(-83.96022700,33.48778400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Covington Christian Academy",'Covington=' + Covington.length);
Lincolnton[Lincolnton.length] = createMarker(new GPoint(-82.46150200,33.75483000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Faith Christian Academy",'Lincolnton=' + Lincolnton.length);
Norcross[Norcross.length] = createMarker(new GPoint(-84.23075000,33.96871400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Faith Life Christian Academy",'Norcross=' + Norcross.length);
Grovetown[Grovetown.length] = createMarker(new GPoint(-82.13491100,33.47541200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Greater Augusta Christian Academy",'Grovetown=' + Grovetown.length);
Jersey[Jersey.length] = createMarker(new GPoint(-83.80040000,33.71870000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Jersey Christian Academy",'Jersey=' + Jersey.length);
Hazlehurst[Hazlehurst.length] = createMarker(new GPoint(-82.63329900,31.68585000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Landmark Christian Academy",'Hazlehurst=' + Hazlehurst.length);
Moultrie[Moultrie.length] = createMarker(new GPoint(-83.68820500,31.09531500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Liberty Faith Christian Academy",'Moultrie=' + Moultrie.length);
Waynesboro[Waynesboro.length] = createMarker(new GPoint(-81.91846000,33.11896100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lords House Of Praise Christian School",'Waynesboro=' + Waynesboro.length);
Twin_City[Twin_City.length] = createMarker(new GPoint(-82.19866900,32.59289000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("New Testament Christian Academy",'Twin_City=' + Twin_City.length);
Valdosta[Valdosta.length] = createMarker(new GPoint(-83.26455900,30.90676000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("One Way Christian Academy",'Valdosta=' + Valdosta.length);
Loganville[Loganville.length] = createMarker(new GPoint(-83.96495000,33.79466600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pentecostal Lighthouse",'Loganville=' + Loganville.length);
Rockmart[Rockmart.length] = createMarker(new GPoint(-85.03926100,34.00356300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Rockmart Christian School",'Rockmart=' + Rockmart.length);
Powder_Springs[Powder_Springs.length] = createMarker(new GPoint(-84.68985300,33.90259600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Trinity Chapel Academy",'Powder_Springs=' + Powder_Springs.length);
Blackshear[Blackshear.length] = createMarker(new GPoint(-82.24233900,31.30820200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Truth Christian Academy",'Blackshear=' + Blackshear.length);
map.removeOverlays(Blackshear);
map.removeOverlays(Conyers);
map.removeOverlays(Covington);
map.removeOverlays(Dahlonega);
map.removeOverlays(Grovetown);
map.removeOverlays(Hazlehurst);
map.removeOverlays(Jersey);
map.removeOverlays(Lincolnton);
map.removeOverlays(Lithia_Springs);
map.removeOverlays(Loganville);
map.removeOverlays(Marietta);
map.removeOverlays(Mcintyre);
map.removeOverlays(Moultrie);
map.removeOverlays(Norcross);
map.removeOverlays(Powder_Springs);
map.removeOverlays(Rockmart);
map.removeOverlays(Thomasville);
map.removeOverlays(Twin_City);
map.removeOverlays(Valdosta);
map.removeOverlays(Waynesboro);
setTimeout(function(){map.addOverlays(Blackshear)},1000);
setTimeout(function(){map.addOverlays(Conyers)},1000);
setTimeout(function(){map.addOverlays(Covington)},1000);
setTimeout(function(){map.addOverlays(Dahlonega)},1000);
setTimeout(function(){map.addOverlays(Grovetown)},1000);
setTimeout(function(){map.addOverlays(Hazlehurst)},1000);
setTimeout(function(){map.addOverlays(Jersey)},1000);
setTimeout(function(){map.addOverlays(Lincolnton)},1000);
setTimeout(function(){map.addOverlays(Lithia_Springs)},1000);
setTimeout(function(){map.addOverlays(Loganville)},1000);
setTimeout(function(){map.addOverlays(Marietta)},1000);
setTimeout(function(){map.addOverlays(Mcintyre)},1000);
setTimeout(function(){map.addOverlays(Moultrie)},1000);
setTimeout(function(){map.addOverlays(Norcross)},1000);
setTimeout(function(){map.addOverlays(Powder_Springs)},1000);
setTimeout(function(){map.addOverlays(Rockmart)},1000);
setTimeout(function(){map.addOverlays(Thomasville)},1000);
setTimeout(function(){map.addOverlays(Twin_City)},1000);
setTimeout(function(){map.addOverlays(Valdosta)},1000);
setTimeout(function(){map.addOverlays(Waynesboro)},1000);
maxLng = -81.91846000;
maxLat = 34.43849900;
minLng = -85.03926100;
minLat = 30.90676000;
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(Blackshear);
map.removeOverlays(Conyers);
map.removeOverlays(Covington);
map.removeOverlays(Dahlonega);
map.removeOverlays(Grovetown);
map.removeOverlays(Hazlehurst);
map.removeOverlays(Jersey);
map.removeOverlays(Lincolnton);
map.removeOverlays(Lithia_Springs);
map.removeOverlays(Loganville);
map.removeOverlays(Marietta);
map.removeOverlays(Mcintyre);
map.removeOverlays(Moultrie);
map.removeOverlays(Norcross);
map.removeOverlays(Powder_Springs);
map.removeOverlays(Rockmart);
map.removeOverlays(Thomasville);
map.removeOverlays(Twin_City);
map.removeOverlays(Valdosta);
map.removeOverlays(Waynesboro);
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(Lithia_Springs);map.removeOverlays(Blackshear);
map.removeOverlays(Conyers);
map.removeOverlays(Covington);
map.removeOverlays(Dahlonega);
map.removeOverlays(Grovetown);
map.removeOverlays(Hazlehurst);
map.removeOverlays(Jersey);
map.removeOverlays(Lincolnton);
map.removeOverlays(Lithia_Springs);
map.removeOverlays(Loganville);
map.removeOverlays(Marietta);
map.removeOverlays(Mcintyre);
map.removeOverlays(Moultrie);
map.removeOverlays(Norcross);
map.removeOverlays(Powder_Springs);
map.removeOverlays(Rockmart);
map.removeOverlays(Thomasville);
map.removeOverlays(Twin_City);
map.removeOverlays(Valdosta);
map.removeOverlays(Waynesboro);
map.addOverlays(Blackshear);
centerByArray(Blackshear, false, false);
cntMarker += Blackshear.length;
map.addOverlays(Conyers);
centerByArray(Conyers, false, false);
cntMarker += Conyers.length;
map.addOverlays(Covington);
centerByArray(Covington, false, false);
cntMarker += Covington.length;
map.addOverlays(Dahlonega);
centerByArray(Dahlonega, false, false);
cntMarker += Dahlonega.length;
map.addOverlays(Grovetown);
centerByArray(Grovetown, false, false);
cntMarker += Grovetown.length;
map.addOverlays(Hazlehurst);
centerByArray(Hazlehurst, false, false);
cntMarker += Hazlehurst.length;
map.addOverlays(Jersey);
centerByArray(Jersey, false, false);
cntMarker += Jersey.length;
map.addOverlays(Lincolnton);
centerByArray(Lincolnton, false, false);
cntMarker += Lincolnton.length;
map.addOverlays(Lithia_Springs);
centerByArray(Lithia_Springs, false, false);
cntMarker += Lithia_Springs.length;
map.addOverlays(Loganville);
centerByArray(Loganville, false, false);
cntMarker += Loganville.length;
map.addOverlays(Marietta);
centerByArray(Marietta, false, false);
cntMarker += Marietta.length;
map.addOverlays(Mcintyre);
centerByArray(Mcintyre, false, false);
cntMarker += Mcintyre.length;
map.addOverlays(Moultrie);
centerByArray(Moultrie, false, false);
cntMarker += Moultrie.length;
map.addOverlays(Norcross);
centerByArray(Norcross, false, false);
cntMarker += Norcross.length;
map.addOverlays(Powder_Springs);
centerByArray(Powder_Springs, false, false);
cntMarker += Powder_Springs.length;
map.addOverlays(Rockmart);
centerByArray(Rockmart, false, false);
cntMarker += Rockmart.length;
map.addOverlays(Thomasville);
centerByArray(Thomasville, false, false);
cntMarker += Thomasville.length;
map.addOverlays(Twin_City);
centerByArray(Twin_City, false, false);
cntMarker += Twin_City.length;
map.addOverlays(Valdosta);
centerByArray(Valdosta, false, false);
cntMarker += Valdosta.length;
map.addOverlays(Waynesboro);
centerByArray(Waynesboro, false, false);
cntMarker += Waynesboro.length;
centerByArray(Lithia_Springs,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///33140,7626,7552,7729,32333,7767,33139,31147,32337,7615,7628,7792,7919,7586,31157,7869,7803,7626,31152,7552,7729,32333,7767,33139,31147,32337,7615,7628,7792,33504,30525,7919,7586,31157,7869,7803,/all');
//window.open('/map.php?type=2&schools=33140,7626,7552,7729,32333,7767,33139,31147,32337,7615,7628,7792,7919,7586,31157,7869,7803,7626,31152,7552,7729,32333,7767,33139,31147,32337,7615,7628,7792,33504,30525,7919,7586,31157,7869,7803,&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;
}