function addMarkers()
{
mySelect = document.getElementById('selection');
Tallahassee = [];Woodville = [];mySelect.options[mySelect.options.length] = new Option("Tallahassee schools",'all=Tallahassee');
mySelect.options[mySelect.options.length] = new Option("Woodville schools",'all=Woodville');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.33805847,30.44699287),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Academic Resource Center",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.34053500,30.44864600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Academy Of Academics & Technology",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.24849701,30.31100082),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Adolescent Drug Treatment",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.31536102,30.46346283),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Amos P. Godby High School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.21456909,30.43617439),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Apalachee Elementary School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.32276917,30.47616005),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Astoria Park Elementary School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.28567505,30.46356392),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Augusta Raa Middle School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.32247162,30.43801880),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Belle Vue Middle School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.29525757,30.41953850),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bond Elementary School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.18286133,30.47244072),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Buck Lake Elementary School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.28655243,30.44487190),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("C.k. Steele/leroy Collins Char Middle School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.34680939,30.51241684),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Canopy Oaks Elementary School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.31718445,30.43443680),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Caroline Brevard Elementary School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.12568665,30.43740654),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Chaires Elementary School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.34156036,30.45693207),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("County-wide Exceptional Student Education Elementary School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.27967072,30.43807983),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Deerlake Middle School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.22771454,30.53763962),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Desoto Trail Elementary School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.26863861,30.45196533),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Elizabeth Cobb Middle School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.26879883,30.40068245),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Fairview Middle School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.27967072,30.43807983),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Florida A & M University High School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.22619629,30.38292694),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Florida State University School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.51485443,30.43723679),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Fort Braden Elementary School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.25737000,30.43322182),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Frank Hartsfield Elementary School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.25830078,30.50351334),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Gilchrist Elementary School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.34156036,30.45693207),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Gretchen Everhart School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.29652405,30.45659256),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Griffin Middle School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.27382660,30.55831528),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hawks Rise Elementary School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.33363342,30.44127274),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hospital/homebound",'Tallahassee=' + Tallahassee.length);
Woodville[Woodville.length] = createMarker(new GPoint(-84.24849701,30.31100082),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("J.u.s.t.",'Woodville=' + Woodville.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.26377869,30.40876770),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("James Rickards High School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.30706024,30.45913696),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("John G Riley Elementary School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.26716614,30.45332718),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Kate Sullivan Elementary School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.27967072,30.43807983),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Killearn Lakes Elementary School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.21137238,30.56919670),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lawton Chiles High School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.33869934,30.41526222),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Leon Co Juvenile Detention Center",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.33136200,30.44955600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Leon County Superintendent's Office",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.21422300,30.43737700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Leon Countywide Adult Education Prog",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.27464294,30.44483757),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Leon High School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.27693939,30.41297531),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Leonard Wesson Elementary School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.33805847,30.44674110),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lewis M. Lively Area Vocational-technical High School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.28796387,30.46153641),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lillian Ruediger Elementary School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.21360016,30.43464088),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lincoln High School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.28270721,30.38436890),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Oak Ridge Elementary School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.26879120,30.40078354),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pace Center",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.23600006,30.43227386),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pace Center For Girls",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.30245972,30.41936111),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pineview Elementary School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.29533386,30.41246223),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("R. Frank Nims Middle School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.33922577,30.39776230),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Rattler Success Center",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.19097137,30.52637291),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Roberts Elementary School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.33377838,30.42714310),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sabal Palm Elementary School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.28823853,30.44987679),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sail",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.32979584,30.43029785),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sawmill Academy For Girls",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.25485992,30.49143791),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("School Of Arts & Sciences",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.29414368,30.47923470),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sealey Elementary School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.32979584,30.43029785),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Second Chance School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.33922577,30.39776230),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Seminole Work And Learn Center",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.34042358,30.49392700),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Springwood Elementary School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.18312073,30.44923782),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Swift Creek Middle School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.33232117,30.46553612),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Tallahassee Marine Institute",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.21037292,30.47350883),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Walter T. Moore, Junior Elementary School",'Tallahassee=' + Tallahassee.length);
Tallahassee[Tallahassee.length] = createMarker(new GPoint(-84.24751282,30.31467438),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Woodville Elementary School",'Tallahassee=' + Tallahassee.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(Tallahassee);
map.removeOverlays(Woodville);
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(Tallahassee);map.removeOverlays(Tallahassee);
map.removeOverlays(Woodville);
map.addOverlays(Tallahassee);
centerByArray(Tallahassee, false, false);
cntMarker += Tallahassee.length;
map.addOverlays(Woodville);
centerByArray(Woodville, false, false);
cntMarker += Woodville.length;
centerByArray(Tallahassee,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');
}
}