function addMarkers()
{
mySelect = document.getElementById('selection');
Bradenton = [];Holmes_Beach = [];Palmetto = [];Sarasota = [];Myakka_City = [];mySelect.options[mySelect.options.length] = new Option("Bradenton schools",'all=Bradenton');
mySelect.options[mySelect.options.length] = new Option("Holmes Beach schools",'all=Holmes_Beach');
mySelect.options[mySelect.options.length] = new Option("Myakka City schools",'all=Myakka_City');
mySelect.options[mySelect.options.length] = new Option("Palmetto schools",'all=Palmetto');
mySelect.options[mySelect.options.length] = new Option("Sarasota schools",'all=Sarasota');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.60248566,27.44776344),"
",iconBl);
mySelect.options[mySelect.options.length] = new Option("A. Lee Middle School",'Bradenton=' + Bradenton.length);
Holmes_Beach[Holmes_Beach.length] = createMarker(new GPoint(-82.71275330,27.50203896),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Anna Maria Elementary School",'Holmes_Beach=' + Holmes_Beach.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.57935333,27.49163818),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Ballard Elementary School",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.58785248,27.43271446),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bayshore Elementary School",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.59555817,27.44592094),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bayshore High School",'Bradenton=' + Bradenton.length);
Palmetto[Palmetto.length] = createMarker(new GPoint(-82.52465820,27.52893639),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Blackburn Elementary School",'Palmetto=' + Palmetto.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.55835724,27.42943764),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Blanche H. Daughtrey Elementary School",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.43604279,27.43142128),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Braden River Elementary School",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.47761500,27.44615400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Braden River High School",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.43634033,27.42960739),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Braden River Middle School",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.44551086,27.48581314),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Carlos E. Haile Middle School",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.58754730,27.47661018),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Center Academy",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.59564209,27.44222260),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Community High School",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.56449127,27.49516296),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Early Intervention Elementary School",'Bradenton=' + Bradenton.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.56303406,27.39663696),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Easter Seals",'Sarasota=' + Sarasota.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.42849000,27.50181600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Florida Sheriff's Youth Ranch",'Bradenton=' + Bradenton.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.55205536,27.41551018),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Florine J. Abel Elementary School",'Sarasota=' + Sarasota.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.53035736,27.48302460),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Frances Wakeland Elementary School",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.42489624,27.50090027),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Freedom Elementary School",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.36841583,27.50972748),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Gene Witt Elementary School",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.41819763,27.40920067),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Gilbert W. Mcneal Elementary School",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.55664062,27.49664879),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Gulf Coast Marine Institute High School",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.61595154,27.46746254),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("H. S. Moody Elementary School",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.54634094,27.48390770),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Head Start Of Manatee County Elementary School",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.59556580,27.44885254),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Horizons Academy",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.57089996,27.49519920),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hospital Homebound Instruction",'Bradenton=' + Bradenton.length);
Myakka_City[Myakka_City.length] = createMarker(new GPoint(-82.16921997,27.45961952),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hurricane Island Outward Bound High School",'Myakka_City=' + Myakka_City.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.63964844,27.51218414),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Ida M. Stewart Elementary School",'Bradenton=' + Bradenton.length);
Palmetto[Palmetto.length] = createMarker(new GPoint(-82.55013275,27.53952789),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("James Tillman Elementary School",'Palmetto=' + Palmetto.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.60305786,27.49566269),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Jessie P. Miller Elementary School",'Bradenton=' + Bradenton.length);
Palmetto[Palmetto.length] = createMarker(new GPoint(-82.58274841,27.52143669),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Just For Girls",'Palmetto=' + Palmetto.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.56694031,27.48344040),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Juvenile Detention Center",'Bradenton=' + Bradenton.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.48064423,27.33524513),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Kanner Academy",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.51959991,27.40363693),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Kinnan Elementary School",'Sarasota=' + Sarasota.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.43116760,27.43845177),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lakewood Ranch Senior High School",'Bradenton=' + Bradenton.length);
Palmetto[Palmetto.length] = createMarker(new GPoint(-82.56130981,27.52826309),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Lincoln Middle School",'Palmetto=' + Palmetto.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.53813171,27.47703171),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Louise R. Johnson Middle School",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.57089996,27.49519920),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Manasota Arc",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.54872131,27.46676254),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Manatee Adolescence Treatment",'Bradenton=' + Bradenton.length);
Palmetto[Palmetto.length] = createMarker(new GPoint(-82.53984070,27.64205933),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Manatee Co. Juvenile Justice",'Palmetto=' + Palmetto.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.57806900,27.49550000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Manatee County Superintendent's Office",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.54536438,27.49481583),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Manatee Elementary School",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.53942108,27.47676277),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Manatee Glens",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.56694031,27.48332214),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Manatee Glens Adolescent Center",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.57407379,27.49801826),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Manatee High School",'Bradenton=' + Bradenton.length);
Palmetto[Palmetto.length] = createMarker(new GPoint(-82.55233765,27.51661110),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Manatee School For Arts",'Palmetto=' + Palmetto.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.59393311,27.46745110),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Manatee School Of Arts/sciences",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.59564209,27.44222260),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Manatee Technical Institute High School",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.63665771,27.50454140),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Martha B. King Middle School",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.57807400,27.49550000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Migrant Toid-terminal Operator",'Bradenton=' + Bradenton.length);
Myakka_City[Myakka_City.length] = createMarker(new GPoint(-82.22679901,27.39130020),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Myakka City Elementary School",'Myakka_City=' + Myakka_City.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.53625488,27.44887543),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Oneco Elementary School",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.56600189,27.47353745),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Orange Ridge-bullock Elementary School",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.56147003,27.48796272),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pal Academy Charter Middle School",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.56147003,27.48796272),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pal Opportunity Charter School",'Bradenton=' + Bradenton.length);
Palmetto[Palmetto.length] = createMarker(new GPoint(-82.55665588,27.56778526),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Palm View Elementary School",'Palmetto=' + Palmetto.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.62962341,27.50343704),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Palma Sola Elementary School",'Bradenton=' + Bradenton.length);
Palmetto[Palmetto.length] = createMarker(new GPoint(-82.57345581,27.51773643),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Palmetto Elementary School",'Palmetto=' + Palmetto.length);
Palmetto[Palmetto.length] = createMarker(new GPoint(-82.57815552,27.52873611),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Palmetto High School",'Palmetto=' + Palmetto.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.57041931,27.40356636),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pinnacle Academy, Inc.",'Sarasota=' + Sarasota.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.58775330,27.46929741),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Practical & Cultural Education-pace",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.56449127,27.49516296),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Prek Handicapped Elementary School",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.39473000,27.42344400),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("R. Dan Nolan Middle School",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.61255646,27.46097374),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ramsay Youth Services",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.62423706,27.48508644),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Richard Milburn Academy",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.59809875,27.47117233),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Robert H. Prine Elementary School",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.41510700,27.40946000),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Robert Willis Elementary School",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.55481700,27.46916000),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Rowlett Elementary School",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.54358673,27.47036362),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Samoset Elementary School",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.55474091,27.42644691),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Sara Scott Harllee Middle School",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.63244629,27.47018433),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sea Breeze Elementary School",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.55010986,27.46676254),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Southeast High School",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.44868469,27.41519737),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Tara Elementary School",'Bradenton=' + Bradenton.length);
Palmetto[Palmetto.length] = createMarker(new GPoint(-82.48844000,27.57398000),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Virgil Mills Elementary School",'Palmetto=' + Palmetto.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.62024689,27.46805573),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("W. D. Sugg Middle School",'Bradenton=' + Bradenton.length);
Bradenton[Bradenton.length] = createMarker(new GPoint(-82.48924255,27.46795845),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("William H. Bashaw Elementary School",'Bradenton=' + Bradenton.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(Bradenton);
map.removeOverlays(Holmes_Beach);
map.removeOverlays(Myakka_City);
map.removeOverlays(Palmetto);
map.removeOverlays(Sarasota);
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(Bradenton);map.removeOverlays(Bradenton);
map.removeOverlays(Holmes_Beach);
map.removeOverlays(Myakka_City);
map.removeOverlays(Palmetto);
map.removeOverlays(Sarasota);
map.addOverlays(Bradenton);
centerByArray(Bradenton, false, false);
cntMarker += Bradenton.length;
map.addOverlays(Holmes_Beach);
centerByArray(Holmes_Beach, false, false);
cntMarker += Holmes_Beach.length;
map.addOverlays(Myakka_City);
centerByArray(Myakka_City, false, false);
cntMarker += Myakka_City.length;
map.addOverlays(Palmetto);
centerByArray(Palmetto, false, false);
cntMarker += Palmetto.length;
map.addOverlays(Sarasota);
centerByArray(Sarasota, false, false);
cntMarker += Sarasota.length;
centerByArray(Bradenton,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');
}
}