function addMarkers()
{
mySelect = document.getElementById('selection');
Jacksonville = [];Jacksonville[Jacksonville.length] = createMarker(new GPoint(-81.67539978,30.36538887),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("A. Philip Randolph Academies High School",'Jacksonville=' + Jacksonville.length);
Jacksonville[Jacksonville.length] = createMarker(new GPoint(-81.69998932,30.37736702),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Carter G. Woodson Elementary School",'Jacksonville=' + Jacksonville.length);
Jacksonville[Jacksonville.length] = createMarker(new GPoint(-81.66683960,30.34554863),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Darnell Cookman Middle School",'Jacksonville=' + Jacksonville.length);
Jacksonville[Jacksonville.length] = createMarker(new GPoint(-81.70047760,30.35473633),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Duval Halfway House",'Jacksonville=' + Jacksonville.length);
Jacksonville[Jacksonville.length] = createMarker(new GPoint(-81.68532562,30.33771515),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Eugene J. Butler Middle School",'Jacksonville=' + Jacksonville.length);
Jacksonville[Jacksonville.length] = createMarker(new GPoint(-81.71082306,30.36955643),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("George Washington Carver Elementary School",'Jacksonville=' + Jacksonville.length);
Jacksonville[Jacksonville.length] = createMarker(new GPoint(-81.70047760,30.35473633),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Grand Park Career Center",'Jacksonville=' + Jacksonville.length);
Jacksonville[Jacksonville.length] = createMarker(new GPoint(-81.68721771,30.34826279),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("James Weldon Johnson Middle School",'Jacksonville=' + Jacksonville.length);
Jacksonville[Jacksonville.length] = createMarker(new GPoint(-81.67076111,30.33899689),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("John E. Ford Elementary School",'Jacksonville=' + Jacksonville.length);
Jacksonville[Jacksonville.length] = createMarker(new GPoint(-81.67003632,30.34703255),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mt. Herman Ese Center",'Jacksonville=' + Jacksonville.length);
Jacksonville[Jacksonville.length] = createMarker(new GPoint(-81.69365692,30.37146378),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Northwestern Middle School",'Jacksonville=' + Jacksonville.length);
Jacksonville[Jacksonville.length] = createMarker(new GPoint(-81.70047760,30.35473633),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pretrial Detention Facility",'Jacksonville=' + Jacksonville.length);
Jacksonville[Jacksonville.length] = createMarker(new GPoint(-81.69036865,30.35283661),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("R. V. Daniels Elementary School",'Jacksonville=' + Jacksonville.length);
Jacksonville[Jacksonville.length] = createMarker(new GPoint(-81.72720337,30.38007164),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Rufus E. Payne Elementary School",'Jacksonville=' + Jacksonville.length);
Jacksonville[Jacksonville.length] = createMarker(new GPoint(-81.68589783,30.37153244),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Saint Clair Evans Academy",'Jacksonville=' + Jacksonville.length);
Jacksonville[Jacksonville.length] = createMarker(new GPoint(-81.67210700,30.36531100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("School Of Integrated Academics And Technology",'Jacksonville=' + Jacksonville.length);
Jacksonville[Jacksonville.length] = createMarker(new GPoint(-81.68871307,30.33923912),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Smart Pope Livingston Elementary School",'Jacksonville=' + Jacksonville.length);
Jacksonville[Jacksonville.length] = createMarker(new GPoint(-81.67271423,30.35153770),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Stanton College Preparatory",'Jacksonville=' + Jacksonville.length);
Jacksonville[Jacksonville.length] = createMarker(new GPoint(-81.68914795,30.35143661),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Susie E. Tolbert Elementary School",'Jacksonville=' + Jacksonville.length);
Jacksonville[Jacksonville.length] = createMarker(new GPoint(-81.69520569,30.33728409),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("West Jacksonville Elementary School",'Jacksonville=' + Jacksonville.length);
Jacksonville[Jacksonville.length] = createMarker(new GPoint(-81.70791626,30.38207054),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("William M. Raines High School",'Jacksonville=' + Jacksonville.length);
Jacksonville[Jacksonville.length] = createMarker(new GPoint(-81.70047760,30.35473633),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Youth Development Center",'Jacksonville=' + Jacksonville.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(Jacksonville);
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(Jacksonville);map.removeOverlays(Jacksonville);
map.addOverlays(Jacksonville);
centerByArray(Jacksonville, false, false);
cntMarker += Jacksonville.length;
centerByArray(Jacksonville,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');
}
}