function addMarkers()
{
mySelect = document.getElementById('selection');
Stuart = [];Hobe_Sound = [];Palm_City = [];Jensen_Beach = [];Indiantown = [];Okeechobee = [];mySelect.options[mySelect.options.length] = new Option("Hobe Sound schools",'all=Hobe_Sound');
mySelect.options[mySelect.options.length] = new Option("Indiantown schools",'all=Indiantown');
mySelect.options[mySelect.options.length] = new Option("Jensen Beach schools",'all=Jensen_Beach');
mySelect.options[mySelect.options.length] = new Option("Okeechobee schools",'all=Okeechobee');
mySelect.options[mySelect.options.length] = new Option("Palm City schools",'all=Palm_City');
mySelect.options[mySelect.options.length] = new Option("Stuart schools",'all=Stuart');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Stuart[Stuart.length] = createMarker(new GPoint(-80.24154663,27.17546272),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Alternative Education Boot Camp",'Stuart=' + Stuart.length);
Hobe_Sound[Hobe_Sound.length] = createMarker(new GPoint(-80.10330200,27.01053810),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Alternative Education Stop Camp",'Hobe_Sound=' + Hobe_Sound.length);
Palm_City[Palm_City.length] = createMarker(new GPoint(-80.27754211,27.17656326),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bessey Creek Elementary School",'Palm_City=' + Palm_City.length);
Stuart[Stuart.length] = createMarker(new GPoint(-80.23152924,27.14420319),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Challenger School",'Stuart=' + Stuart.length);
Stuart[Stuart.length] = createMarker(new GPoint(-80.22329800,27.13543400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Clark Advanced Learning Center",'Stuart=' + Stuart.length);
Stuart[Stuart.length] = createMarker(new GPoint(-80.28337860,27.08820343),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Crystal Lake Elementary School",'Stuart=' + Stuart.length);
Stuart[Stuart.length] = createMarker(new GPoint(-80.24723816,27.19750023),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ese Homebound",'Stuart=' + Stuart.length);
Stuart[Stuart.length] = createMarker(new GPoint(-80.25557900,27.20019000),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Family Learning Centers",'Stuart=' + Stuart.length);
Stuart[Stuart.length] = createMarker(new GPoint(-80.25851440,27.22241783),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Felix A. Williams Elementary School",'Stuart=' + Stuart.length);
Palm_City[Palm_City.length] = createMarker(new GPoint(-80.29365540,27.16143608),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Hidden Oaks Middle School",'Palm_City=' + Palm_City.length);
Hobe_Sound[Hobe_Sound.length] = createMarker(new GPoint(-80.12922668,27.06342506),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hobe Sound Elementary School",'Hobe_Sound=' + Hobe_Sound.length);
Jensen_Beach[Jensen_Beach.length] = createMarker(new GPoint(-80.23432300,27.24434800),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hope Charter Center",'Jensen_Beach=' + Jensen_Beach.length);
Indiantown[Indiantown.length] = createMarker(new GPoint(-80.47592926,27.02006531),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Indiantown Middle School",'Indiantown=' + Indiantown.length);
Stuart[Stuart.length] = createMarker(new GPoint(-80.24504852,27.19746208),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Infant-toddlers Exceptional Ed Elementary School",'Stuart=' + Stuart.length);
Stuart[Stuart.length] = createMarker(new GPoint(-80.24504852,27.19746208),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Infant-toddlers Exceptional Education Elementary School",'Stuart=' + Stuart.length);
Jensen_Beach[Jensen_Beach.length] = createMarker(new GPoint(-80.23624420,27.23599625),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Jensen Beach Elementary School",'Jensen_Beach=' + Jensen_Beach.length);
Jensen_Beach[Jensen_Beach.length] = createMarker(new GPoint(-80.26748400,27.23900700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Jensen Beach High School",'Jensen_Beach=' + Jensen_Beach.length);
Stuart[Stuart.length] = createMarker(new GPoint(-80.23442841,27.19006348),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Julian D. Parker Elementary School",'Stuart=' + Stuart.length);
Stuart[Stuart.length] = createMarker(new GPoint(-80.25170135,27.17070770),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Martin County High School",'Stuart=' + Stuart.length);
Stuart[Stuart.length] = createMarker(new GPoint(-80.25557900,27.20019000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Martin County Superintendent's Office",'Stuart=' + Stuart.length);
Stuart[Stuart.length] = createMarker(new GPoint(-80.24471000,27.19281500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Martin County Transition School",'Stuart=' + Stuart.length);
Stuart[Stuart.length] = createMarker(new GPoint(-80.19399261,27.13543129),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Murray Middle School",'Stuart=' + Stuart.length);
Okeechobee[Okeechobee.length] = createMarker(new GPoint(-80.82617950,27.30597305),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Okeechobee Boys School",'Okeechobee=' + Okeechobee.length);
Palm_City[Palm_City.length] = createMarker(new GPoint(-80.27923584,27.16431046),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Palm City Elementary School",'Palm_City=' + Palm_City.length);
Indiantown[Indiantown.length] = createMarker(new GPoint(-80.48030090,27.03249931),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Parent Resource Center",'Indiantown=' + Indiantown.length);
Stuart[Stuart.length] = createMarker(new GPoint(-80.23133850,27.14184952),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pinewood Elementary School",'Stuart=' + Stuart.length);
Stuart[Stuart.length] = createMarker(new GPoint(-80.20082855,27.14409447),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pk Early Intervention Elementary School",'Stuart=' + Stuart.length);
Stuart[Stuart.length] = createMarker(new GPoint(-80.20725250,27.14495850),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Port Salerno Elementary School",'Stuart=' + Stuart.length);
Stuart[Stuart.length] = createMarker(new GPoint(-80.20082855,27.14409447),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Prekindergarten Programs",'Stuart=' + Stuart.length);
Stuart[Stuart.length] = createMarker(new GPoint(-80.24504852,27.19746208),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sandy Pines Psychiatric Center",'Stuart=' + Stuart.length);
Hobe_Sound[Hobe_Sound.length] = createMarker(new GPoint(-80.20348358,27.09965134),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sea Wind Elementary School",'Hobe_Sound=' + Hobe_Sound.length);
Stuart[Stuart.length] = createMarker(new GPoint(-80.26285553,27.07455254),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("South Fork High School",'Stuart=' + Stuart.length);
Stuart[Stuart.length] = createMarker(new GPoint(-80.24275208,27.19266319),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Specenterum Junior/senior High School",'Stuart=' + Stuart.length);
Stuart[Stuart.length] = createMarker(new GPoint(-80.24694824,27.19498825),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Stuart Middle School",'Stuart=' + Stuart.length);
Indiantown[Indiantown.length] = createMarker(new GPoint(-80.46163177,27.02189255),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Warfield Elementary School",'Indiantown=' + Indiantown.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(Hobe_Sound);
map.removeOverlays(Indiantown);
map.removeOverlays(Jensen_Beach);
map.removeOverlays(Okeechobee);
map.removeOverlays(Palm_City);
map.removeOverlays(Stuart);
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(Stuart);map.removeOverlays(Hobe_Sound);
map.removeOverlays(Indiantown);
map.removeOverlays(Jensen_Beach);
map.removeOverlays(Okeechobee);
map.removeOverlays(Palm_City);
map.removeOverlays(Stuart);
map.addOverlays(Hobe_Sound);
centerByArray(Hobe_Sound, false, false);
cntMarker += Hobe_Sound.length;
map.addOverlays(Indiantown);
centerByArray(Indiantown, false, false);
cntMarker += Indiantown.length;
map.addOverlays(Jensen_Beach);
centerByArray(Jensen_Beach, false, false);
cntMarker += Jensen_Beach.length;
map.addOverlays(Okeechobee);
centerByArray(Okeechobee, false, false);
cntMarker += Okeechobee.length;
map.addOverlays(Palm_City);
centerByArray(Palm_City, false, false);
cntMarker += Palm_City.length;
map.addOverlays(Stuart);
centerByArray(Stuart, false, false);
cntMarker += Stuart.length;
centerByArray(Stuart,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');
}
}