function addMarkers(){
mySelect = document.getElementById('selection');
Orlando = [];Winter_Park = [];Winter_Garden = [];Apopka = [];Ocoee = [];Gotha = [];Zellwood = [];Maitland = [];Mount_Dora = [];Windermere = [];mySelect.options[mySelect.options.length] = new Option("Apopka schools",'all=Apopka');
mySelect.options[mySelect.options.length] = new Option("Gotha schools",'all=Gotha');
mySelect.options[mySelect.options.length] = new Option("Maitland schools",'all=Maitland');
mySelect.options[mySelect.options.length] = new Option("Mount Dora schools",'all=Mount_Dora');
mySelect.options[mySelect.options.length] = new Option("Ocoee schools",'all=Ocoee');
mySelect.options[mySelect.options.length] = new Option("Orlando schools",'all=Orlando');
mySelect.options[mySelect.options.length] = new Option("Windermere schools",'all=Windermere');
mySelect.options[mySelect.options.length] = new Option("Winter Garden schools",'all=Winter_Garden');
mySelect.options[mySelect.options.length] = new Option("Winter Park schools",'all=Winter_Park');
mySelect.options[mySelect.options.length] = new Option("Zellwood schools",'all=Zellwood');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Orlando[Orlando.length] = createMarker(new GPoint(-81.47589000,28.57536100),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Agape Christian Academy",'Orlando=' + Orlando.length);
Winter_Park[Winter_Park.length] = createMarker(new GPoint(-81.32769400,28.58081100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Alpha Christian Academy",'Winter_Park=' + Winter_Park.length);
Winter_Garden[Winter_Garden.length] = createMarker(new GPoint(-81.58849400,28.57104800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("American Christian Academy",'Winter_Garden=' + Winter_Garden.length);
Apopka[Apopka.length] = createMarker(new GPoint(-81.50926100,28.67166900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Apopka Christian Academy",'Apopka=' + Apopka.length);
Orlando[Orlando.length] = createMarker(new GPoint(-81.40301900,28.60459800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Avalon School",'Orlando=' + Orlando.length);
Orlando[Orlando.length] = createMarker(new GPoint(-81.39364300,28.58804800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bishop Moore Catholic High School",'Orlando=' + Orlando.length);
Ocoee[Ocoee.length] = createMarker(new GPoint(-81.50500400,28.55200900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Central Fl Christian Academy Wc",'Ocoee=' + Ocoee.length);
Gotha[Gotha.length] = createMarker(new GPoint(-81.52110000,28.53990000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Central Florida Preparatory School",'Gotha=' + Gotha.length);
Winter_Garden[Winter_Garden.length] = createMarker(new GPoint(-81.56902500,28.53836600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Crenshaw School",'Winter_Garden=' + Winter_Garden.length);
Apopka[Apopka.length] = createMarker(new GPoint(-81.49489900,28.67161500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Eagle Aerospace Military Academy",'Apopka=' + Apopka.length);
Orlando[Orlando.length] = createMarker(new GPoint(-81.25701700,28.53911800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Eastland Christian School",'Orlando=' + Orlando.length);
Orlando[Orlando.length] = createMarker(new GPoint(-81.48798400,28.52259700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Edgewood Children's Ranch",'Orlando=' + Orlando.length);
Orlando[Orlando.length] = createMarker(new GPoint(-81.28641900,28.57523400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Faith Christian Academy",'Orlando=' + Orlando.length);
Orlando[Orlando.length] = createMarker(new GPoint(-81.42575700,28.51287900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The First Academy",'Orlando=' + Orlando.length);
Winter_Garden[Winter_Garden.length] = createMarker(new GPoint(-81.61674800,28.50720700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Foundation Academy",'Winter_Garden=' + Winter_Garden.length);
Orlando[Orlando.length] = createMarker(new GPoint(-81.33112200,28.55359800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Grace Christian Academy",'Orlando=' + Orlando.length);
Zellwood[Zellwood.length] = createMarker(new GPoint(-81.58320000,28.72130000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hampden Dubose Academy",'Zellwood=' + Zellwood.length);
Zellwood[Zellwood.length] = createMarker(new GPoint(-81.58320000,28.72130000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hampden Dubose Academy/legacy",'Zellwood=' + Zellwood.length);
Orlando[Orlando.length] = createMarker(new GPoint(-81.46365500,28.55206300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Heritage Preparatory School",'Orlando=' + Orlando.length);
Orlando[Orlando.length] = createMarker(new GPoint(-81.36137800,28.55299500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hope Academy",'Orlando=' + Orlando.length);
Winter_Park[Winter_Park.length] = createMarker(new GPoint(-81.32524900,28.60070700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Huntington Learning Center",'Winter_Park=' + Winter_Park.length);
Orlando[Orlando.length] = createMarker(new GPoint(-81.50094700,28.38567100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ibn Seena Academy",'Orlando=' + Orlando.length);
Orlando[Orlando.length] = createMarker(new GPoint(-81.45176900,28.57572900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Irene's Christian Academy",'Orlando=' + Orlando.length);
Orlando[Orlando.length] = createMarker(new GPoint(-81.37354300,28.55774100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lake Highland Preparatory School",'Orlando=' + Orlando.length);
Orlando[Orlando.length] = createMarker(new GPoint(-81.47630900,28.59617400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lake Rose Christian Academy.",'Orlando=' + Orlando.length);
Apopka[Apopka.length] = createMarker(new GPoint(-81.50844900,28.67312000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Little Red Schoolhouse",'Apopka=' + Apopka.length);
Orlando[Orlando.length] = createMarker(new GPoint(-81.39312200,28.58990900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Morning Star School",'Orlando=' + Orlando.length);
Orlando[Orlando.length] = createMarker(new GPoint(-81.28584300,28.55660000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Muslim Academy Of Central Florida",'Orlando=' + Orlando.length);
Maitland[Maitland.length] = createMarker(new GPoint(-81.37837900,28.63119500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Orangewood Christian School",'Maitland=' + Maitland.length);
Orlando[Orlando.length] = createMarker(new GPoint(-81.31073700,28.53704900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Orlando Christian Prep",'Orlando=' + Orlando.length);
Orlando[Orlando.length] = createMarker(new GPoint(-81.25292300,28.55327000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Orlando Lutheran Academy",'Orlando=' + Orlando.length);
Orlando[Orlando.length] = createMarker(new GPoint(-81.44930400,28.54915900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Peaceforce Christian Academy",'Orlando=' + Orlando.length);
Orlando[Orlando.length] = createMarker(new GPoint(-81.36594300,28.47300900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pine Castle Christian Academy",'Orlando=' + Orlando.length);
Winter_Garden[Winter_Garden.length] = createMarker(new GPoint(-81.56774000,28.57021600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Lillie V. High School",'Winter_Garden=' + Winter_Garden.length);
Winter_Park[Winter_Park.length] = createMarker(new GPoint(-81.33060300,28.62486300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Saxton Private School",'Winter_Park=' + Winter_Park.length);
Orlando[Orlando.length] = createMarker(new GPoint(-81.39508600,28.47418800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("South Orlando Christian Academy",'Orlando=' + Orlando.length);
Orlando[Orlando.length] = createMarker(new GPoint(-81.34533000,28.52423800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Teacher's Hands Academy",'Orlando=' + Orlando.length);
Orlando[Orlando.length] = createMarker(new GPoint(-81.26932900,28.49350000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Trace Academy",'Orlando=' + Orlando.length);
Mount_Dora[Mount_Dora.length] = createMarker(new GPoint(-81.58600400,28.78376400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Vantage Point Academy Inc",'Mount_Dora=' + Mount_Dora.length);
Ocoee[Ocoee.length] = createMarker(new GPoint(-81.52362600,28.58469700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Victory Christian Academy",'Ocoee=' + Ocoee.length);
Orlando[Orlando.length] = createMarker(new GPoint(-81.37738900,28.53774000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Victory Prep Christian Academy",'Orlando=' + Orlando.length);
Orlando[Orlando.length] = createMarker(new GPoint(-81.50116400,28.58826300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("West Oaks Academy",'Orlando=' + Orlando.length);
Winter_Park[Winter_Park.length] = createMarker(new GPoint(-81.37000000,28.66510000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Wilford Woodruff Academy",'Winter_Park=' + Winter_Park.length);
Windermere[Windermere.length] = createMarker(new GPoint(-81.57006900,28.47530400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Windermere Prep School",'Windermere=' + Windermere.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,11);
/*
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/////2/' + showArray);
map.removeOverlays(Apopka);
map.removeOverlays(Gotha);
map.removeOverlays(Maitland);
map.removeOverlays(Mount_Dora);
map.removeOverlays(Ocoee);
map.removeOverlays(Orlando);
map.removeOverlays(Windermere);
map.removeOverlays(Winter_Garden);
map.removeOverlays(Winter_Park);
map.removeOverlays(Zellwood);
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(Orlando);map.removeOverlays(Apopka);
map.removeOverlays(Gotha);
map.removeOverlays(Maitland);
map.removeOverlays(Mount_Dora);
map.removeOverlays(Ocoee);
map.removeOverlays(Orlando);
map.removeOverlays(Windermere);
map.removeOverlays(Winter_Garden);
map.removeOverlays(Winter_Park);
map.removeOverlays(Zellwood);
map.addOverlays(Apopka);
centerByArray(Apopka, false, false);
cntMarker += Apopka.length;
map.addOverlays(Gotha);
centerByArray(Gotha, false, false);
cntMarker += Gotha.length;
map.addOverlays(Maitland);
centerByArray(Maitland, false, false);
cntMarker += Maitland.length;
map.addOverlays(Mount_Dora);
centerByArray(Mount_Dora, false, false);
cntMarker += Mount_Dora.length;
map.addOverlays(Ocoee);
centerByArray(Ocoee, false, false);
cntMarker += Ocoee.length;
map.addOverlays(Orlando);
centerByArray(Orlando, false, false);
cntMarker += Orlando.length;
map.addOverlays(Windermere);
centerByArray(Windermere, false, false);
cntMarker += Windermere.length;
map.addOverlays(Winter_Garden);
centerByArray(Winter_Garden, false, false);
cntMarker += Winter_Garden.length;
map.addOverlays(Winter_Park);
centerByArray(Winter_Park, false, false);
cntMarker += Winter_Park.length;
map.addOverlays(Zellwood);
centerByArray(Zellwood, false, false);
cntMarker += Zellwood.length;
centerByArray(Orlando,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');
//window.open('/map.php?type=1&schools=&school_level=2&radius=&zipcode=&school_type_search=&school_type_code=');
}
}
function createMarker(point, label, icon)
{
var marker = new GMarker(point, icon);
var html = label;
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(html);
});
return marker;
}