function addMarkers()
{
mySelect = document.getElementById('selection');
Alachua = [];Gainesville = [];Micanopy = [];Archer = [];Hawthorne = [];High_Springs = [];Newberry = [];Waldo = [];mySelect.options[mySelect.options.length] = new Option("Alachua schools",'all=Alachua');
mySelect.options[mySelect.options.length] = new Option("Archer schools",'all=Archer');
mySelect.options[mySelect.options.length] = new Option("Gainesville schools",'all=Gainesville');
mySelect.options[mySelect.options.length] = new Option("Hawthorne schools",'all=Hawthorne');
mySelect.options[mySelect.options.length] = new Option("High Springs schools",'all=High_Springs');
mySelect.options[mySelect.options.length] = new Option("Micanopy schools",'all=Micanopy');
mySelect.options[mySelect.options.length] = new Option("Newberry schools",'all=Newberry');
mySelect.options[mySelect.options.length] = new Option("Waldo schools",'all=Waldo');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Alachua[Alachua.length] = createMarker(new GPoint(-82.49428558,29.80504227),"
",iconBl);
mySelect.options[mySelect.options.length] = new Option("A. L. Mebane Middle School",'Alachua=' + Alachua.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.33596802,29.65754509),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("A.q. Jones/excep. Student Center",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.31095886,29.64234161),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Abraham Lincoln Middle School",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.32318400,29.65195000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Alachua County Superintendent's Office",'Gainesville=' + Gainesville.length);
Alachua[Alachua.length] = createMarker(new GPoint(-82.49009705,29.80669975),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Alachua Elementary School",'Alachua=' + Alachua.length);
Alachua[Alachua.length] = createMarker(new GPoint(-82.49009705,29.80669975),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Alachua Learning Center",'Alachua=' + Alachua.length);
Micanopy[Micanopy.length] = createMarker(new GPoint(-82.27890015,29.48889923),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Alachua Regional Marine Insti",'Micanopy=' + Micanopy.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.30092621,29.66664505),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Anchor School",'Gainesville=' + Gainesville.length);
Archer[Archer.length] = createMarker(new GPoint(-82.52313995,29.52062225),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Archer Community School",'Archer=' + Archer.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.35333252,29.69560432),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("C. W. Norton Elementary School",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.32610321,29.64620018),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Caring & Sharing Learning School",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.32318400,29.65195000),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Character Counts Center",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.29743195,29.65944481),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Charles W. Duval Elementary School",'Gainesville=' + Gainesville.length);
Hawthorne[Hawthorne.length] = createMarker(new GPoint(-82.09116364,29.59426308),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Chester Shell Elementary School",'Hawthorne=' + Hawthorne.length);
Archer[Archer.length] = createMarker(new GPoint(-82.28029633,29.64360046),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Desoto High School, Inc.",'Archer=' + Archer.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.27001953,29.63540077),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Eastside High School",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.40694427,29.60645485),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Einstein Montessori School",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.45093536,29.66700935),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Expressions Learning Arts Academy",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.40119171,29.67764473),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("F. W. Buchholz High School",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.42256165,29.61172295),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Family Progress Center",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.31883400,29.65192000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Florida Online High School",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.29019928,29.71590042),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Florida Siatech At Gainesville High School",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.44485474,29.67426872),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Fort Clarke Middle School",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.30582428,29.68586731),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Fsc-fearnside Center",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.33908081,29.66935349),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Gainesville High School",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.32669830,29.67394447),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Genesis Preparatory School",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.36309814,29.68128395),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Glen Springs Elementary School",'Gainesville=' + Gainesville.length);
Hawthorne[Hawthorne.length] = createMarker(new GPoint(-82.02809906,29.59959984),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hawthorne Junior/senior High School",'Hawthorne=' + Hawthorne.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.30579200,29.68570800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Head Start/prek E I Center",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.35134900,29.68849600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Healthy Learning Academy Charter School",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.44445801,29.67424393),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hidden Oak Elementary School",'Gainesville=' + Gainesville.length);
High_Springs[High_Springs.length] = createMarker(new GPoint(-82.59164429,29.83548355),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("High Springs Elementary School",'High_Springs=' + High_Springs.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.36979675,29.67729950),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Hoggetowne Middle School",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.28955841,29.65944481),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Horizon Center. Alternative School",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.32784700,29.66662500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hospital Homebound",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.31472778,29.66984367),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Howard W. Bishop Middle School",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.34977722,29.60967827),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Idylwild Elementary School",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.34780884,29.65575790),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("J. J. Finley Elementary School",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.30959320,29.64594460),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Joseph Williams Elementary School",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.42233276,29.60745811),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Kanapaha Middle School",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.42253876,29.61128235),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Kimball Wiles Elementary School",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.27102661,29.64834595),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lake Forest Elementary School",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.44612885,29.62816811),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lawton M. Chiles Elementary School",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.37242889,29.65948486),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Littlewood Elementary School",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.32588196,29.67394447),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Love To Learn Educational Center",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.30582428,29.68500328),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Marjorie K Rawlings Elementary School",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.30582428,29.68500328),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Marjorie K. Rawlings Elementary School",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.30580100,29.68877500),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Martin Luther King Academy",'Gainesville=' + Gainesville.length);
Micanopy[Micanopy.length] = createMarker(new GPoint(-82.27890015,29.48889923),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Micanopy Area Cooperative School",'Micanopy=' + Micanopy.length);
Micanopy[Micanopy.length] = createMarker(new GPoint(-82.27890015,29.48889923),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Micanopy Middle School, Inc.",'Micanopy=' + Micanopy.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.31883400,29.65192000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Migrant Non-enrolled Students",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.40889740,29.65444565),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Myra Terwilliger Elementary School",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.28155518,29.68135262),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("N. Florida Juvenile Detention",'Gainesville=' + Gainesville.length);
Newberry[Newberry.length] = createMarker(new GPoint(-82.57569885,29.64879990),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Newberry Elementary School",'Newberry=' + Newberry.length);
Newberry[Newberry.length] = createMarker(new GPoint(-82.61479950,29.63897705),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Newberry High School",'Newberry=' + Newberry.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.31883400,29.65192000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Non-school Migrant",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.28155518,29.68135262),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("North Florida Juvenile Detention Center",'Gainesville=' + Gainesville.length);
Newberry[Newberry.length] = createMarker(new GPoint(-82.61509705,29.55142593),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Oak View Middle School",'Newberry=' + Newberry.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.31301880,29.63841057),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Oasis Enrichment Academy",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.30579376,29.69057846),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("One Room School House Project",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.33605957,29.64058113),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("P.k. Yonge Developmental Research School",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.31369019,29.64834595),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pace",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.37533569,29.62462616),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Prairie View Elementary School",'Gainesville=' + Gainesville.length);
Alachua[Alachua.length] = createMarker(new GPoint(-82.52725983,29.80465126),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Santa Fe High School",'Alachua=' + Alachua.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.30092621,29.66664505),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sidney Lanier Center",'Gainesville=' + Gainesville.length);
High_Springs[High_Springs.length] = createMarker(new GPoint(-82.59164429,29.83548355),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Spring Hill Middle School",'High_Springs=' + High_Springs.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.33064270,29.68776894),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Stephen Foster Elementary School",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.30947113,29.66856194),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("W. A. Metcalfe Elementary School",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.28560638,29.65214539),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("W. Travis Loften High School",'Gainesville=' + Gainesville.length);
Alachua[Alachua.length] = createMarker(new GPoint(-82.49423218,29.79008293),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("W. W. Irby Elementary School",'Alachua=' + Alachua.length);
Waldo[Waldo.length] = createMarker(new GPoint(-82.17166138,29.79137230),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Waldo Community School",'Waldo=' + Waldo.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.37051392,29.66554451),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Westwood Middle School",'Gainesville=' + Gainesville.length);
Gainesville[Gainesville.length] = createMarker(new GPoint(-82.38886261,29.70671654),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("William S. Talbot Elementary School",'Gainesville=' + Gainesville.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(Alachua);
map.removeOverlays(Archer);
map.removeOverlays(Gainesville);
map.removeOverlays(Hawthorne);
map.removeOverlays(High_Springs);
map.removeOverlays(Micanopy);
map.removeOverlays(Newberry);
map.removeOverlays(Waldo);
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(Alachua);map.removeOverlays(Alachua);
map.removeOverlays(Archer);
map.removeOverlays(Gainesville);
map.removeOverlays(Hawthorne);
map.removeOverlays(High_Springs);
map.removeOverlays(Micanopy);
map.removeOverlays(Newberry);
map.removeOverlays(Waldo);
map.addOverlays(Alachua);
centerByArray(Alachua, false, false);
cntMarker += Alachua.length;
map.addOverlays(Archer);
centerByArray(Archer, false, false);
cntMarker += Archer.length;
map.addOverlays(Gainesville);
centerByArray(Gainesville, false, false);
cntMarker += Gainesville.length;
map.addOverlays(Hawthorne);
centerByArray(Hawthorne, false, false);
cntMarker += Hawthorne.length;
map.addOverlays(High_Springs);
centerByArray(High_Springs, false, false);
cntMarker += High_Springs.length;
map.addOverlays(Micanopy);
centerByArray(Micanopy, false, false);
cntMarker += Micanopy.length;
map.addOverlays(Newberry);
centerByArray(Newberry, false, false);
cntMarker += Newberry.length;
map.addOverlays(Waldo);
centerByArray(Waldo, false, false);
cntMarker += Waldo.length;
centerByArray(Alachua,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');
}
}