function addMarkers()
{
mySelect = document.getElementById('selection');
Athens = [];Athens[Athens.length] = createMarker(new GPoint(-83.40913391,33.94534302),"
",iconRd);
mySelect.options[mySelect.options.length] = new Option("Alps Road Elementary School",'Athens=' + Athens.length);
Athens[Athens.length] = createMarker(new GPoint(-83.32731628,33.93497849),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Alternative Placement Program",'Athens=' + Athens.length);
Athens[Athens.length] = createMarker(new GPoint(-83.31968900,33.95463000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Athens Regional Youth Detention Center",'Athens=' + Athens.length);
Athens[Athens.length] = createMarker(new GPoint(-83.33643341,33.90169525),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Barnett Shoals Elementary School",'Athens=' + Athens.length);
Athens[Athens.length] = createMarker(new GPoint(-83.38152313,33.94090652),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Barrow Elementary School",'Athens=' + Athens.length);
Athens[Athens.length] = createMarker(new GPoint(-83.47335815,33.98919296),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Burney-harris-lyons Middle School",'Athens=' + Athens.length);
Athens[Athens.length] = createMarker(new GPoint(-83.32984161,33.92301178),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cedar Shoals High School",'Athens=' + Athens.length);
Athens[Athens.length] = createMarker(new GPoint(-83.39310455,33.96501160),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Chase Street Elementary School",'Athens=' + Athens.length);
Athens[Athens.length] = createMarker(new GPoint(-83.38736725,33.95156860),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Clarke Central High School",'Athens=' + Athens.length);
Athens[Athens.length] = createMarker(new GPoint(-83.32731628,33.93497849),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Clarke County Evening School",'Athens=' + Athens.length);
Athens[Athens.length] = createMarker(new GPoint(-83.40367889,33.94588852),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Clarke Middle School",'Athens=' + Athens.length);
Athens[Athens.length] = createMarker(new GPoint(-83.32731628,33.93497849),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Classic City Performance Learning Center",'Athens=' + Athens.length);
Athens[Athens.length] = createMarker(new GPoint(-83.30001831,33.98903275),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Coile Middle School",'Athens=' + Athens.length);
Athens[Athens.length] = createMarker(new GPoint(-83.35759735,33.97276306),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Fourth Street Elementary School",'Athens=' + Athens.length);
Athens[Athens.length] = createMarker(new GPoint(-83.36241150,33.98897171),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Fowler Drive Elementary School",'Athens=' + Athens.length);
Athens[Athens.length] = createMarker(new GPoint(-83.32579803,33.93631744),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Gaines Elementary School",'Athens=' + Athens.length);
Athens[Athens.length] = createMarker(new GPoint(-83.33667755,33.92850876),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Hilsman Middle School",'Athens=' + Athens.length);
Athens[Athens.length] = createMarker(new GPoint(-83.42245483,33.96256638),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Oglethorpe Avenue Elementary School",'Athens=' + Athens.length);
Athens[Athens.length] = createMarker(new GPoint(-83.39768200,33.95239700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Rutland Psychoeducational Program",'Athens=' + Athens.length);
Athens[Athens.length] = createMarker(new GPoint(-83.49925232,34.03984833),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("South Jackson Elementary School",'Athens=' + Athens.length);
Athens[Athens.length] = createMarker(new GPoint(-83.44791412,33.93696976),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Timothy Elementary School",'Athens=' + Athens.length);
Athens[Athens.length] = createMarker(new GPoint(-83.31575775,33.90226364),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Whit Davis Road Elementary School",'Athens=' + Athens.length);
Athens[Athens.length] = createMarker(new GPoint(-83.43396759,33.97986221),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Whitehead Road Elementary School",'Athens=' + Athens.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(Athens);
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(Athens);map.removeOverlays(Athens);
map.addOverlays(Athens);
centerByArray(Athens, false, false);
cntMarker += Athens.length;
centerByArray(Athens,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');
}
}