function addMarkers()
{
mySelect = document.getElementById('selection');
Largo = [];Largo[Largo.length] = createMarker(new GPoint(-82.79228973,27.91588402),"
",iconBl);
mySelect.options[mySelect.options.length] = new Option("Academy Prep",'Largo=' + Largo.length);
Largo[Largo.length] = createMarker(new GPoint(-82.83224487,27.88491249),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Anona Elementary School",'Largo=' + Largo.length);
Largo[Largo.length] = createMarker(new GPoint(-82.79146900,27.91604500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Boley Juvenile Justice",'Largo=' + Largo.length);
Largo[Largo.length] = createMarker(new GPoint(-82.79225159,27.91375542),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Britt Halfway House",'Largo=' + Largo.length);
Largo[Largo.length] = createMarker(new GPoint(-82.79225159,27.91375542),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Dropout Prevention",'Largo=' + Largo.length);
Largo[Largo.length] = createMarker(new GPoint(-82.79225159,27.91375542),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Family Resources Shelter (i",'Largo=' + Largo.length);
Largo[Largo.length] = createMarker(new GPoint(-82.72532654,27.87896347),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Fitzgerald Middle School",'Largo=' + Largo.length);
Largo[Largo.length] = createMarker(new GPoint(-82.79225159,27.91375542),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Florida Youth Academy - Low Risk (formerly S",'Largo=' + Largo.length);
Largo[Largo.length] = createMarker(new GPoint(-82.77915192,27.89125061),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Fuguitt Elementary School",'Largo=' + Largo.length);
Largo[Largo.length] = createMarker(new GPoint(-82.78489685,27.91773605),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Largo Central Elementary School",'Largo=' + Largo.length);
Largo[Largo.length] = createMarker(new GPoint(-82.78744507,27.92016220),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Largo High School",'Largo=' + Largo.length);
Largo[Largo.length] = createMarker(new GPoint(-82.78489685,27.90916252),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Largo Middle School",'Largo=' + Largo.length);
Largo[Largo.length] = createMarker(new GPoint(-82.79225159,27.91375542),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Leaf Pemhs (formerly Leaf Halfway House) (i",'Largo=' + Largo.length);
Largo[Largo.length] = createMarker(new GPoint(-82.79675293,27.91158104),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mildred Helms Elementary School",'Largo=' + Largo.length);
Largo[Largo.length] = createMarker(new GPoint(-82.82804108,27.86886215),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Oakhurst Elementary School",'Largo=' + Largo.length);
Largo[Largo.length] = createMarker(new GPoint(-82.79225159,27.91375542),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pace Center For Girls (fo",'Largo=' + Largo.length);
Largo[Largo.length] = createMarker(new GPoint(-82.79225159,27.91375542),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pinellas Boot Camp",'Largo=' + Largo.length);
Largo[Largo.length] = createMarker(new GPoint(-82.79225159,27.91375542),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pinellas Boot Camp Transition",'Largo=' + Largo.length);
Largo[Largo.length] = createMarker(new GPoint(-82.79146900,27.91604500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pinellas County Superintendent's Office",'Largo=' + Largo.length);
Largo[Largo.length] = createMarker(new GPoint(-82.79225159,27.91375542),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pinellas Juvenile Detention Center (formerly Pinel",'Largo=' + Largo.length);
Largo[Largo.length] = createMarker(new GPoint(-82.79225159,27.91375542),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pinellas Marine Institute",'Largo=' + Largo.length);
Largo[Largo.length] = createMarker(new GPoint(-82.72401428,27.87923622),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pinellas Park High School",'Largo=' + Largo.length);
Largo[Largo.length] = createMarker(new GPoint(-82.79225159,27.91375542),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pre-k Early Intervention Program-largo Curriculum",'Largo=' + Largo.length);
Largo[Largo.length] = createMarker(new GPoint(-82.80344391,27.89935684),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Ridgecrest Elementary School",'Largo=' + Largo.length);
Largo[Largo.length] = createMarker(new GPoint(-82.76510620,27.87993622),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Southern Oak Elementary School",'Largo=' + Largo.length);
Largo[Largo.length] = createMarker(new GPoint(-82.76507568,27.87993622),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Walsingham Elementary School",'Largo=' + Largo.length);
map.removeOverlays(Largo);
setTimeout(function(){map.addOverlays(Largo)},1000);
maxLng = -82.72401428;
maxLat = 27.92016220;
minLng = -82.83224487;
minLat = 27.86886215;
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(Largo);
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(Largo);map.removeOverlays(Largo);
map.addOverlays(Largo);
centerByArray(Largo, false, false);
cntMarker += Largo.length;
centerByArray(Largo,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');
}
}