function addMarkers()
{
mySelect = document.getElementById('selection');
Ellicott_City = [];Columbia = [];Jessup = [];Glenwood = [];Fulton = [];Clarksville = [];Elkridge = [];Glenelg = [];Woodbine = [];Marriottsville = [];Mount_Airy = [];West_Friendship = [];mySelect.options[mySelect.options.length] = new Option("Clarksville schools",'all=Clarksville');
mySelect.options[mySelect.options.length] = new Option("Columbia schools",'all=Columbia');
mySelect.options[mySelect.options.length] = new Option("Elkridge schools",'all=Elkridge');
mySelect.options[mySelect.options.length] = new Option("Ellicott City schools",'all=Ellicott_City');
mySelect.options[mySelect.options.length] = new Option("Fulton schools",'all=Fulton');
mySelect.options[mySelect.options.length] = new Option("Glenelg schools",'all=Glenelg');
mySelect.options[mySelect.options.length] = new Option("Glenwood schools",'all=Glenwood');
mySelect.options[mySelect.options.length] = new Option("Jessup schools",'all=Jessup');
mySelect.options[mySelect.options.length] = new Option("Marriottsville schools",'all=Marriottsville');
mySelect.options[mySelect.options.length] = new Option("Mount Airy schools",'all=Mount_Airy');
mySelect.options[mySelect.options.length] = new Option("West Friendship schools",'all=West_Friendship');
mySelect.options[mySelect.options.length] = new Option("Woodbine schools",'all=Woodbine');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Ellicott_City[Ellicott_City.length] = createMarker(new GPoint(-76.79882812,39.26710892),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Applications And Research Laboratory High School",'Ellicott_City=' + Ellicott_City.length);
Columbia[Columbia.length] = createMarker(new GPoint(-76.86256409,39.18647766),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Atholton Elementary School",'Columbia=' + Columbia.length);
Columbia[Columbia.length] = createMarker(new GPoint(-76.88101196,39.19459534),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Atholton High School",'Columbia=' + Columbia.length);
Ellicott_City[Ellicott_City.length] = createMarker(new GPoint(-76.80139923,39.25479889),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bellows Spring Elementary School",'Ellicott_City=' + Ellicott_City.length);
Jessup[Jessup.length] = createMarker(new GPoint(-76.82637787,39.14542389),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bollman Bridge Elementary School",'Jessup=' + Jessup.length);
Ellicott_City[Ellicott_City.length] = createMarker(new GPoint(-76.77156830,39.23566818),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Bonnie Branch Middle School",'Ellicott_City=' + Ellicott_City.length);
Columbia[Columbia.length] = createMarker(new GPoint(-76.86634064,39.22197342),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bryant Woods Elementary School",'Columbia=' + Columbia.length);
Ellicott_City[Ellicott_City.length] = createMarker(new GPoint(-76.86550140,39.25678253),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Burleigh Manor Middle School",'Ellicott_City=' + Ellicott_City.length);
Glenwood[Glenwood.length] = createMarker(new GPoint(-77.02241516,39.29785156),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bushy Park Elementary School",'Glenwood=' + Glenwood.length);
Fulton[Fulton.length] = createMarker(new GPoint(-76.88690948,39.22309113),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cedar Lane Special Center",'Fulton=' + Fulton.length);
Ellicott_City[Ellicott_City.length] = createMarker(new GPoint(-76.86719513,39.25302124),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Centennial High School",'Ellicott_City=' + Ellicott_City.length);
Ellicott_City[Ellicott_City.length] = createMarker(new GPoint(-76.86199951,39.26461029),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Centennial Lane Elementary School",'Ellicott_City=' + Ellicott_City.length);
Clarksville[Clarksville.length] = createMarker(new GPoint(-76.92939758,39.21937943),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Clarksville Elementary School",'Clarksville=' + Clarksville.length);
Clarksville[Clarksville.length] = createMarker(new GPoint(-76.92438507,39.19148254),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Clarksville Middle School",'Clarksville=' + Clarksville.length);
Columbia[Columbia.length] = createMarker(new GPoint(-76.87397766,39.19342422),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Clemens Crossing Elementary School",'Columbia=' + Columbia.length);
Columbia[Columbia.length] = createMarker(new GPoint(-76.84386444,39.19229126),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Dasher Green Elementary School",'Columbia=' + Columbia.length);
Elkridge[Elkridge.length] = createMarker(new GPoint(-76.78753662,39.18453979),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Deep Run Elementary School",'Elkridge=' + Elkridge.length);
Ellicott_City[Ellicott_City.length] = createMarker(new GPoint(-76.82794189,39.25634384),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Dunloggin Middle School",'Ellicott_City=' + Ellicott_City.length);
Elkridge[Elkridge.length] = createMarker(new GPoint(-76.73260498,39.21111298),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Elkridge Elementary School",'Elkridge=' + Elkridge.length);
Elkridge[Elkridge.length] = createMarker(new GPoint(-76.73242187,39.21108627),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Elkridge Landing Middle School",'Elkridge=' + Elkridge.length);
Ellicott_City[Ellicott_City.length] = createMarker(new GPoint(-76.81077576,39.24914169),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Ellicott Mills Middle School",'Ellicott_City=' + Ellicott_City.length);
Ellicott_City[Ellicott_City.length] = createMarker(new GPoint(-76.86409760,39.27379990),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Folly Quarter Middle School",'Ellicott_City=' + Ellicott_City.length);
Fulton[Fulton.length] = createMarker(new GPoint(-76.91653442,39.15021515),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Fulton Elementary School",'Fulton=' + Fulton.length);
Glenelg[Glenelg.length] = createMarker(new GPoint(-77.00179291,39.27594376),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Glenelg High School",'Glenelg=' + Glenelg.length);
Glenwood[Glenwood.length] = createMarker(new GPoint(-77.02259827,39.29760742),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Glenwood Middle School",'Glenwood=' + Glenwood.length);
Columbia[Columbia.length] = createMarker(new GPoint(-76.83066559,39.17064667),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Guilford Elementary School",'Columbia=' + Columbia.length);
Columbia[Columbia.length] = createMarker(new GPoint(-76.85951996,39.16856766),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hammond High School",'Columbia=' + Columbia.length);
Columbia[Columbia.length] = createMarker(new GPoint(-76.88704681,39.22272873),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Harpers Choice Middle School",'Columbia=' + Columbia.length);
Ellicott_City[Ellicott_City.length] = createMarker(new GPoint(-76.81607056,39.30203247),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hollifield Station Elementary School",'Ellicott_City=' + Ellicott_City.length);
Ellicott_City[Ellicott_City.length] = createMarker(new GPoint(-76.79882812,39.26710892),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Homewood School",'Ellicott_City=' + Ellicott_City.length);
Ellicott_City[Ellicott_City.length] = createMarker(new GPoint(-76.83969879,39.24075699),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Howard High School",'Ellicott_City=' + Ellicott_City.length);
Ellicott_City[Ellicott_City.length] = createMarker(new GPoint(-76.77160645,39.23561096),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Ilchester Elementary School",'Ellicott_City=' + Ellicott_City.length);
Columbia[Columbia.length] = createMarker(new GPoint(-76.82825470,39.20532227),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Jeffers Hill Elementary School",'Columbia=' + Columbia.length);
Fulton[Fulton.length] = createMarker(new GPoint(-76.91680908,39.15025330),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Lime Kiln Middle School",'Fulton=' + Fulton.length);
Woodbine[Woodbine.length] = createMarker(new GPoint(-77.01889801,39.32033920),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lisbon Elementary School",'Woodbine=' + Woodbine.length);
Columbia[Columbia.length] = createMarker(new GPoint(-76.81235504,39.20729446),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Long Reach High School",'Columbia=' + Columbia.length);
Columbia[Columbia.length] = createMarker(new GPoint(-76.88249969,39.22542191),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Longfellow Elementary School",'Columbia=' + Columbia.length);
Ellicott_City[Ellicott_City.length] = createMarker(new GPoint(-76.91687775,39.29341125),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Manor Woods Elementary School",'Ellicott_City=' + Ellicott_City.length);
Marriottsville[Marriottsville.length] = createMarker(new GPoint(-76.93363000,39.32820200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Marriotts Ridge High School",'Marriottsville=' + Marriottsville.length);
Elkridge[Elkridge.length] = createMarker(new GPoint(-76.78531647,39.19580841),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Mayfield Woods Middle School",'Elkridge=' + Elkridge.length);
Mount_Airy[Mount_Airy.length] = createMarker(new GPoint(-77.10423279,39.36791992),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Mount Airy Middle School",'Mount_Airy=' + Mount_Airy.length);
Ellicott_City[Ellicott_City.length] = createMarker(new GPoint(-76.79882812,39.26710892),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mount Hebron High School",'Ellicott_City=' + Ellicott_City.length);
Marriottsville[Marriottsville.length] = createMarker(new GPoint(-76.93500519,39.32003403),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Mount View Middle School",'Marriottsville=' + Marriottsville.length);
Ellicott_City[Ellicott_City.length] = createMarker(new GPoint(-76.82780457,39.25631714),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Northfield Elementary School",'Ellicott_City=' + Ellicott_City.length);
Columbia[Columbia.length] = createMarker(new GPoint(-76.83455658,39.20741653),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Oakland Mills High School",'Columbia=' + Columbia.length);
Columbia[Columbia.length] = createMarker(new GPoint(-76.84627533,39.20595932),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Oakland Mills Middle School",'Columbia=' + Columbia.length);
Columbia[Columbia.length] = createMarker(new GPoint(-76.84386444,39.19229126),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Owen Brown Middle School",'Columbia=' + Columbia.length);
Ellicott_City[Ellicott_City.length] = createMarker(new GPoint(-76.81693268,39.30004120),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Patapsco Middle School",'Ellicott_City=' + Ellicott_City.length);
Jessup[Jessup.length] = createMarker(new GPoint(-76.82936859,39.14765167),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Patuxent Valley Middle School",'Jessup=' + Jessup.length);
Columbia[Columbia.length] = createMarker(new GPoint(-76.81703186,39.22304916),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Phelps Luck Elementary School",'Columbia=' + Columbia.length);
Clarksville[Clarksville.length] = createMarker(new GPoint(-76.92555237,39.18961334),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pointers Run Elementary School",'Clarksville=' + Clarksville.length);
Fulton[Fulton.length] = createMarker(new GPoint(-76.91374969,39.14979172),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Reservoir High School",'Fulton=' + Fulton.length);
Clarksville[Clarksville.length] = createMarker(new GPoint(-76.93105316,39.21772385),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("River Hill High School",'Clarksville=' + Clarksville.length);
Elkridge[Elkridge.length] = createMarker(new GPoint(-76.76882172,39.21416473),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Rockburn Elementary School",'Elkridge=' + Elkridge.length);
Columbia[Columbia.length] = createMarker(new GPoint(-76.85910797,39.22883224),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Running Brook Elementary School",'Columbia=' + Columbia.length);
Ellicott_City[Ellicott_City.length] = createMarker(new GPoint(-76.83193207,39.29021454),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Saint Johns Lane Elementary School",'Ellicott_City=' + Ellicott_City.length);
Columbia[Columbia.length] = createMarker(new GPoint(-76.84612274,39.20468521),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Stevens Forest Elementary School",'Columbia=' + Columbia.length);
Columbia[Columbia.length] = createMarker(new GPoint(-76.88790131,39.21723557),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Swansfield Elementary School",'Columbia=' + Columbia.length);
Columbia[Columbia.length] = createMarker(new GPoint(-76.84586334,39.21347427),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Talbott Springs Elementary School",'Columbia=' + Columbia.length);
Columbia[Columbia.length] = createMarker(new GPoint(-76.83581543,39.22951889),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Thunder Hill Elementary School",'Columbia=' + Columbia.length);
Ellicott_City[Ellicott_City.length] = createMarker(new GPoint(-76.97737122,39.26616287),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Triadelphia Ridge Elementary School",'Ellicott_City=' + Ellicott_City.length);
Columbia[Columbia.length] = createMarker(new GPoint(-76.79679871,39.20743179),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Waterloo Elementary School",'Columbia=' + Columbia.length);
Ellicott_City[Ellicott_City.length] = createMarker(new GPoint(-76.86823273,39.30345535),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Waverly Elementary School",'Ellicott_City=' + Ellicott_City.length);
West_Friendship[West_Friendship.length] = createMarker(new GPoint(-76.94751740,39.30128860),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("West Friendship Elementary School",'West_Friendship=' + West_Friendship.length);
Columbia[Columbia.length] = createMarker(new GPoint(-76.87354279,39.21824646),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Wilde Lake High School",'Columbia=' + Columbia.length);
Columbia[Columbia.length] = createMarker(new GPoint(-76.87582397,39.21990585),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Wilde Lake Middle School",'Columbia=' + Columbia.length);
Ellicott_City[Ellicott_City.length] = createMarker(new GPoint(-76.79286194,39.24454498),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Worthington Elementary School",'Ellicott_City=' + Ellicott_City.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(Clarksville);
map.removeOverlays(Columbia);
map.removeOverlays(Elkridge);
map.removeOverlays(Ellicott_City);
map.removeOverlays(Fulton);
map.removeOverlays(Glenelg);
map.removeOverlays(Glenwood);
map.removeOverlays(Jessup);
map.removeOverlays(Marriottsville);
map.removeOverlays(Mount_Airy);
map.removeOverlays(West_Friendship);
map.removeOverlays(Woodbine);
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(Ellicott_City);map.removeOverlays(Clarksville);
map.removeOverlays(Columbia);
map.removeOverlays(Elkridge);
map.removeOverlays(Ellicott_City);
map.removeOverlays(Fulton);
map.removeOverlays(Glenelg);
map.removeOverlays(Glenwood);
map.removeOverlays(Jessup);
map.removeOverlays(Marriottsville);
map.removeOverlays(Mount_Airy);
map.removeOverlays(West_Friendship);
map.removeOverlays(Woodbine);
map.addOverlays(Clarksville);
centerByArray(Clarksville, false, false);
cntMarker += Clarksville.length;
map.addOverlays(Columbia);
centerByArray(Columbia, false, false);
cntMarker += Columbia.length;
map.addOverlays(Elkridge);
centerByArray(Elkridge, false, false);
cntMarker += Elkridge.length;
map.addOverlays(Ellicott_City);
centerByArray(Ellicott_City, false, false);
cntMarker += Ellicott_City.length;
map.addOverlays(Fulton);
centerByArray(Fulton, false, false);
cntMarker += Fulton.length;
map.addOverlays(Glenelg);
centerByArray(Glenelg, false, false);
cntMarker += Glenelg.length;
map.addOverlays(Glenwood);
centerByArray(Glenwood, false, false);
cntMarker += Glenwood.length;
map.addOverlays(Jessup);
centerByArray(Jessup, false, false);
cntMarker += Jessup.length;
map.addOverlays(Marriottsville);
centerByArray(Marriottsville, false, false);
cntMarker += Marriottsville.length;
map.addOverlays(Mount_Airy);
centerByArray(Mount_Airy, false, false);
cntMarker += Mount_Airy.length;
map.addOverlays(West_Friendship);
centerByArray(West_Friendship, false, false);
cntMarker += West_Friendship.length;
map.addOverlays(Woodbine);
centerByArray(Woodbine, false, false);
cntMarker += Woodbine.length;
centerByArray(Ellicott_City,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');
}
}