function addMarkers(){
mySelect = document.getElementById('selection');
Washington = [];mySelect.options[mySelect.options.length] = new Option("Washington schools",'all=Washington');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Washington[Washington.length] = createMarker(new GPoint(-77.02668800,38.98220800),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Academia De La Recta Porta Icds",'Washington=' + Washington.length);
Washington[Washington.length] = createMarker(new GPoint(-77.03478300,38.95203700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Academy For Ideal Education",'Washington=' + Washington.length);
Washington[Washington.length] = createMarker(new GPoint(-77.00287800,38.93918700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Archbishop Carroll High School",'Washington=' + Washington.length);
Washington[Washington.length] = createMarker(new GPoint(-77.06849100,38.91672400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("British School Of Washington",'Washington=' + Washington.length);
Washington[Washington.length] = createMarker(new GPoint(-77.00671000,38.91573700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("City Lights",'Washington=' + Washington.length);
Washington[Washington.length] = createMarker(new GPoint(-76.94879700,38.86835500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Dupont Park Adventist School",'Washington=' + Washington.length);
Washington[Washington.length] = createMarker(new GPoint(-77.06226300,38.94213200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Edmund Burke School",'Washington=' + Washington.length);
Washington[Washington.length] = createMarker(new GPoint(-77.04183500,38.90839600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Emerson Preparatory School",'Washington=' + Washington.length);
Washington[Washington.length] = createMarker(new GPoint(-77.02827500,38.91482900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("F L O C Learning Center",'Washington=' + Washington.length);
Washington[Washington.length] = createMarker(new GPoint(-77.08864000,38.92046900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Field School",'Washington=' + Washington.length);
Washington[Washington.length] = createMarker(new GPoint(-77.08593300,38.90863000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Georgetown Day School",'Washington=' + Washington.length);
Washington[Washington.length] = createMarker(new GPoint(-77.06927500,38.90929700),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Georgetown Visitation School",'Washington=' + Washington.length);
Washington[Washington.length] = createMarker(new GPoint(-77.01166000,38.90140400),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Gonzaga College High School",'Washington=' + Washington.length);
Washington[Washington.length] = createMarker(new GPoint(-77.03468200,38.95433500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ideal Alternative School",'Washington=' + Washington.length);
Washington[Washington.length] = createMarker(new GPoint(-77.03350100,38.95092400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Kingsbury Day School",'Washington=' + Washington.length);
Washington[Washington.length] = createMarker(new GPoint(-77.00272400,38.94023900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Kirov Academy Of Ballet",'Washington=' + Washington.length);
Washington[Washington.length] = createMarker(new GPoint(-77.05949100,38.92885700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Maret School",'Washington=' + Washington.length);
Washington[Washington.length] = createMarker(new GPoint(-77.08930000,38.94180000),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("National Cathedral School",'Washington=' + Washington.length);
Washington[Washington.length] = createMarker(new GPoint(-77.01377600,38.96503700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("National Children's Center",'Washington=' + Washington.length);
Washington[Washington.length] = createMarker(new GPoint(-77.03667500,38.94942200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Parkmont School",'Washington=' + Washington.length);
Washington[Washington.length] = createMarker(new GPoint(-77.07773200,38.94400500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Psychiatric Inst Of Washington",'Washington=' + Washington.length);
Washington[Washington.length] = createMarker(new GPoint(-76.97920000,38.94446900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Rhema Christian Center School",'Washington=' + Washington.length);
Washington[Washington.length] = createMarker(new GPoint(-77.08930000,38.94180000),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("St. Albans School",'Washington=' + Washington.length);
Washington[Washington.length] = createMarker(new GPoint(-77.05426500,38.96128000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Johns College High School",'Washington=' + Washington.length);
Washington[Washington.length] = createMarker(new GPoint(-77.08339000,38.95656300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Johns Community Services",'Washington=' + Washington.length);
Washington[Washington.length] = createMarker(new GPoint(-77.02492000,38.93278600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sankofa Fie",'Washington=' + Washington.length);
Washington[Washington.length] = createMarker(new GPoint(-77.07455800,38.93909700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sidwell Friends School",'Washington=' + Washington.length);
Washington[Washington.length] = createMarker(new GPoint(-76.98550900,38.94440500),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("St Anselm's Abbey School",'Washington=' + Washington.length);
Washington[Washington.length] = createMarker(new GPoint(-77.02007800,38.90468200),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Sunrise Academy",'Washington=' + Washington.length);
Washington[Washington.length] = createMarker(new GPoint(-77.02311900,38.91046000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ujamaa School",'Washington=' + Washington.length);
Washington[Washington.length] = createMarker(new GPoint(-77.00280800,38.94020000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Universal Ballet Academy",'Washington=' + Washington.length);
Washington[Washington.length] = createMarker(new GPoint(-77.06214400,38.93336300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Washington International School",'Washington=' + Washington.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(Washington);
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(Washington);map.removeOverlays(Washington);
map.addOverlays(Washington);
centerByArray(Washington, false, false);
cntMarker += Washington.length;
centerByArray(Washington,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;
}