function addMarkers(){ mySelect = document.getElementById('selection'); Columbia = [];Marriottsville = [];Glenwood = [];Ellicott_City = [];Fulton = [];Elkridge = [];Laurel = [];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("Glenwood schools",'all=Glenwood'); mySelect.options[mySelect.options.length] = new Option("Laurel schools",'all=Laurel'); mySelect.options[mySelect.options.length] = new Option("Marriottsville schools",'all=Marriottsville'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Columbia[Columbia.length] = createMarker(new GPoint(-76.87041600,39.19237600),"
Atholton Adventist Academy
6520 Martin Road
Columbia, MD 21044
Co-ed school, PK-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Atholton Adventist Academy",'Columbia=' + Columbia.length); Marriottsville[Marriottsville.length] = createMarker(new GPoint(-76.90055200,39.30006300),"
Chapelgate Christian Academy
2600 Marriottsville Road
Marriottsville, MD 21104
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Chapelgate Christian Academy",'Marriottsville=' + Marriottsville.length); Columbia[Columbia.length] = createMarker(new GPoint(-76.87162300,39.17847400),"
Columbia Academy
10350 Old Columbia Road
Columbia, MD 21046
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Columbia Academy",'Columbia=' + Columbia.length); Glenwood[Glenwood.length] = createMarker(new GPoint(-77.02839500,39.28717600),"
Cornerstone Academy Of Glenwood
3060 Washington Road, Route 97
Glenwood, MD 21738
Co-ed school, 3-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cornerstone Academy Of Glenwood",'Glenwood=' + Glenwood.length); Ellicott_City[Ellicott_City.length] = createMarker(new GPoint(-76.95448400,39.25670800),"
Glenelg Country School
12793 Folly Quarter Road
Ellicott City, MD 21042
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Glenelg Country School",'Ellicott_City=' + Ellicott_City.length); Fulton[Fulton.length] = createMarker(new GPoint(-76.94100900,39.17661600),"
High Road Academy
12350 Hall Shop Road
Fulton, MD 20759
Co-ed school, 4-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("High Road Academy",'Fulton=' + Fulton.length); Ellicott_City[Ellicott_City.length] = createMarker(new GPoint(-76.80104100,39.27766500),"
Linwood Center
3421 Martha Bush Drive
Ellicott City, MD 21043
Co-ed school, 3-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Linwood Center",'Ellicott_City=' + Ellicott_City.length); Elkridge[Elkridge.length] = createMarker(new GPoint(-76.71967800,39.20844800),"
Norbel School
6135 Old Washington Road
Elkridge, MD 21075
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Norbel School",'Elkridge=' + Elkridge.length); Laurel[Laurel.length] = createMarker(new GPoint(-76.82772200,39.11141800),"
Phillips School - Laurel
8920 Whiskey Bottom Road
Laurel, MD 20723
Co-ed school, 4-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Phillips School - Laurel",'Laurel=' + Laurel.length); Ellicott_City[Ellicott_City.length] = createMarker(new GPoint(-76.79257800,39.25830700),"
Taylor School
4100 College Avenue
Ellicott City, MD 21043
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Taylor 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,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(Columbia); map.removeOverlays(Elkridge); map.removeOverlays(Ellicott_City); map.removeOverlays(Fulton); map.removeOverlays(Glenwood); map.removeOverlays(Laurel); map.removeOverlays(Marriottsville); 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(Columbia);map.removeOverlays(Columbia); map.removeOverlays(Elkridge); map.removeOverlays(Ellicott_City); map.removeOverlays(Fulton); map.removeOverlays(Glenwood); map.removeOverlays(Laurel); map.removeOverlays(Marriottsville); 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(Glenwood); centerByArray(Glenwood, false, false); cntMarker += Glenwood.length; map.addOverlays(Laurel); centerByArray(Laurel, false, false); cntMarker += Laurel.length; map.addOverlays(Marriottsville); centerByArray(Marriottsville, false, false); cntMarker += Marriottsville.length; centerByArray(Columbia,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; }