function addMarkers()
{
mySelect = document.getElementById('selection');
Rockville = [];Rockville[Rockville.length] = createMarker(new GPoint(-77.07828522,39.06146240),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Alternative Programs",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.16192627,39.08723831),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Beall Elementary School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.09116364,39.08279419),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Brookhaven Elementary School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.14531708,39.12886810),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Candlewood Elementary School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.11065674,39.07611465),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Carl Sandburg Center",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.08678436,39.13690567),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Cashell Elementary School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.11931610,39.12966156),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Col. Zadok Magruder High School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.16190338,39.10375977),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("College Gardens Elementary School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.10889435,39.09257126),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Earle B. Wood Middle School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.17698669,39.07889938),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Fallsmead Elementary School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.14388275,39.04750061),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Farmland Elementary School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.09089661,39.10638428),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Flower Valley Elementary School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.17839813,39.04679489),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Herbert Hoover Middle School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.16451263,39.07391739),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Julius West Middle School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.10288239,39.10390854),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lakewood Elementary School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.10294342,39.09469986),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lucy V. Barnsley Elementary School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.12928772,39.04352951),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Luxmanor Elementary School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.12288666,39.09310913),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mark Twain School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.13571930,39.08724213),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Maryvale Elementary School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.12375400,39.09469700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mcps Transitions School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.11682129,39.08384705),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Meadow Hall Elementary School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.15226746,39.14618301),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mill Creek Towne Elementary School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.07828522,39.06146240),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Montgomery County Evening High School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.09104156,39.08526230),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Parkland Middle School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.13085937,39.13840485),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Redland Middle School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.20031738,39.10178375),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Regional Institute For Children & Adolescents",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.14456940,39.07809448),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Richard Montgomery High School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.17237854,39.06241989),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Ritchie Park Elementary School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.18663788,39.07383347),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Robert Frost Middle School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.10211945,39.08208466),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Rock Creek Valley Elementary School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.15969849,39.09277725),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Rock Terrace School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.02416992,39.03406143),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Rockville High School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.18157196,39.07277298),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Thomas S. Wootton High School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.12306976,39.03803635),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Tilden Middle School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.11936951,39.06714249),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Twinbrook Elementary School",'Rockville=' + Rockville.length);
Rockville[Rockville.length] = createMarker(new GPoint(-77.08881378,39.06878662),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Wheaton Woods Elementary School",'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,10);
/*
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');
}
}