function addMarkers() { mySelect = document.getElementById('selection'); Dover = [];Millsboro = [];Newark = [];Frankford = [];Frederica = [];Wilmington = [];Milford = [];Georgetown = [];Selbyville = [];mySelect.options[mySelect.options.length] = new Option("Dover schools",'all=Dover'); mySelect.options[mySelect.options.length] = new Option("Frankford schools",'all=Frankford'); mySelect.options[mySelect.options.length] = new Option("Frederica schools",'all=Frederica'); mySelect.options[mySelect.options.length] = new Option("Georgetown schools",'all=Georgetown'); mySelect.options[mySelect.options.length] = new Option("Milford schools",'all=Milford'); mySelect.options[mySelect.options.length] = new Option("Millsboro schools",'all=Millsboro'); mySelect.options[mySelect.options.length] = new Option("Newark schools",'all=Newark'); mySelect.options[mySelect.options.length] = new Option("Selbyville schools",'all=Selbyville'); mySelect.options[mySelect.options.length] = new Option("Wilmington schools",'all=Wilmington'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Dover[Dover.length] = createMarker(new GPoint(-75.53904724,39.15903091),"
Booker T. Washington Elementary School
901 Forest Street
Dover, DE 19904

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Booker T. Washington Elementary School",'Dover=' + Dover.length); Millsboro[Millsboro.length] = createMarker(new GPoint(-75.28824615,38.59088135),"
East Millsboro Elementary School
29346 Iron Branch Road
Millsboro, DE 19966

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("East Millsboro Elementary School",'Millsboro=' + Millsboro.length); Newark[Newark.length] = createMarker(new GPoint(-75.70898437,39.71487427),"
Etta J. Wilson Elementary School
14 Forge Road
Newark, DE 19711

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Etta J. Wilson Elementary School",'Newark=' + Newark.length); Dover[Dover.length] = createMarker(new GPoint(-75.53860474,39.17118073),"
Fairview Elementary School
700 Walker Road
Dover, DE 19904

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fairview Elementary School",'Dover=' + Dover.length); Frankford[Frankford.length] = createMarker(new GPoint(-75.09429932,38.52799988),"
Frankford Elementary School
30207 Frankford School Road
Frankford, DE 19945

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Frankford Elementary School",'Frankford=' + Frankford.length); Newark[Newark.length] = createMarker(new GPoint(-75.74775696,39.65594864),"
Joseph M. Mcvey Elementary School
908 Janice Drive
Newark, DE 19713

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Joseph M. Mcvey Elementary School",'Newark=' + Newark.length); Frederica[Frederica.length] = createMarker(new GPoint(-75.47100830,39.00823975),"
Lake Forest East Elementary School
124 West Front Street
Frederica, DE 19946

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lake Forest East Elementary School",'Frederica=' + Frederica.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-75.49788666,39.82432938),"
Lancashire Elementary School
2000 Naamans Road
Wilmington, DE 19810

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lancashire Elementary School",'Wilmington=' + Wilmington.length); Millsboro[Millsboro.length] = createMarker(new GPoint(-75.29090118,38.59114838),"
Long Neck Elementary School
Rd 10 Box 452
Millsboro, DE 19966

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Long Neck Elementary School",'Millsboro=' + Millsboro.length); Milford[Milford.length] = createMarker(new GPoint(-75.41657257,38.90639114),"
Lulu M. Ross Elementary School
310 Lovers Lane
Milford, DE 19963

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lulu M. Ross Elementary School",'Milford=' + Milford.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-75.62371063,39.74353027),"
Marbrook Elementary School
2101 Centerville Road
Wilmington, DE 19808

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Marbrook Elementary School",'Wilmington=' + Wilmington.length); Georgetown[Georgetown.length] = createMarker(new GPoint(-75.39192963,38.69546127),"
North Georgetown Elementary School
664 North Bedford
Georgetown, DE 19947

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Georgetown Elementary School",'Georgetown=' + Georgetown.length); Selbyville[Selbyville.length] = createMarker(new GPoint(-75.22116852,38.46039963),"
Phillip C. Showell Elementary School
41 Bethany Road
Selbyville, DE 19975

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Phillip C. Showell Elementary School",'Selbyville=' + Selbyville.length); Georgetown[Georgetown.length] = createMarker(new GPoint(-75.47232056,38.62702179),"
Sussex Technical High School
17099 County Seat Highway
Georgetown, DE 19947

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sussex Technical High School",'Georgetown=' + Georgetown.length); map.removeOverlays(Dover); map.removeOverlays(Frankford); map.removeOverlays(Frederica); map.removeOverlays(Georgetown); map.removeOverlays(Milford); map.removeOverlays(Millsboro); map.removeOverlays(Newark); map.removeOverlays(Selbyville); map.removeOverlays(Wilmington); setTimeout(function(){map.addOverlays(Dover)},1000); setTimeout(function(){map.addOverlays(Frankford)},1000); setTimeout(function(){map.addOverlays(Frederica)},1000); setTimeout(function(){map.addOverlays(Georgetown)},1000); setTimeout(function(){map.addOverlays(Milford)},1000); setTimeout(function(){map.addOverlays(Millsboro)},1000); setTimeout(function(){map.addOverlays(Newark)},1000); setTimeout(function(){map.addOverlays(Selbyville)},1000); setTimeout(function(){map.addOverlays(Wilmington)},1000); maxLng = -75.09429932; maxLat = 39.82432938; minLng = -75.74775696; minLat = 38.46039963; 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,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(Dover); map.removeOverlays(Frankford); map.removeOverlays(Frederica); map.removeOverlays(Georgetown); map.removeOverlays(Milford); map.removeOverlays(Millsboro); map.removeOverlays(Newark); map.removeOverlays(Selbyville); map.removeOverlays(Wilmington); 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(Dover);map.removeOverlays(Dover); map.removeOverlays(Frankford); map.removeOverlays(Frederica); map.removeOverlays(Georgetown); map.removeOverlays(Milford); map.removeOverlays(Millsboro); map.removeOverlays(Newark); map.removeOverlays(Selbyville); map.removeOverlays(Wilmington); map.addOverlays(Dover); centerByArray(Dover, false, false); cntMarker += Dover.length; map.addOverlays(Frankford); centerByArray(Frankford, false, false); cntMarker += Frankford.length; map.addOverlays(Frederica); centerByArray(Frederica, false, false); cntMarker += Frederica.length; map.addOverlays(Georgetown); centerByArray(Georgetown, false, false); cntMarker += Georgetown.length; map.addOverlays(Milford); centerByArray(Milford, false, false); cntMarker += Milford.length; map.addOverlays(Millsboro); centerByArray(Millsboro, false, false); cntMarker += Millsboro.length; map.addOverlays(Newark); centerByArray(Newark, false, false); cntMarker += Newark.length; map.addOverlays(Selbyville); centerByArray(Selbyville, false, false); cntMarker += Selbyville.length; map.addOverlays(Wilmington); centerByArray(Wilmington, false, false); cntMarker += Wilmington.length; centerByArray(Dover,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///16568,16424,16419,16476,16487,16472,16500,16475,16473,16430,16434,16482,16516,16538,/all'); } }