function addMarkers()
{
mySelect = document.getElementById('selection');
Sarasota = [];North_Port = [];Englewood = [];Venice = [];Nokomis = [];Osprey = [];Nakomis = [];mySelect.options[mySelect.options.length] = new Option("Englewood schools",'all=Englewood');
mySelect.options[mySelect.options.length] = new Option("Nakomis schools",'all=Nakomis');
mySelect.options[mySelect.options.length] = new Option("Nokomis schools",'all=Nokomis');
mySelect.options[mySelect.options.length] = new Option("North Port schools",'all=North_Port');
mySelect.options[mySelect.options.length] = new Option("Osprey schools",'all=Osprey');
mySelect.options[mySelect.options.length] = new Option("Sarasota schools",'all=Sarasota');
mySelect.options[mySelect.options.length] = new Option("Venice schools",'all=Venice');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.51805115,27.32485771),"
",iconRd);
mySelect.options[mySelect.options.length] = new Option("Alta Vista Elementary School",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.46672821,27.27646255),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Ashton Elementary School",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.55094910,27.36174583),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bay Haven School Of Basics Plus",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.53862000,27.36381721),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Booker High School",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.52682495,27.36709976),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Booker Middle School",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.47297200,27.31062500),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Brentwood Elementary School",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.52245331,27.30099869),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Brookside Middle School",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.52625275,27.33680153),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Character House",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.53850200,27.35251800),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Children First",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.47923900,27.36475000),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Children's Haven",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.64457703,27.52359962),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Children's Haven (formerly School # 9004)",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.53932000,27.33566400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Coastal Behavioral Healthcare Residential Treatmen",'Sarasota=' + Sarasota.length);
North_Port[North_Port.length] = createMarker(new GPoint(-82.12079620,27.05159950),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Cranberry Elementary School",'North_Port=' + North_Port.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.49752045,27.28694153),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cyesis",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.53090668,27.33646965),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Emma E. Booker Elementary School",'Sarasota=' + Sarasota.length);
Englewood[Englewood.length] = createMarker(new GPoint(-82.35725403,26.96515656),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Englewood Elementary School",'Englewood=' + Englewood.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.52686600,27.33824900),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Ephrata Middle School",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.53134918,27.28026581),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ese Special Programs",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.47744400,27.35216500),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Florida Center For Child And Family Developmen",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.46354675,27.33087158),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Fruitville Elementary School",'Sarasota=' + Sarasota.length);
Venice[Venice.length] = createMarker(new GPoint(-82.39997864,27.07876205),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Garden Elementary School",'Venice=' + Venice.length);
North_Port[North_Port.length] = createMarker(new GPoint(-82.23621368,27.07685852),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Glenallen Elementary School",'North_Port=' + North_Port.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.49984741,27.36316299),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Gocio Elementary School",'Sarasota=' + Sarasota.length);
Venice[Venice.length] = createMarker(new GPoint(-82.44325256,27.09825134),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Gulf Coast Marine Institute",'Venice=' + Venice.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.53691101,27.34636307),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Gulf Coast Vocational Institute",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.50595093,27.26099968),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Gulf Gate Elementary School",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.48064423,27.33020782),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Infinity Middle School/sarasota",'Sarasota=' + Sarasota.length);
Venice[Venice.length] = createMarker(new GPoint(-82.38682000,27.10180900),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Island Village Montessori Middle School",'Venice=' + Venice.length);
Venice[Venice.length] = createMarker(new GPoint(-82.41696167,27.12175941),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Island Village Montessori School",'Venice=' + Venice.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.48923100,27.33753100),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Island Village North",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.42398834,27.27423477),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lakeview Elementary School",'Sarasota=' + Sarasota.length);
Nokomis[Nokomis.length] = createMarker(new GPoint(-82.42489624,27.13736153),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Laurel Nokomis School",'Nokomis=' + Nokomis.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.48064423,27.33024406),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Mcintosh Middle School",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.33184814,27.24247932),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Myakka Stop Camp (inactiv",'Sarasota=' + Sarasota.length);
North_Port[North_Port.length] = createMarker(new GPoint(-82.23003387,27.07425117),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("New Middle Dd",'North_Port=' + North_Port.length);
North_Port[North_Port.length] = createMarker(new GPoint(-82.22829437,27.07368660),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("North Port High School",'North_Port=' + North_Port.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.42420959,27.27452469),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Oak Park School",'Sarasota=' + Sarasota.length);
Venice[Venice.length] = createMarker(new GPoint(-82.35624800,27.07883200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Oak Park South",'Venice=' + Venice.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.49748230,27.28994179),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Opportunity High School (formerly Milburn Dropou",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.53054810,27.28507233),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Phillippi Shores Elementary School",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.52188000,27.32373800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Phoenix School",'Sarasota=' + Sarasota.length);
Osprey[Osprey.length] = createMarker(new GPoint(-82.48162079,27.18881989),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pine View School For Gifted",'Osprey=' + Osprey.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.43936100,27.25247800),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pinnacle Academy, Inc.",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.52520000,27.37709200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Richard Milburn Academy Of Florida",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.51785278,27.28266335),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Riverview High School",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.53488922,27.35606384),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Roy Mcbean Charter School (inactiv",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.51635500,27.26818000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sarasota County Superintendent's Office",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.49755096,27.28518677),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sarasota County Technical Institute High School",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.52595520,27.32538033),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sarasota High School",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.47190857,27.27646255),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Sarasota Middle School",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.53865051,27.34324265),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sarasota Military Academy",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.54275513,27.34176826),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Sarasota School Of Arts/sciences",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.48086000,27.33544400),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sarasota Suncoast Academy",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.53182100,27.30829700),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Southside Elementary School",'Sarasota=' + Sarasota.length);
Nakomis[Nakomis.length] = createMarker(new GPoint(-10.00000000,10.00000000),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Student Leadership Academy",'Nakomis=' + Nakomis.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.51151276,27.26218987),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Suncoast School",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.41655700,27.33100300),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Tatum Ridge Elementary School",'Sarasota=' + Sarasota.length);
Venice[Venice.length] = createMarker(new GPoint(-82.35845184,27.04708862),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Taylor Ranch Elementary School",'Venice=' + Venice.length);
North_Port[North_Port.length] = createMarker(new GPoint(-82.14886475,27.06736374),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Toledo Blade Elementary School",'North_Port=' + North_Port.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.53134918,27.28026581),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Triad",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.51219940,27.34323692),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Tuttle Elementary School",'Sarasota=' + Sarasota.length);
Venice[Venice.length] = createMarker(new GPoint(-82.45000900,27.09944500),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Venice Elementary School",'Venice=' + Venice.length);
Venice[Venice.length] = createMarker(new GPoint(-82.35904694,27.07876205),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Venice Middle School",'Venice=' + Venice.length);
Venice[Venice.length] = createMarker(new GPoint(-82.43679810,27.09620094),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Venice Senior High School",'Venice=' + Venice.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.50034332,27.29136276),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Wilkinson Elementary School",'Sarasota=' + Sarasota.length);
Sarasota[Sarasota.length] = createMarker(new GPoint(-82.52686600,27.33824900),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Wings Academy",'Sarasota=' + Sarasota.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(Englewood);
map.removeOverlays(Nakomis);
map.removeOverlays(Nokomis);
map.removeOverlays(North_Port);
map.removeOverlays(Osprey);
map.removeOverlays(Sarasota);
map.removeOverlays(Venice);
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(Sarasota);map.removeOverlays(Englewood);
map.removeOverlays(Nakomis);
map.removeOverlays(Nokomis);
map.removeOverlays(North_Port);
map.removeOverlays(Osprey);
map.removeOverlays(Sarasota);
map.removeOverlays(Venice);
map.addOverlays(Englewood);
centerByArray(Englewood, false, false);
cntMarker += Englewood.length;
map.addOverlays(Nakomis);
centerByArray(Nakomis, false, false);
cntMarker += Nakomis.length;
map.addOverlays(Nokomis);
centerByArray(Nokomis, false, false);
cntMarker += Nokomis.length;
map.addOverlays(North_Port);
centerByArray(North_Port, false, false);
cntMarker += North_Port.length;
map.addOverlays(Osprey);
centerByArray(Osprey, false, false);
cntMarker += Osprey.length;
map.addOverlays(Sarasota);
centerByArray(Sarasota, false, false);
cntMarker += Sarasota.length;
map.addOverlays(Venice);
centerByArray(Venice, false, false);
cntMarker += Venice.length;
centerByArray(Sarasota,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');
}
}