function addMarkers(){
mySelect = document.getElementById('selection');
Baltimore = [];mySelect.options[mySelect.options.length] = new Option("Baltimore schools",'all=Baltimore');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.56619200,39.31346300),"
",iconBl);
mySelect.options[mySelect.options.length] = new Option("Archbishop Curley High School",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.66049800,39.37458100),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bais Yaakov Eva Winer High School",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.67997800,39.28193700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Baltimore Academy",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.56594500,39.32792600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Baltimore Academy Of Excellence",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.67190100,39.33753000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Baltimore Junior Academy",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.61535100,39.31455900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Baltimore Lab: Div Of Lab School Of Washington",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.63594300,39.37042200),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Boys Latin School Of Maryland",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.62817200,39.36550500),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bryn Mawr School",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.66910700,39.27455400),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("The Cardinal Gibbons School",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.57316700,39.31636200),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("The Catholic High School of Baltimore",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.60687700,39.23761300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Chesapeake Alternative School",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.56727300,39.36952900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Childrens Guild In A A Co The",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.53539700,39.36695200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Chimes School",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.59929900,39.30396300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Community Initiatives Academy",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.62449300,39.35712700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Friends School Of Baltimore",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.60550000,39.29100000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Grace Christian Preparatory Academy",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.54098900,39.31540100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Greater Grace Christian Academy",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.62481300,39.32218000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Greenmount School",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.75858700,39.32876700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Harbour School At Baltimore Th",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.60190400,39.30025700),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Institute Of Notre Dame",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.60922200,39.32906300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Inter Faith Academy, The",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.63949300,39.31006300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Islamic Community School",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.65583700,39.33486500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Kennedy Krieger High School Ca",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.59240600,39.29283700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Kennedy Krieger School",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.69573100,39.34950400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Living Word Preparatory School",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.53547400,39.36700300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Maryland School For The Blind",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.58897500,39.36646400),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mercy High School",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.64297600,39.28409600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mount Clare Christian School",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.68881500,39.28146300),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Mount Saint Joseph High School",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.61482200,39.29520900),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("New Foundations",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.58727600,39.28659600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Our Lady Of The Rosary High School",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.63510700,39.35658800),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Roland Park Country School",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.60394000,39.33707100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Elizabeth School, Inc.",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.60927900,39.30252300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Frances Academy",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.60957600,39.32554200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("School Of Original Thought",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.68741200,39.35477000),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Shalheves High School",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.70916800,39.36988300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Shoshana S. Cardin School",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.59497600,39.30455700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sought Out Redeemed Christian School",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.57384700,39.34455200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("True Gospel Christian Academy",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.66856700,39.26932600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Villa Maria School At Seton Ke",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.59485400,39.35394700),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Woodbourne School",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.69466400,39.35889500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Yeshivat Rambam",'Baltimore=' + Baltimore.length);
Baltimore[Baltimore.length] = createMarker(new GPoint(-76.69466400,39.35889500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Yeshivat Rambam Maimonides Academy",'Baltimore=' + Baltimore.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(Baltimore);
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(Baltimore);map.removeOverlays(Baltimore);
map.addOverlays(Baltimore);
centerByArray(Baltimore, false, false);
cntMarker += Baltimore.length;
centerByArray(Baltimore,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;
}