function addMarkers()
{
mySelect = document.getElementById('selection');
Pensacola = [];Pensacola[Pensacola.length] = createMarker(new GPoint(-87.23334503,30.42445564),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("A. A. Dixon Elementary School (inact",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.18214417,30.42635536),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("A. K. Suter School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.20407867,30.42376518),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("A. V. Clubbs Center (formerly N.b. C",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.20407867,30.42376518),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("A. V. Clubbs Center (formerly N. B. Cook Elementary School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.24388885,30.41866302),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Allie Yniestra Elementary School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.30613708,30.46840668),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bellview Elementary School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.30253601,30.46372795),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Bellview Middle School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.38116455,30.52816582),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Beulah Academy Of Science",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.35659027,30.50576973),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Beulah Elementary School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.35718536,30.38644409),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Blue Angels Elementary School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.24025726,30.46182823),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Brentwood Elementary School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.24178314,30.48456764),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Brentwood Middle School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.22530365,30.44948959),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Brown Barge Middle School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.25843811,30.43125725),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Brownsville Middle School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.24250031,30.44081879),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("C. A. Weis Elementary School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.28387800,30.43213200),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Capstone Academy",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.19425964,30.46183395),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Cordova Park Elementary School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.20739900,30.45146000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("County Administrative Annex",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.23334503,30.42445564),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Dixon Center",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.28467560,30.39293289),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("E Seal Center",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.26844788,30.40609360),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Edgewater Elementary School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.25014496,30.51784515),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Ensley Elementary School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.36558533,30.32758522),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Escambia Bay Marine Institute",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.30007172,30.42675018),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Escambia High School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.23685455,30.44163704),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Escambia Juvenile Detention",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.22376251,30.44605255),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Escambia School District Jail Program",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.27014160,30.54956055),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Escambia Westgate Center",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.21787262,30.51388931),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Ferry Pass Elementary School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.19712830,30.51274109),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Ferry Pass Middle School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.23078156,30.41038132),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("George S. Hallmark Elementary School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.28985596,30.48644066),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("George Stone Area Vocational-technical Center",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.21208954,30.43224335),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Gulf Coast High School (formerly Ac",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.40795135,30.34671593),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hellen Caro Elementary School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.22376251,30.44605255),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hospital & Homebound",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.20536804,30.48807144),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("J. H. Workman Middle School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.25053406,30.41935158),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Jackie Harris Pyramid School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.40298462,30.34303856),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Jim C. Bailey Middle School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.26979065,30.54783630),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("L. D. Mcarthur Elementary School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.23302460,30.43166351),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lakeview Dropout Prevention",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.23295593,30.43093681),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lakeview Special Education",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.27823639,30.50644875),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lincoln Park Elementary School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.29814148,30.48665619),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Longleaf Elementary School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.23433685,30.43871117),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mcmillian Learning Center",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.25831604,30.45350647),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Montclair Elementary School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.29602051,30.42432976),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Myrtle Grove Elementary School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.20358276,30.42882729),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("N. B. Cook Elementary School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.28965759,30.38859749),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Navy Point Elementary School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.20752716,30.44966888),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("O. J. Semmes Montessori Academy",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.21806000,30.41235200),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("O.a.s.i.s High School Preparatory Academy",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.25911713,30.43161774),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Oakcrest Elementary School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.19737244,30.47744751),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pace Center For Girls",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.21714783,30.42044067),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pace Program",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-81.91243300,28.03175600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pensacola Boy's Base School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.22493744,30.43353081),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pensacola High School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.21403503,30.45484352),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Petree Pre-k (inactiv",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.29385376,30.48657036),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pine Forest High School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.28459167,30.54200935),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pine Meadow Elementary School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.34212494,30.36087799),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pleasant Grove Elementary School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.26993561,30.55370522),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("R. C. Lipscomb Elementary School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.20545959,30.48575020),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Reinherdt Holm Elementary School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.19828033,30.43256569),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ruby J. Gainer Charter School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.17647552,30.48988152),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Scenic Heights Elementary School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.28952789,30.43706322),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sherwood Elementary School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.21239471,30.43414307),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Spencer Bibbs Elementary School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.24743652,30.49673653),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("W. J. Woodham High School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.27813721,30.39052963),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Warrington Elementary School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.27386475,30.40259743),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Warrington Middle School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.21281433,30.48188400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Washington Senior High School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.27021027,30.49189568),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Wedgewood Middle School",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.28985596,30.48644066),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("West Florida High School/technical",'Pensacola=' + Pensacola.length);
Pensacola[Pensacola.length] = createMarker(new GPoint(-87.28188324,30.42022514),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("West Pensacola Elementary School",'Pensacola=' + Pensacola.length);
maxLng = -81.91243300;
maxLat = 30.55370522;
minLng = -87.40795135;
minLat = 28.03175600;
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,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(Pensacola);
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(Pensacola);map.removeOverlays(Pensacola);
map.addOverlays(Pensacola);
centerByArray(Pensacola, false, false);
cntMarker += Pensacola.length;
centerByArray(Pensacola,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');
}
}