function addMarkers()
{
mySelect = document.getElementById('selection');
Lynn_Haven = [];Panama_City = [];Panama_City_Beach = [];Southport = [];Tyndall_Afb = [];Youngstown = [];mySelect.options[mySelect.options.length] = new Option("Lynn Haven schools",'all=Lynn_Haven');
mySelect.options[mySelect.options.length] = new Option("Panama City schools",'all=Panama_City');
mySelect.options[mySelect.options.length] = new Option("Panama City Beach schools",'all=Panama_City_Beach');
mySelect.options[mySelect.options.length] = new Option("Southport schools",'all=Southport');
mySelect.options[mySelect.options.length] = new Option("Tyndall Afb schools",'all=Tyndall_Afb');
mySelect.options[mySelect.options.length] = new Option("Youngstown schools",'all=Youngstown');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Lynn_Haven[Lynn_Haven.length] = createMarker(new GPoint(-85.64542000,30.21128900),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("A. Crawford Mosley High School",'Lynn_Haven=' + Lynn_Haven.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.64863586,30.16776657),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("A. D. Harris High School",'Panama_City=' + Panama_City.length);
Panama_City_Beach[Panama_City_Beach.length] = createMarker(new GPoint(-85.82019043,30.20145607),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Arnold High School",'Panama_City_Beach=' + Panama_City_Beach.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.42179871,30.49130058),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bay Co. Behavioral Health Center",'Panama_City=' + Panama_City.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.66033400,30.15987000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bay County Sheriff's Boot Camp",'Panama_City=' + Panama_City.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.66033400,30.15987000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bay County Superintendent's Office",'Panama_City=' + Panama_City.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.66031647,30.15710068),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bay Detention Center",'Panama_City=' + Panama_City.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.66028595,30.16466331),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bay Haven Charter Academy",'Panama_City=' + Panama_City.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.66028900,30.16467400),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Bay Haven Charter Middle School",'Panama_City=' + Panama_City.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.66022491,30.16971016),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bay High School",'Panama_City=' + Panama_City.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.68950653,30.40041542),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bozeman Learning Center",'Panama_City=' + Panama_City.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.56938934,30.15303612),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Callaway Elementary School",'Panama_City=' + Panama_City.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.62214661,30.17481041),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Cedar Grove Elementary School",'Panama_City=' + Panama_City.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.65881700,30.16819200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Chautauqua Charter School",'Panama_City=' + Panama_City.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.67855300,30.17532100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Emerald Bay Academy",'Panama_City=' + Panama_City.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.61650085,30.15992165),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Everitt Middle School",'Panama_City=' + Panama_City.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.67539215,30.17180634),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Exceptional Student Education",'Panama_City=' + Panama_City.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.64943695,30.20262146),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Haney Technical High School",'Panama_City=' + Panama_City.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.67228699,30.20421028),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hiland Park Elementary School",'Panama_City=' + Panama_City.length);
Panama_City_Beach[Panama_City_Beach.length] = createMarker(new GPoint(-85.84475708,30.19908714),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hutchison Beach Elementary School",'Panama_City_Beach=' + Panama_City_Beach.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.66729736,30.16790581),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Jinks Middle School",'Panama_City=' + Panama_City.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.70861053,30.18264580),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lucille Moore Elementary School",'Panama_City=' + Panama_City.length);
Lynn_Haven[Lynn_Haven.length] = createMarker(new GPoint(-85.65091705,30.24533653),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lynn Haven Elementary School",'Lynn_Haven=' + Lynn_Haven.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.69108582,30.17585182),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Margaret K. Lewis Exceptional School",'Panama_City=' + Panama_City.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.64546204,30.14593124),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Merriam Cherry Street Elementary School",'Panama_City=' + Panama_City.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.56741333,30.23918152),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Merritt Brown Middle School",'Panama_City=' + Panama_City.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.62517548,30.14869881),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Millville Elementary School",'Panama_City=' + Panama_City.length);
Lynn_Haven[Lynn_Haven.length] = createMarker(new GPoint(-85.65592957,30.23028946),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Mowat Middle School",'Lynn_Haven=' + Lynn_Haven.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.64556122,30.20440102),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("New Horizons Learning Center",'Panama_City=' + Panama_City.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.67670441,30.18253326),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Northside Elementary School",'Panama_City=' + Panama_City.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.68948364,30.16991425),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Oakland Terrace Elementary School",'Panama_City=' + Panama_City.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.63761139,30.16633606),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Oscar Patterson Elementary Magnet",'Panama_City=' + Panama_City.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.66044617,30.15194130),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Panama City Marine Institute",'Panama_City=' + Panama_City.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.59965515,30.13547325),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Parker Elementary School",'Panama_City=' + Panama_City.length);
Panama_City_Beach[Panama_City_Beach.length] = createMarker(new GPoint(-85.76296997,30.17167664),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Patronis Elementary School",'Panama_City_Beach=' + Panama_City_Beach.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.64168549,30.16774178),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Rosenwald Middle School",'Panama_City=' + Panama_City.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.61648560,30.16668892),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Rutherford High School",'Panama_City=' + Panama_City.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.70154572,30.17542267),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Saint Andrew School",'Panama_City=' + Panama_City.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.60952300,30.14976200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Shaw Adult Center",'Panama_City=' + Panama_City.length);
Southport[Southport.length] = createMarker(new GPoint(-85.64112091,30.28772545),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Southport Elementary School",'Southport=' + Southport.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.61650848,30.15733719),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Springfield Elementary School",'Panama_City=' + Panama_City.length);
Panama_City_Beach[Panama_City_Beach.length] = createMarker(new GPoint(-85.84912109,30.21041679),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Surfside Middle School",'Panama_City_Beach=' + Panama_City_Beach.length);
Panama_City_Beach[Panama_City_Beach.length] = createMarker(new GPoint(-85.82840300,30.20503000),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Tapestry Park Charter School",'Panama_City_Beach=' + Panama_City_Beach.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.62441400,30.17488000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Tom P. Haney Vocational-technical Center",'Panama_City=' + Panama_City.length);
Panama_City[Panama_City.length] = createMarker(new GPoint(-85.56423950,30.24082756),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Tommy Smith Elementary School",'Panama_City=' + Panama_City.length);
Tyndall_Afb[Tyndall_Afb.length] = createMarker(new GPoint(-85.59125519,30.07015038),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Tyndall Elementary School",'Tyndall_Afb=' + Tyndall_Afb.length);
Youngstown[Youngstown.length] = createMarker(new GPoint(-85.44669342,30.36666489),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Waller Elementary School",'Youngstown=' + Youngstown.length);
Panama_City_Beach[Panama_City_Beach.length] = createMarker(new GPoint(-85.86116791,30.28930855),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("West Bay Elementary School",'Panama_City_Beach=' + Panama_City_Beach.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(Lynn_Haven);
map.removeOverlays(Panama_City);
map.removeOverlays(Panama_City_Beach);
map.removeOverlays(Southport);
map.removeOverlays(Tyndall_Afb);
map.removeOverlays(Youngstown);
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(Lynn_Haven);map.removeOverlays(Lynn_Haven);
map.removeOverlays(Panama_City);
map.removeOverlays(Panama_City_Beach);
map.removeOverlays(Southport);
map.removeOverlays(Tyndall_Afb);
map.removeOverlays(Youngstown);
map.addOverlays(Lynn_Haven);
centerByArray(Lynn_Haven, false, false);
cntMarker += Lynn_Haven.length;
map.addOverlays(Panama_City);
centerByArray(Panama_City, false, false);
cntMarker += Panama_City.length;
map.addOverlays(Panama_City_Beach);
centerByArray(Panama_City_Beach, false, false);
cntMarker += Panama_City_Beach.length;
map.addOverlays(Southport);
centerByArray(Southport, false, false);
cntMarker += Southport.length;
map.addOverlays(Tyndall_Afb);
centerByArray(Tyndall_Afb, false, false);
cntMarker += Tyndall_Afb.length;
map.addOverlays(Youngstown);
centerByArray(Youngstown, false, false);
cntMarker += Youngstown.length;
centerByArray(Lynn_Haven,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');
}
}