function addMarkers(){
mySelect = document.getElementById('selection');
Saint_Louis = [];St_Louis = [];mySelect.options[mySelect.options.length] = new Option("Saint Louis schools",'all=Saint_Louis');
mySelect.options[mySelect.options.length] = new Option("St Louis schools",'all=St_Louis');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.25018600,38.57382900),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Academy At Boys & Girls Town",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.25724800,38.66934000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bishop Healy Catholic School",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.25475100,38.64321000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cathedral Basilica Of St Louis",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.21262300,38.64024500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Central Catholic Academy St Nicholas",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.26051900,38.63254000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("CID - Central Institute for the Deaf",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.24872500,38.68132800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("City Academy",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.22646500,38.64764500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Clara Mohammed School",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.23387300,38.65908400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("De La Salle Middle School",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.30230400,38.60686000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Epiphany Of Our Lord School",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.25168600,38.67201000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Euclid Academy Of St Louis",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.22222300,38.63498900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Explorers Ii Day Care Center",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.30236900,38.64479500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Forsyth School",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.24715400,38.65878900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Frederick Douglass Institute",'Saint_Louis=' + Saint_Louis.length);
St_Louis[St_Louis.length] = createMarker(new GPoint(-90.24586800,38.56513500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Heartbeat Academy",'St_Louis=' + St_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.22842600,38.58938400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Holy Cross Lutheran School",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.25660900,38.60016500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Holy Family Catholic School",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.19897100,38.66047200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Holy Trinity Catholic School",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.28146700,38.58183600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hope Lutheran School",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.27547400,38.56300000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Immaculate Heart Of Mary School",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.26340200,38.59049700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("King of Glory Lutheran School",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.23696900,38.64163800),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Loyola Academy Of St. Louis",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.25662700,38.60014700),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Marian Middle School",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.24175600,38.60434200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Messiah Lutheran School",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.27073300,38.64899800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("New City School",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.23285600,38.71085800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Our Lady Of The Holy Cross",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.29740000,38.58600000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Our Lady Of Sorrows School",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.25082500,38.58412400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Resurrection Of Our Lord",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.23330600,38.71776000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("River Roads Lutheran School",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.28250000,38.61063400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Aloysius Gonzaga",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.27135300,38.61540100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Ambrose School",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.27649100,38.53450900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Andrew School",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.24012200,38.57974800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Anthony Of Padua",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.23568000,38.57214000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Frances Cabrini Academy",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.29879700,38.58814400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Gabriel The Archangel School",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.44100300,38.58544000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Gerard Majella School",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.29316600,38.62578800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. James The Greater School",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.26336800,38.59130900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Johns Lutheran School",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.24702700,38.61484300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Margaret Of Scotland School",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.33367500,38.75275900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Martins Child Center",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.27541300,38.58879000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Mary Magdalen Elementary School",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.30336400,38.57716600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Raphael The Archangel School",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.25927000,38.55200600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Southside Christian Academy",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.24988800,38.56877500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Cecilia School",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.22948300,38.60126100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Frances Cabrini Academy",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.29145500,38.59669100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Joan Of Arc Elementary School",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.26398100,38.57974900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St John The Baptist Elementary School",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.23861100,38.68094500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Louis Catholic Academy",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.23163400,38.61627100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Louis Christian Academy",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.24400900,38.57512800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Lukes Lutheran School",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.24989100,38.70022900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Matthew Lutheran School",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.29536100,38.65024800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Roch School",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.26297000,38.56954400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Stephen Protomartyr School",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.25653500,38.60880800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Tower Grove Christian School",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.28855800,38.66422200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Transformation Christian School",'Saint_Louis=' + Saint_Louis.length);
Saint_Louis[Saint_Louis.length] = createMarker(new GPoint(-90.30512500,38.58281400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Word Of Life Lutheran School",'Saint_Louis=' + Saint_Louis.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/////1/' + showArray);
map.removeOverlays(Saint_Louis);
map.removeOverlays(St_Louis);
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(Saint_Louis);map.removeOverlays(Saint_Louis);
map.removeOverlays(St_Louis);
map.addOverlays(Saint_Louis);
centerByArray(Saint_Louis, false, false);
cntMarker += Saint_Louis.length;
map.addOverlays(St_Louis);
centerByArray(St_Louis, false, false);
cntMarker += St_Louis.length;
centerByArray(Saint_Louis,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=1&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;
}