function addMarkers(){ mySelect = document.getElementById('selection'); Columbia = [];Baltimore = [];Beltsville = [];Westminster = [];Ellicott_City = [];Sudlersville = [];Frederick = [];Salisbury = [];Hyattsville = [];Hagerstown = [];Joppa = [];Takoma_Park = [];Gambrills = [];Oakland = [];Olney = [];Silver_Spring = [];mySelect.options[mySelect.options.length] = new Option("Baltimore schools",'all=Baltimore'); mySelect.options[mySelect.options.length] = new Option("Beltsville schools",'all=Beltsville'); mySelect.options[mySelect.options.length] = new Option("Columbia schools",'all=Columbia'); mySelect.options[mySelect.options.length] = new Option("Ellicott City schools",'all=Ellicott_City'); mySelect.options[mySelect.options.length] = new Option("Frederick schools",'all=Frederick'); mySelect.options[mySelect.options.length] = new Option("Gambrills schools",'all=Gambrills'); mySelect.options[mySelect.options.length] = new Option("Hagerstown schools",'all=Hagerstown'); mySelect.options[mySelect.options.length] = new Option("Hyattsville schools",'all=Hyattsville'); mySelect.options[mySelect.options.length] = new Option("Joppa schools",'all=Joppa'); mySelect.options[mySelect.options.length] = new Option("Oakland schools",'all=Oakland'); mySelect.options[mySelect.options.length] = new Option("Olney schools",'all=Olney'); mySelect.options[mySelect.options.length] = new Option("Salisbury schools",'all=Salisbury'); mySelect.options[mySelect.options.length] = new Option("Silver Spring schools",'all=Silver_Spring'); mySelect.options[mySelect.options.length] = new Option("Sudlersville schools",'all=Sudlersville'); mySelect.options[mySelect.options.length] = new Option("Takoma Park schools",'all=Takoma_Park'); mySelect.options[mySelect.options.length] = new Option("Westminster schools",'all=Westminster'); 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); Baltimore[Baltimore.length] = createMarker(new GPoint(-76.67190100,39.33753000),"
Baltimore Junior Academy
3006 W Cold Spring Lane
Baltimore, MD 21215
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Baltimore Junior Academy",'Baltimore=' + Baltimore.length); Beltsville[Beltsville.length] = createMarker(new GPoint(-76.92124800,39.05313700),"
Beltsville Sda School
4230 Ammendale Road
Beltsville, MD 20705
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Beltsville Sda School",'Beltsville=' + Beltsville.length); Westminster[Westminster.length] = createMarker(new GPoint(-76.98614200,39.54381700),"
Crest Lane Sda Church School
324 Crest Lane
Westminster, MD 21157
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Crest Lane Sda Church School",'Westminster=' + Westminster.length); Ellicott_City[Ellicott_City.length] = createMarker(new GPoint(-76.82656000,39.28120800),"
Crossroads Adventist School
3291 Saint Johns Lane
Ellicott City, MD 21042
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Crossroads Adventist School",'Ellicott_City=' + Ellicott_City.length); Sudlersville[Sudlersville.length] = createMarker(new GPoint(-75.89396100,39.19189800),"
Eastern Shore Junior Academy
407 Dudley Corners Road
Sudlersville, MD 21668
Co-ed school, PK-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Eastern Shore Junior Academy",'Sudlersville=' + Sudlersville.length); Frederick[Frederick.length] = createMarker(new GPoint(-77.44511000,39.40214900),"
Frederick Adventist School
6437 Jefferson Pike
Frederick, MD 21703
Co-ed school, K-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Frederick Adventist School",'Frederick=' + Frederick.length); Salisbury[Salisbury.length] = createMarker(new GPoint(-75.51912000,38.37239000),"
Gateway Christian Academy
31525 John Deere Drive
Salisbury, MD 21804
Co-ed school, 3-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Gateway Christian Academy",'Salisbury=' + Salisbury.length); Hyattsville[Hyattsville.length] = createMarker(new GPoint(-76.98778600,38.96609000),"
George E Peters Adventist School
6303 Riggs Road
Hyattsville, MD 20783
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("George E Peters Adventist School",'Hyattsville=' + Hyattsville.length); Hagerstown[Hagerstown.length] = createMarker(new GPoint(-77.61392200,39.59245600),"
Highland View Academy
10100 Academy Drive
Hagerstown, MD 21740
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Highland View Academy",'Hagerstown=' + Hagerstown.length); Joppa[Joppa.length] = createMarker(new GPoint(-76.37452100,39.48090200),"
Hudson Sda School
1010 Old Jappa Road
Joppa, MD 21085
Co-ed school, 2-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hudson Sda School",'Joppa=' + Joppa.length); Takoma_Park[Takoma_Park.length] = createMarker(new GPoint(-77.00744000,38.97342600),"
John Nevins Andrews School
117 Elm Avenue
Takoma Park, MD 20912
Co-ed school, NS-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("John Nevins Andrews School",'Takoma_Park=' + Takoma_Park.length); Gambrills[Gambrills.length] = createMarker(new GPoint(-76.65582100,38.98403700),"
Martin Barr Adventist School
2365 Bell Branch Road
Gambrills, MD 21054
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Martin Barr Adventist School",'Gambrills=' + Gambrills.length); Oakland[Oakland.length] = createMarker(new GPoint(-79.36642500,39.46592200),"
Mountain Top SDA School
16335 Garrett Highway
Oakland, MD 21550
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mountain Top SDA School",'Oakland=' + Oakland.length); Hagerstown[Hagerstown.length] = createMarker(new GPoint(-77.60195100,39.59444600),"
Mt Aetna Sda School
10207 Crystal Falls Drive
Hagerstown, MD 21740
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mt Aetna Sda School",'Hagerstown=' + Hagerstown.length); Olney[Olney.length] = createMarker(new GPoint(-77.07984700,39.16102800),"
Olney Adventist Preparatory
4100 Olney Laytonsville Road
Olney, MD 20832
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Olney Adventist Preparatory",'Olney=' + Olney.length); Takoma_Park[Takoma_Park.length] = createMarker(new GPoint(-76.99304200,38.99283400),"
Sligo Adventist School
8300 Carroll Avenue
Takoma Park, MD 20912
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sligo Adventist School",'Takoma_Park=' + Takoma_Park.length); Silver_Spring[Silver_Spring.length] = createMarker(new GPoint(-76.97696300,39.11721500),"
Spencerville Adventist Academy
15930 Good Hope Road
Silver Spring, MD 20905
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Spencerville Adventist Academy",'Silver_Spring=' + Silver_Spring.length); map.removeOverlays(Baltimore); map.removeOverlays(Beltsville); map.removeOverlays(Columbia); map.removeOverlays(Ellicott_City); map.removeOverlays(Frederick); map.removeOverlays(Gambrills); map.removeOverlays(Hagerstown); map.removeOverlays(Hyattsville); map.removeOverlays(Joppa); map.removeOverlays(Oakland); map.removeOverlays(Olney); map.removeOverlays(Salisbury); map.removeOverlays(Silver_Spring); map.removeOverlays(Sudlersville); map.removeOverlays(Takoma_Park); map.removeOverlays(Westminster); setTimeout(function(){map.addOverlays(Baltimore)},1000); setTimeout(function(){map.addOverlays(Beltsville)},1000); setTimeout(function(){map.addOverlays(Columbia)},1000); setTimeout(function(){map.addOverlays(Ellicott_City)},1000); setTimeout(function(){map.addOverlays(Frederick)},1000); setTimeout(function(){map.addOverlays(Gambrills)},1000); setTimeout(function(){map.addOverlays(Hagerstown)},1000); setTimeout(function(){map.addOverlays(Hyattsville)},1000); setTimeout(function(){map.addOverlays(Joppa)},1000); setTimeout(function(){map.addOverlays(Oakland)},1000); setTimeout(function(){map.addOverlays(Olney)},1000); setTimeout(function(){map.addOverlays(Salisbury)},1000); setTimeout(function(){map.addOverlays(Silver_Spring)},1000); setTimeout(function(){map.addOverlays(Sudlersville)},1000); setTimeout(function(){map.addOverlays(Takoma_Park)},1000); setTimeout(function(){map.addOverlays(Westminster)},1000); maxLng = -75.51912000; maxLat = 39.59444600; minLng = -79.36642500; minLat = 38.37239000; reCenterMap(); } // 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(Baltimore); map.removeOverlays(Beltsville); map.removeOverlays(Columbia); map.removeOverlays(Ellicott_City); map.removeOverlays(Frederick); map.removeOverlays(Gambrills); map.removeOverlays(Hagerstown); map.removeOverlays(Hyattsville); map.removeOverlays(Joppa); map.removeOverlays(Oakland); map.removeOverlays(Olney); map.removeOverlays(Salisbury); map.removeOverlays(Silver_Spring); map.removeOverlays(Sudlersville); map.removeOverlays(Takoma_Park); map.removeOverlays(Westminster); 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(Baltimore); map.removeOverlays(Beltsville); map.removeOverlays(Columbia); map.removeOverlays(Ellicott_City); map.removeOverlays(Frederick); map.removeOverlays(Gambrills); map.removeOverlays(Hagerstown); map.removeOverlays(Hyattsville); map.removeOverlays(Joppa); map.removeOverlays(Oakland); map.removeOverlays(Olney); map.removeOverlays(Salisbury); map.removeOverlays(Silver_Spring); map.removeOverlays(Sudlersville); map.removeOverlays(Takoma_Park); map.removeOverlays(Westminster); map.addOverlays(Baltimore); centerByArray(Baltimore, false, false); cntMarker += Baltimore.length; map.addOverlays(Beltsville); centerByArray(Beltsville, false, false); cntMarker += Beltsville.length; map.addOverlays(Columbia); centerByArray(Columbia, false, false); cntMarker += Columbia.length; map.addOverlays(Ellicott_City); centerByArray(Ellicott_City, false, false); cntMarker += Ellicott_City.length; map.addOverlays(Frederick); centerByArray(Frederick, false, false); cntMarker += Frederick.length; map.addOverlays(Gambrills); centerByArray(Gambrills, false, false); cntMarker += Gambrills.length; map.addOverlays(Hagerstown); centerByArray(Hagerstown, false, false); cntMarker += Hagerstown.length; map.addOverlays(Hyattsville); centerByArray(Hyattsville, false, false); cntMarker += Hyattsville.length; map.addOverlays(Joppa); centerByArray(Joppa, false, false); cntMarker += Joppa.length; map.addOverlays(Oakland); centerByArray(Oakland, false, false); cntMarker += Oakland.length; map.addOverlays(Olney); centerByArray(Olney, false, false); cntMarker += Olney.length; map.addOverlays(Salisbury); centerByArray(Salisbury, false, false); cntMarker += Salisbury.length; map.addOverlays(Silver_Spring); centerByArray(Silver_Spring, false, false); cntMarker += Silver_Spring.length; map.addOverlays(Sudlersville); centerByArray(Sudlersville, false, false); cntMarker += Sudlersville.length; map.addOverlays(Takoma_Park); centerByArray(Takoma_Park, false, false); cntMarker += Takoma_Park.length; map.addOverlays(Westminster); centerByArray(Westminster, false, false); cntMarker += Westminster.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///12082,12074,12615,12351,12494,12634,12226,12082,12097,12074,12214,12615,12458,12495,12290,12369,12494,12532,12560,12634,12226,12392,12630,12209,/all'); //window.open('/map.php?type=2&schools=12082,12074,12615,12351,12494,12634,12226,12082,12097,12074,12214,12615,12458,12495,12290,12369,12494,12532,12560,12634,12226,12392,12630,12209,&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; }