function addMarkers(){
mySelect = document.getElementById('selection');
Boston = [];Boston[Boston.length] = createMarker(new GPoint(-71.10679000,42.33343700),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Abc-123 Child Care Center",'Boston=' + Boston.length);
Boston[Boston.length] = createMarker(new GPoint(-71.07198400,42.35832400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Advent School",'Boston=' + Boston.length);
Boston[Boston.length] = createMarker(new GPoint(-71.06526200,42.36059800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Beacon Hill Nursery School",'Boston=' + Boston.length);
Boston[Boston.length] = createMarker(new GPoint(-71.06671200,42.36586800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Boston Children's School",'Boston=' + Boston.length);
Boston[Boston.length] = createMarker(new GPoint(-71.04681700,42.31467600),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Boston College High School",'Boston=' + Boston.length);
Boston[Boston.length] = createMarker(new GPoint(-71.12918900,42.25942300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Boston Trinity Academy",'Boston=' + Boston.length);
Boston[Boston.length] = createMarker(new GPoint(-71.10955600,42.35057200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Boston University Academy",'Boston=' + Boston.length);
Boston[Boston.length] = createMarker(new GPoint(-71.13060300,42.30934800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("British School Of Boston",'Boston=' + Boston.length);
Boston[Boston.length] = createMarker(new GPoint(-71.06843300,42.34049600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cathedral Grammar School",'Boston=' + Boston.length);
Boston[Boston.length] = createMarker(new GPoint(-71.06823000,42.34083800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cathedral High School",'Boston=' + Boston.length);
Boston[Boston.length] = createMarker(new GPoint(-71.07793300,42.35228600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Commonwealth School",'Boston=' + Boston.length);
Boston[Boston.length] = createMarker(new GPoint(-71.07930000,42.33486100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cooper Community Child Development Center",'Boston=' + Boston.length);
Boston[Boston.length] = createMarker(new GPoint(-71.08587800,42.32128300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Eliot Educational Center",'Boston=' + Boston.length);
Boston[Boston.length] = createMarker(new GPoint(-71.08845800,42.29412900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Excel Academy Inc",'Boston=' + Boston.length);
Boston[Boston.length] = createMarker(new GPoint(-71.10957100,42.34038300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Frances Jacobson Early Childhood Center",'Boston=' + Boston.length);
Boston[Boston.length] = createMarker(new GPoint(-71.13850800,42.35299400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Jackson-mann Community Preschool",'Boston=' + Boston.length);
Boston[Boston.length] = createMarker(new GPoint(-71.07304700,42.34915700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("John Hancock Child Care Center",'Boston=' + Boston.length);
Boston[Boston.length] = createMarker(new GPoint(-71.07534900,42.35359500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("John Winthrop School",'Boston=' + Boston.length);
Boston[Boston.length] = createMarker(new GPoint(-71.15350000,42.34980000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Kennedy Day School Program",'Boston=' + Boston.length);
Boston[Boston.length] = createMarker(new GPoint(-71.05669900,42.35863500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Kids Are People Elementary School",'Boston=' + Boston.length);
Boston[Boston.length] = createMarker(new GPoint(-71.09604000,42.34868700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Kids Are People School",'Boston=' + Boston.length);
Boston[Boston.length] = createMarker(new GPoint(-71.08896000,42.29088400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Kids Choice Early Childhood Center",'Boston=' + Boston.length);
Boston[Boston.length] = createMarker(new GPoint(-71.08230300,42.35034700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Kingsley Montessori School",'Boston=' + Boston.length);
Boston[Boston.length] = createMarker(new GPoint(-71.07691500,42.35348400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Learning Project Elementary School",'Boston=' + Boston.length);
Boston[Boston.length] = createMarker(new GPoint(-71.10971400,42.33121600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Manville School",'Boston=' + Boston.length);
Boston[Boston.length] = createMarker(new GPoint(-71.08226800,42.35208900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Newman School",'Boston=' + Boston.length);
Boston[Boston.length] = createMarker(new GPoint(-71.07165500,42.35634100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Park Street School",'Boston=' + Boston.length);
Boston[Boston.length] = createMarker(new GPoint(-71.07624400,42.32488100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Patrick School",'Boston=' + Boston.length);
Boston[Boston.length] = createMarker(new GPoint(-71.05268400,42.36399200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St John School",'Boston=' + Boston.length);
Boston[Boston.length] = createMarker(new GPoint(-71.15939000,42.34196900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Transportation Children's Center",'Boston=' + Boston.length);
Boston[Boston.length] = createMarker(new GPoint(-71.04776900,42.31604200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Umass/boston Early Learning Center",'Boston=' + Boston.length);
Boston[Boston.length] = createMarker(new GPoint(-71.10685800,42.34094200),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("The Winsor School",'Boston=' + Boston.length);
Boston[Boston.length] = createMarker(new GPoint(-71.07909900,42.28338700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Zion Early Learning Center",'Boston=' + Boston.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//////' + showArray);
map.removeOverlays(Boston);
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(Boston);map.removeOverlays(Boston);
map.addOverlays(Boston);
centerByArray(Boston, false, false);
cntMarker += Boston.length;
centerByArray(Boston,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=&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;
}