function addMarkers() { mySelect = document.getElementById('selection'); Wilmington = [];New_Castle = [];Newark = [];Woodside = [];Middletown = [];Georgetown = [];mySelect.options[mySelect.options.length] = new Option("Georgetown vocational schools",'all=Georgetown'); mySelect.options[mySelect.options.length] = new Option("Middletown vocational schools",'all=Middletown'); mySelect.options[mySelect.options.length] = new Option("New Castle vocational schools",'all=New_Castle'); mySelect.options[mySelect.options.length] = new Option("Newark vocational schools",'all=Newark'); mySelect.options[mySelect.options.length] = new Option("Wilmington vocational schools",'all=Wilmington'); mySelect.options[mySelect.options.length] = new Option("Woodside vocational schools",'all=Woodside'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Wilmington[Wilmington.length] = createMarker(new GPoint(-75.62869263,39.72446823),"
Delcastle Technical High School
1417 Newport Road
Wilmington, DE 19804

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Delcastle Technical High School",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-75.54257202,39.74569702),"
Howard High School Of Technology
401 East 12th Street
Wilmington, DE 19801

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Howard High School Of Technology",'Wilmington=' + Wilmington.length); New_Castle[New_Castle.length] = createMarker(new GPoint(-75.63857800,39.66287600),"
Northeast Treatment Center
287 Christiana Road, Suite 8
New Castle, DE 19720

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Northeast Treatment Center",'New_Castle=' + New_Castle.length); Newark[Newark.length] = createMarker(new GPoint(-75.69835663,39.62742996),"
Paul M. Hodgson Vocational Technical High School
2575 Glasgow Avenue
Newark, DE 19702

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Paul M. Hodgson Vocational Technical High School",'Newark=' + Newark.length); Woodside[Woodside.length] = createMarker(new GPoint(-75.56860352,39.07130051),"
Polytech High School
Po Box 97
Woodside, DE 19980

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Polytech High School",'Woodside=' + Woodside.length); Middletown[Middletown.length] = createMarker(new GPoint(-75.69687900,39.45073600),"
Silver Lake Treatment Center
493 East Main Street
Middletown, DE 19709

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Silver Lake Treatment Center",'Middletown=' + Middletown.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); maxLng = -75.47232056; maxLat = 39.74569702; minLng = -75.69835663; minLat = 38.62702179; reCenterMap(); map.removeOverlays(Georgetown); map.removeOverlays(Middletown); map.removeOverlays(New_Castle); map.removeOverlays(Newark); map.removeOverlays(Wilmington); map.removeOverlays(Woodside); setTimeout(function(){map.addOverlays(Georgetown)},1000); setTimeout(function(){map.addOverlays(Middletown)},1000); setTimeout(function(){map.addOverlays(New_Castle)},1000); setTimeout(function(){map.addOverlays(Newark)},1000); setTimeout(function(){map.addOverlays(Wilmington)},1000); setTimeout(function(){map.addOverlays(Woodside)},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(Georgetown); map.removeOverlays(Middletown); map.removeOverlays(New_Castle); map.removeOverlays(Newark); map.removeOverlays(Wilmington); map.removeOverlays(Woodside); 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(Wilmington);map.removeOverlays(Georgetown); map.removeOverlays(Middletown); map.removeOverlays(New_Castle); map.removeOverlays(Newark); map.removeOverlays(Wilmington); map.removeOverlays(Woodside); map.addOverlays(Georgetown); centerByArray(Georgetown, false, false); cntMarker += Georgetown.length; map.addOverlays(Middletown); centerByArray(Middletown, false, false); cntMarker += Middletown.length; map.addOverlays(New_Castle); centerByArray(New_Castle, false, false); cntMarker += New_Castle.length; map.addOverlays(Newark); centerByArray(Newark, false, false); cntMarker += Newark.length; map.addOverlays(Wilmington); centerByArray(Wilmington, false, false); cntMarker += Wilmington.length; map.addOverlays(Woodside); centerByArray(Woodside, false, false); cntMarker += Woodside.length; centerByArray(Wilmington,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'); } }