function addMarkers() { mySelect = document.getElementById('selection'); Dover = [];Wilmington = [];Laurel = [];Middletown = [];Newark = [];Camden = [];Clayton = [];Georgetown = [];mySelect.options[mySelect.options.length] = new Option("Camden charter schools",'all=Camden'); mySelect.options[mySelect.options.length] = new Option("Clayton charter schools",'all=Clayton'); mySelect.options[mySelect.options.length] = new Option("Dover charter schools",'all=Dover'); mySelect.options[mySelect.options.length] = new Option("Georgetown charter schools",'all=Georgetown'); mySelect.options[mySelect.options.length] = new Option("Laurel charter schools",'all=Laurel'); mySelect.options[mySelect.options.length] = new Option("Middletown charter schools",'all=Middletown'); mySelect.options[mySelect.options.length] = new Option("Newark charter schools",'all=Newark'); mySelect.options[mySelect.options.length] = new Option("Wilmington charter schools",'all=Wilmington'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Dover[Dover.length] = createMarker(new GPoint(-75.52375793,39.16345978),"
Academy Of Dover Charter School
104 Saulsbury Road
Dover, DE 19904

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Academy Of Dover Charter School",'Dover=' + Dover.length); Dover[Dover.length] = createMarker(new GPoint(-75.52714539,39.16166306),"
Campus Community School
21 North Bradford Street
Dover, DE 19904

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Campus Community School",'Dover=' + Dover.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-75.58846283,39.75246048),"
Charter School Of Wilmington
100 North Dupont Road
Wilmington, DE 19807

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Charter School Of Wilmington",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-75.54139709,39.78760147),"
Delaware Military Academy
112 Middleboro Road
Wilmington, DE 19804

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Delaware Military Academy",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-75.53036499,39.74902344),"
East Side Charter School
3000 North Claymont Street
Wilmington, DE 19802

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("East Side Charter School",'Wilmington=' + Wilmington.length); Laurel[Laurel.length] = createMarker(new GPoint(-75.55490112,38.54980087),"
Georgetown Charter School
12108 County Seat Highway
Laurel, DE 19956

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Georgetown Charter School",'Laurel=' + Laurel.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-75.55061340,39.74126434),"
Kuumba Academy Charter School
519 North Market Street
Wilmington, DE 19801

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Kuumba Academy Charter School",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-75.53595734,39.74212646),"
Marion T. Academy Charter School
1121 Thatcher Street
Wilmington, DE 19802

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Marion T. Academy Charter School",'Wilmington=' + Wilmington.length); Middletown[Middletown.length] = createMarker(new GPoint(-75.74215698,39.42041397),"
Mot Charter School
1156 Levels Road
Middletown, DE 19709

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mot Charter School",'Middletown=' + Middletown.length); Newark[Newark.length] = createMarker(new GPoint(-75.76814270,39.67904282),"
Newark Charter School
2001 Patriot Way
Newark, DE 19711

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Newark Charter School",'Newark=' + Newark.length); Camden[Camden.length] = createMarker(new GPoint(-75.54084778,39.10550690),"
Positive Outcomes Charter School
193 South Dupont Highway
Camden, DE 19934

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Positive Outcomes Charter School",'Camden=' + Camden.length); Clayton[Clayton.length] = createMarker(new GPoint(-75.63119507,39.29906464),"
Providence Creek Academy Charter School
355 West Duck Creek Road
Clayton, DE 19938

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Providence Creek Academy Charter School",'Clayton=' + Clayton.length); Georgetown[Georgetown.length] = createMarker(new GPoint(-75.36441803,38.66811752),"
Sussex Academy Of Arts And Sciences
21777 Sussex Pines Road
Georgetown, DE 19947

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Sussex Academy Of Arts And Sciences",'Georgetown=' + Georgetown.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-75.53309631,39.74837494),"
Thomas A. Edison Charter School Of Wilmington
2200 North Locust Street
Wilmington, DE 19802

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Thomas A. Edison Charter School Of Wilmington",'Wilmington=' + Wilmington.length); maxLng = -75.36441803; maxLat = 39.78760147; minLng = -75.76814270; minLat = 38.54980087; reCenterMap(); map.removeOverlays(Camden); map.removeOverlays(Clayton); map.removeOverlays(Dover); map.removeOverlays(Georgetown); map.removeOverlays(Laurel); map.removeOverlays(Middletown); map.removeOverlays(Newark); map.removeOverlays(Wilmington); setTimeout(function(){map.addOverlays(Camden)},1000); setTimeout(function(){map.addOverlays(Clayton)},1000); setTimeout(function(){map.addOverlays(Dover)},1000); setTimeout(function(){map.addOverlays(Georgetown)},1000); setTimeout(function(){map.addOverlays(Laurel)},1000); setTimeout(function(){map.addOverlays(Middletown)},1000); setTimeout(function(){map.addOverlays(Newark)},1000); setTimeout(function(){map.addOverlays(Wilmington)},1000); } // 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(Camden); map.removeOverlays(Clayton); map.removeOverlays(Dover); map.removeOverlays(Georgetown); map.removeOverlays(Laurel); map.removeOverlays(Middletown); map.removeOverlays(Newark); 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(Camden); map.removeOverlays(Clayton); map.removeOverlays(Dover); map.removeOverlays(Georgetown); map.removeOverlays(Laurel); map.removeOverlays(Middletown); map.removeOverlays(Newark); map.removeOverlays(Wilmington); map.addOverlays(Camden); centerByArray(Camden, false, false); cntMarker += Camden.length; map.addOverlays(Clayton); centerByArray(Clayton, false, false); cntMarker += Clayton.length; map.addOverlays(Dover); centerByArray(Dover, false, false); cntMarker += Dover.length; map.addOverlays(Georgetown); centerByArray(Georgetown, false, false); cntMarker += Georgetown.length; map.addOverlays(Laurel); centerByArray(Laurel, false, false); cntMarker += Laurel.length; map.addOverlays(Middletown); centerByArray(Middletown, false, false); cntMarker += Middletown.length; map.addOverlays(Newark); centerByArray(Newark, false, false); cntMarker += Newark.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////all'); } }