function addMarkers()
{
mySelect = document.getElementById('selection');
San_Mateo = [];Interlachen = [];Palatka = [];Crescent_City = [];Melrose = [];Hawthorne = [];East_Palatka = [];Florahome = [];mySelect.options[mySelect.options.length] = new Option("Crescent City schools",'all=Crescent_City');
mySelect.options[mySelect.options.length] = new Option("East Palatka schools",'all=East_Palatka');
mySelect.options[mySelect.options.length] = new Option("Florahome schools",'all=Florahome');
mySelect.options[mySelect.options.length] = new Option("Hawthorne schools",'all=Hawthorne');
mySelect.options[mySelect.options.length] = new Option("Interlachen schools",'all=Interlachen');
mySelect.options[mySelect.options.length] = new Option("Melrose schools",'all=Melrose');
mySelect.options[mySelect.options.length] = new Option("Palatka schools",'all=Palatka');
mySelect.options[mySelect.options.length] = new Option("San Mateo schools",'all=San_Mateo');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
San_Mateo[San_Mateo.length] = createMarker(new GPoint(-81.58325195,29.60864639),"
",iconRd);
mySelect.options[mySelect.options.length] = new Option("Browning-pearce Elementary School",'San_Mateo=' + San_Mateo.length);
Interlachen[Interlachen.length] = createMarker(new GPoint(-81.88925171,29.62355995),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("C. H. Price Middle School",'Interlachen=' + Interlachen.length);
Palatka[Palatka.length] = createMarker(new GPoint(-84.57032500,32.53520300),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Children's Reading Center",'Palatka=' + Palatka.length);
Crescent_City[Crescent_City.length] = createMarker(new GPoint(-81.51038361,29.43014908),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Crescent City Junior/senior High School",'Crescent_City=' + Crescent_City.length);
Palatka[Palatka.length] = createMarker(new GPoint(-81.69534302,29.63310051),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Eleanor H. Miller School",'Palatka=' + Palatka.length);
Palatka[Palatka.length] = createMarker(new GPoint(-81.63581300,29.64634800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Federal Programs Office",'Palatka=' + Palatka.length);
Crescent_City[Crescent_City.length] = createMarker(new GPoint(-81.50894165,29.42875290),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("George C. Miller, Junior Intermediate",'Crescent_City=' + Crescent_City.length);
Interlachen[Interlachen.length] = createMarker(new GPoint(-81.88925171,29.62355995),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Interlachen Elementary School",'Interlachen=' + Interlachen.length);
Interlachen[Interlachen.length] = createMarker(new GPoint(-81.88925171,29.62355995),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Interlachen High School",'Interlachen=' + Interlachen.length);
Palatka[Palatka.length] = createMarker(new GPoint(-81.65457153,29.66443253),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("James A. Long Elementary School",'Palatka=' + Palatka.length);
Palatka[Palatka.length] = createMarker(new GPoint(-81.70596313,29.63344574),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Kelley Smith Elementary School",'Palatka=' + Palatka.length);
Palatka[Palatka.length] = createMarker(new GPoint(-81.66759491,29.64351082),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mellon Elementary School",'Palatka=' + Palatka.length);
Melrose[Melrose.length] = createMarker(new GPoint(-82.04237366,29.70955276),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Melrose Elementary School",'Melrose=' + Melrose.length);
Crescent_City[Crescent_City.length] = createMarker(new GPoint(-81.52328491,29.43920326),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Middleton-burney Elementary School",'Crescent_City=' + Crescent_City.length);
Hawthorne[Hawthorne.length] = createMarker(new GPoint(-82.02951813,29.62965775),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Ochwilla Elementary School",'Hawthorne=' + Hawthorne.length);
Palatka[Palatka.length] = createMarker(new GPoint(-81.66783142,29.64333344),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Palatka High School",'Palatka=' + Palatka.length);
Palatka[Palatka.length] = createMarker(new GPoint(-81.69534302,29.63310051),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Putnam County Exceptional Education",'Palatka=' + Palatka.length);
Palatka[Palatka.length] = createMarker(new GPoint(-81.63702900,29.64853500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Putnam County Superintendent's Office",'Palatka=' + Palatka.length);
East_Palatka[East_Palatka.length] = createMarker(new GPoint(-81.60752869,29.64656258),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Putnam Educational Academy",'East_Palatka=' + East_Palatka.length);
Florahome[Florahome.length] = createMarker(new GPoint(-81.85739899,29.77070045),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Q. I. Roberts Middle School",'Florahome=' + Florahome.length);
Palatka[Palatka.length] = createMarker(new GPoint(-81.65384674,29.63795662),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Riverbreeze Elementary School",'Palatka=' + Palatka.length);
Palatka[Palatka.length] = createMarker(new GPoint(-81.64701843,29.65880394),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Robert H. Jenkins, Junior Middle School",'Palatka=' + Palatka.length);
Palatka[Palatka.length] = createMarker(new GPoint(-81.64760590,29.63863754),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("W. H. Beasley Middle School",'Palatka=' + Palatka.length);
Palatka[Palatka.length] = createMarker(new GPoint(-81.65354156,29.64054680),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("William D. Moseley Elementary School",'Palatka=' + Palatka.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(Crescent_City);
map.removeOverlays(East_Palatka);
map.removeOverlays(Florahome);
map.removeOverlays(Hawthorne);
map.removeOverlays(Interlachen);
map.removeOverlays(Melrose);
map.removeOverlays(Palatka);
map.removeOverlays(San_Mateo);
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(San_Mateo);map.removeOverlays(Crescent_City);
map.removeOverlays(East_Palatka);
map.removeOverlays(Florahome);
map.removeOverlays(Hawthorne);
map.removeOverlays(Interlachen);
map.removeOverlays(Melrose);
map.removeOverlays(Palatka);
map.removeOverlays(San_Mateo);
map.addOverlays(Crescent_City);
centerByArray(Crescent_City, false, false);
cntMarker += Crescent_City.length;
map.addOverlays(East_Palatka);
centerByArray(East_Palatka, false, false);
cntMarker += East_Palatka.length;
map.addOverlays(Florahome);
centerByArray(Florahome, false, false);
cntMarker += Florahome.length;
map.addOverlays(Hawthorne);
centerByArray(Hawthorne, false, false);
cntMarker += Hawthorne.length;
map.addOverlays(Interlachen);
centerByArray(Interlachen, false, false);
cntMarker += Interlachen.length;
map.addOverlays(Melrose);
centerByArray(Melrose, false, false);
cntMarker += Melrose.length;
map.addOverlays(Palatka);
centerByArray(Palatka, false, false);
cntMarker += Palatka.length;
map.addOverlays(San_Mateo);
centerByArray(San_Mateo, false, false);
cntMarker += San_Mateo.length;
centerByArray(San_Mateo,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');
}
}