function addMarkers()
{
mySelect = document.getElementById('selection');
Naples = [];Ochopee = [];Immokalee = [];Everglades_City = [];Marco_Island = [];mySelect.options[mySelect.options.length] = new Option("Everglades City schools",'all=Everglades_City');
mySelect.options[mySelect.options.length] = new Option("Immokalee schools",'all=Immokalee');
mySelect.options[mySelect.options.length] = new Option("Marco Island schools",'all=Marco_Island');
mySelect.options[mySelect.options.length] = new Option("Naples schools",'all=Naples');
mySelect.options[mySelect.options.length] = new Option("Ochopee schools",'all=Ochopee');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Naples[Naples.length] = createMarker(new GPoint(-81.75175476,26.10917091),"
",iconRd);
mySelect.options[mySelect.options.length] = new Option("Avalon Elementary School",'Naples=' + Naples.length);
Naples[Naples.length] = createMarker(new GPoint(-81.76824951,26.21473122),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Barron Collier High School",'Naples=' + Naples.length);
Naples[Naples.length] = createMarker(new GPoint(-81.67150116,26.22891426),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Big Cypress Elementary School",'Naples=' + Naples.length);
Ochopee[Ochopee.length] = createMarker(new GPoint(-81.27042000,25.94250100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Big Cypress Wilderness Institute",'Ochopee=' + Ochopee.length);
Naples[Naples.length] = createMarker(new GPoint(-81.71834564,26.14896393),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Calusa Park Elementary School",'Naples=' + Naples.length);
Naples[Naples.length] = createMarker(new GPoint(-81.74353800,26.10987500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Collier County Drop-back-in-academy",'Naples=' + Naples.length);
Naples[Naples.length] = createMarker(new GPoint(-81.76782900,26.24048000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Collier County Superintendent's Office",'Naples=' + Naples.length);
Naples[Naples.length] = createMarker(new GPoint(-81.59422302,26.29235458),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Corkscrew Elementary School",'Naples=' + Naples.length);
Naples[Naples.length] = createMarker(new GPoint(-81.59428406,26.29235268),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Corkscrew Middle School",'Naples=' + Naples.length);
Immokalee[Immokalee.length] = createMarker(new GPoint(-81.41449900,26.39684200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("D.r.i.l.l. Academy",'Immokalee=' + Immokalee.length);
Naples[Naples.length] = createMarker(new GPoint(-81.76432800,26.21473122),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Detention Center",'Naples=' + Naples.length);
Naples[Naples.length] = createMarker(new GPoint(-81.75856781,26.14206886),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("East Naples Middle School",'Naples=' + Naples.length);
Naples[Naples.length] = createMarker(new GPoint(-81.54744100,26.34047800),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Estates Elementary School",'Naples=' + Naples.length);
Everglades_City[Everglades_City.length] = createMarker(new GPoint(-81.38469696,25.85910034),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Everglades City School",'Everglades_City=' + Everglades_City.length);
Naples[Naples.length] = createMarker(new GPoint(-81.76432800,26.21473122),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Excel Program",'Naples=' + Naples.length);
Naples[Naples.length] = createMarker(new GPoint(-81.74540400,26.17322800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("First Collier County Charter School, Inc.",'Naples=' + Naples.length);
Naples[Naples.length] = createMarker(new GPoint(-81.70483398,26.19052696),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Golden Gate Elementary School",'Naples=' + Naples.length);
Naples[Naples.length] = createMarker(new GPoint(-81.69994200,26.16606900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Golden Gate High School",'Naples=' + Naples.length);
Naples[Naples.length] = createMarker(new GPoint(-81.70680237,26.18379974),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Golden Gate Intermediate Center North",'Naples=' + Naples.length);
Naples[Naples.length] = createMarker(new GPoint(-81.70680237,26.18379974),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Golden Gate Intermediate Center South",'Naples=' + Naples.length);
Naples[Naples.length] = createMarker(new GPoint(-81.70446014,26.17795372),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Golden Gate Middle School",'Naples=' + Naples.length);
Naples[Naples.length] = createMarker(new GPoint(-81.69680023,26.17835808),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Golden Terrace Elementary School",'Naples=' + Naples.length);
Naples[Naples.length] = createMarker(new GPoint(-81.71005249,26.27312851),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Gulf Coast High School",'Naples=' + Naples.length);
Naples[Naples.length] = createMarker(new GPoint(-81.79940033,26.14390755),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Gulfview Middle School",'Naples=' + Naples.length);
Immokalee[Immokalee.length] = createMarker(new GPoint(-81.42774963,26.43284607),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Highlands Elementary School",'Immokalee=' + Immokalee.length);
Naples[Naples.length] = createMarker(new GPoint(-81.76730347,26.24309921),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hospital/homebound",'Naples=' + Naples.length);
Immokalee[Immokalee.length] = createMarker(new GPoint(-81.76432800,26.21473122),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Immokalee Area Teenage Parenting Program",'Immokalee=' + Immokalee.length);
Immokalee[Immokalee.length] = createMarker(new GPoint(-81.42584991,26.42223740),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Immokalee Community School",'Immokalee=' + Immokalee.length);
Immokalee[Immokalee.length] = createMarker(new GPoint(-81.42305756,26.42546272),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Immokalee High School",'Immokalee=' + Immokalee.length);
Immokalee[Immokalee.length] = createMarker(new GPoint(-81.42550659,26.42548561),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Immokalee Middle School",'Immokalee=' + Immokalee.length);
Naples[Naples.length] = createMarker(new GPoint(-81.76208600,26.14220800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Internet Based High School",'Naples=' + Naples.length);
Naples[Naples.length] = createMarker(new GPoint(-81.58322144,26.25576019),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lake Park Elementary School",'Naples=' + Naples.length);
Immokalee[Immokalee.length] = createMarker(new GPoint(-81.43106079,26.43280029),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lake Trafford Elementary School",'Immokalee=' + Immokalee.length);
Naples[Naples.length] = createMarker(new GPoint(-81.71322632,26.27312851),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Laurel Oak Elementary School",'Naples=' + Naples.length);
Immokalee[Immokalee.length] = createMarker(new GPoint(-81.42550659,26.42565727),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Learning Center",'Immokalee=' + Immokalee.length);
Naples[Naples.length] = createMarker(new GPoint(-81.69445038,26.10320091),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lely Elementary School",'Naples=' + Naples.length);
Naples[Naples.length] = createMarker(new GPoint(-81.71187592,26.09272957),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lely High School",'Naples=' + Naples.length);
Naples[Naples.length] = createMarker(new GPoint(-81.68750000,26.04758453),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Manatee Elementary School",'Naples=' + Naples.length);
Naples[Naples.length] = createMarker(new GPoint(-81.68746185,26.04758835),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Manatee Middle School",'Naples=' + Naples.length);
Marco_Island[Marco_Island.length] = createMarker(new GPoint(-81.71231079,25.94103622),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Marco Island Charter Middle School",'Marco_Island=' + Marco_Island.length);
Naples[Naples.length] = createMarker(new GPoint(-81.76432800,26.21473122),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Naples Area Teenage Parenting Program High School",'Naples=' + Naples.length);
Naples[Naples.length] = createMarker(new GPoint(-81.79714966,26.17098618),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Naples High School",'Naples=' + Naples.length);
Naples[Naples.length] = createMarker(new GPoint(-81.81104279,26.27216339),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Naples Park Elementary School",'Naples=' + Naples.length);
Naples[Naples.length] = createMarker(new GPoint(-81.74109650,26.15159988),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Naples Technology Academy",'Naples=' + Naples.length);
Naples[Naples.length] = createMarker(new GPoint(-81.76432800,26.21473122),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("New Beginnings - Naples Middle School",'Naples=' + Naples.length);
Immokalee[Immokalee.length] = createMarker(new GPoint(-81.76432800,26.21473122),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("New Beginnings Alternative",'Immokalee=' + Immokalee.length);
Naples[Naples.length] = createMarker(new GPoint(-81.76246000,26.29994700),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("North Naples Middle School",'Naples=' + Naples.length);
Naples[Naples.length] = createMarker(new GPoint(-81.68915558,26.26424217),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Oakridge Middle School",'Naples=' + Naples.length);
Naples[Naples.length] = createMarker(new GPoint(-81.75942230,26.21900558),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Osceola Elementary School",'Naples=' + Naples.length);
Immokalee[Immokalee.length] = createMarker(new GPoint(-81.76432800,26.21473122),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pace Program",'Immokalee=' + Immokalee.length);
Naples[Naples.length] = createMarker(new GPoint(-81.57666700,26.29388100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Palmetto Ridge High School",'Naples=' + Naples.length);
Naples[Naples.length] = createMarker(new GPoint(-81.76660919,26.13936806),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pelican Marsh Elementary School",'Naples=' + Naples.length);
Naples[Naples.length] = createMarker(new GPoint(-81.76432800,26.21473122),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Phoenix Program",'Naples=' + Naples.length);
Immokalee[Immokalee.length] = createMarker(new GPoint(-81.42042300,26.40782100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Phoenix Program-immokalee",'Immokalee=' + Immokalee.length);
Naples[Naples.length] = createMarker(new GPoint(-81.78936005,26.21114731),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Pine Ridge Middle School",'Naples=' + Naples.length);
Immokalee[Immokalee.length] = createMarker(new GPoint(-81.42530060,26.41621017),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pinecrest Elementary School",'Immokalee=' + Immokalee.length);
Naples[Naples.length] = createMarker(new GPoint(-81.76641083,26.12700081),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Poinciana Elementary School",'Naples=' + Naples.length);
Immokalee[Immokalee.length] = createMarker(new GPoint(-81.42559814,26.42195129),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Redlands Christian Migrant Association Charter School",'Immokalee=' + Immokalee.length);
Naples[Naples.length] = createMarker(new GPoint(-81.59380341,26.29260063),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sabal Palm Elementary School",'Naples=' + Naples.length);
Naples[Naples.length] = createMarker(new GPoint(-81.80420685,26.21096611),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sea Gate Elementary School",'Naples=' + Naples.length);
Naples[Naples.length] = createMarker(new GPoint(-81.77050781,26.13301849),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Shadowlawn Elementary School",'Naples=' + Naples.length);
Naples[Naples.length] = createMarker(new GPoint(-81.76432800,26.21473122),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sunshine School",'Naples=' + Naples.length);
Marco_Island[Marco_Island.length] = createMarker(new GPoint(-81.71236420,25.93865204),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Tommie Barfield Elementary School",'Marco_Island=' + Marco_Island.length);
Immokalee[Immokalee.length] = createMarker(new GPoint(-81.39573669,26.40724373),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Village Oaks Elementary School",'Immokalee=' + Immokalee.length);
Naples[Naples.length] = createMarker(new GPoint(-81.72035217,26.22982788),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Vineyards Elementary School",'Naples=' + Naples.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(Everglades_City);
map.removeOverlays(Immokalee);
map.removeOverlays(Marco_Island);
map.removeOverlays(Naples);
map.removeOverlays(Ochopee);
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(Naples);map.removeOverlays(Everglades_City);
map.removeOverlays(Immokalee);
map.removeOverlays(Marco_Island);
map.removeOverlays(Naples);
map.removeOverlays(Ochopee);
map.addOverlays(Everglades_City);
centerByArray(Everglades_City, false, false);
cntMarker += Everglades_City.length;
map.addOverlays(Immokalee);
centerByArray(Immokalee, false, false);
cntMarker += Immokalee.length;
map.addOverlays(Marco_Island);
centerByArray(Marco_Island, false, false);
cntMarker += Marco_Island.length;
map.addOverlays(Naples);
centerByArray(Naples, false, false);
cntMarker += Naples.length;
map.addOverlays(Ochopee);
centerByArray(Ochopee, false, false);
cntMarker += Ochopee.length;
centerByArray(Naples,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');
}
}