function addMarkers(){
mySelect = document.getElementById('selection');
Rockville = [];Rockville[Rockville.length] = createMarker(new GPoint(-77.20795400,39.09743700),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Academy Primary School & Child Development Center",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.11100100,39.12044800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Camp Olympia Country Day School and Summer Sports Camp",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.12627600,39.05523800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Charles E Smith Jewish Day School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.09034600,39.09139800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Children's Learning Center Inc",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.15297600,39.08298800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Christ Episcopal School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.11373200,39.08146200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Community School Of Md",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.15392900,39.09782900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Community School Of Md @ Jacks",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.16216400,39.09138800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Early Childhood Center",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.12014200,39.04846600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Executive Child Development Center",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.11983900,39.04834400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Foundation Schools",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.09948200,39.07132300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Frost School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.12424900,39.05283700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ganon Gil Preschool",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.17127100,39.09407800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Georgetown Hill Early Chilhood",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.16960100,39.03133900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Georgetown Hill Early School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.12355600,39.07676300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Good Shepherd Montessori School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.13188900,39.04898500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Green Acres School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.11608500,39.08744600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hebrew Day Institute",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.16156600,39.04673200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ivymount School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.20356300,39.09893600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Katherine Thomas School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.09903600,39.04811600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lourie Center School Of The Reginald S Lourie Center",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.09947600,39.07394100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Melvin J Berman Hebrew Academy",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.10557800,39.05346200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Montrose Christian School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.11423800,39.05333600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Montrose School Llc Ctr For Optimal Learning",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.08908700,39.11251400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Norbeck Montessori Center",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.21882900,39.08655000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Primary Montessori Day School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.20091600,39.10019800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Ridge School Of Montgomery County",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.17031300,39.08321300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Rockville Nursery School & Kindergarten",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.13522900,39.05372200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Elizabeth Elementary School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.09485300,39.06470800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Jude Catholic School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.14346700,39.08107300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Marys Elementary School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.16949800,39.08523800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("WEE Center, FBC Rockville",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.10242200,39.04908700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("White Flint Children's House",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.11186000,39.04561100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("White Flint Country Day",'Rockville=' + Rockville.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(Rockville);
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(Rockville);map.removeOverlays(Rockville);
map.addOverlays(Rockville);
centerByArray(Rockville, false, false);
cntMarker += Rockville.length;
centerByArray(Rockville,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;
}