function addMarkers(){ mySelect = document.getElementById('selection'); Bel_Air = [];Havre_De_Grace = [];Joppa = [];Darlington = [];Street = [];Abingdon = [];mySelect.options[mySelect.options.length] = new Option("Abingdon schools",'all=Abingdon'); mySelect.options[mySelect.options.length] = new Option("Bel Air schools",'all=Bel_Air'); mySelect.options[mySelect.options.length] = new Option("Darlington schools",'all=Darlington'); mySelect.options[mySelect.options.length] = new Option("Havre De Grace schools",'all=Havre_De_Grace'); mySelect.options[mySelect.options.length] = new Option("Joppa schools",'all=Joppa'); mySelect.options[mySelect.options.length] = new Option("Street schools",'all=Street'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Bel_Air[Bel_Air.length] = createMarker(new GPoint(-76.26479800,39.49980600),"
The Arrow Center For Education-fair Meadows
2416 Creswell Road
Bel Air, MD 21015
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Arrow Center For Education-fair Meadows",'Bel_Air=' + Bel_Air.length); Havre_De_Grace[Havre_De_Grace.length] = createMarker(new GPoint(-76.14879900,39.57583000),"
Bethel Christian Academy
21 N Earlton Road Ext
Havre De Grace, MD 21078
Co-ed school, PK-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bethel Christian Academy",'Havre_De_Grace=' + Havre_De_Grace.length); Joppa[Joppa.length] = createMarker(new GPoint(-76.33312100,39.41203700),"
Chesapeake Christian School
900 Trimble Road
Joppa, MD 21085
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Chesapeake Christian School",'Joppa=' + Joppa.length); Bel_Air[Bel_Air.length] = createMarker(new GPoint(-76.32718500,39.50262900),"
Emmorton Baptist Academy
106 Plumtree Road
Bel Air, MD 21015
Co-ed school, K-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Emmorton Baptist Academy",'Bel_Air=' + Bel_Air.length); Darlington[Darlington.length] = createMarker(new GPoint(-76.22091000,39.65250900),"
Harford Christian School
1736 Whiteford Road
Darlington, MD 21034
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Harford Christian School",'Darlington=' + Darlington.length); Street[Street.length] = createMarker(new GPoint(-76.37828500,39.66819400),"
Harford Friends School
708 Highland Road
Street, MD 21154
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Harford Friends School",'Street=' + Street.length); Bel_Air[Bel_Air.length] = createMarker(new GPoint(-76.32874300,39.51321800),"
Harford Lutheran School
1515 Emmorton Road
Bel Air, MD 21014
Co-ed school, 6-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Harford Lutheran School",'Bel_Air=' + Bel_Air.length); Bel_Air[Bel_Air.length] = createMarker(new GPoint(-76.35004100,39.53632200),"
James Run Christian Academy
PO Box 1038
Bel Air, MD 21014
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("James Run Christian Academy",'Bel_Air=' + Bel_Air.length); Bel_Air[Bel_Air.length] = createMarker(new GPoint(-76.33420500,39.53958000),"
John Carroll School
703 E Churchville Road
Bel Air, MD 21014
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("John Carroll School",'Bel_Air=' + Bel_Air.length); Joppa[Joppa.length] = createMarker(new GPoint(-76.37387800,39.46978500),"
Mountain Christian School
1824 Mountain Road
Joppa, MD 21085
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mountain Christian School",'Joppa=' + Joppa.length); Abingdon[Abingdon.length] = createMarker(new GPoint(-76.31362500,39.48957100),"
New Covenant Christian School
128 Saint Marys Church Road
Abingdon, MD 21009
Co-ed school, PK-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Covenant Christian School",'Abingdon=' + Abingdon.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(Abingdon); map.removeOverlays(Bel_Air); map.removeOverlays(Darlington); map.removeOverlays(Havre_De_Grace); map.removeOverlays(Joppa); map.removeOverlays(Street); 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(Bel_Air);map.removeOverlays(Abingdon); map.removeOverlays(Bel_Air); map.removeOverlays(Darlington); map.removeOverlays(Havre_De_Grace); map.removeOverlays(Joppa); map.removeOverlays(Street); map.addOverlays(Abingdon); centerByArray(Abingdon, false, false); cntMarker += Abingdon.length; map.addOverlays(Bel_Air); centerByArray(Bel_Air, false, false); cntMarker += Bel_Air.length; map.addOverlays(Darlington); centerByArray(Darlington, false, false); cntMarker += Darlington.length; map.addOverlays(Havre_De_Grace); centerByArray(Havre_De_Grace, false, false); cntMarker += Havre_De_Grace.length; map.addOverlays(Joppa); centerByArray(Joppa, false, false); cntMarker += Joppa.length; map.addOverlays(Street); centerByArray(Street, false, false); cntMarker += Street.length; centerByArray(Bel_Air,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; }