function addMarkers() { mySelect = document.getElementById('selection'); Wilmington = [];Carolina_Beach = [];Maumee = [];Wrightsville_Beach = [];mySelect.options[mySelect.options.length] = new Option("Carolina Beach schools",'all=Carolina_Beach'); mySelect.options[mySelect.options.length] = new Option("Maumee schools",'all=Maumee'); mySelect.options[mySelect.options.length] = new Option("Wilmington schools",'all=Wilmington'); mySelect.options[mySelect.options.length] = new Option("Wrightsville Beach schools",'all=Wrightsville_Beach'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.94049835,34.23229980),"
Alternative Pathways For Suc
1802 South 15th Street
Wilmington, NC 28401

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Alternative Pathways For Suc",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.92131042,34.23983383),"
Annie H Snipes Elementary School
2150 Chestnut Street
Wilmington, NC 28405

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Annie H Snipes Elementary School",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.84114075,34.19828796),"
Bradley Creek Elementary School
6211 Greenville Loop
Wilmington, NC 28409

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bradley Creek Elementary School",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.90381622,34.23089600),"
Cape Fear Center For Inquiry
3131 Randall Parkway Suite B
Wilmington, NC 28403

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cape Fear Center For Inquiry",'Wilmington=' + Wilmington.length); Carolina_Beach[Carolina_Beach.length] = createMarker(new GPoint(-77.89930725,34.03120804),"
Carolina Beach Elementary School
400 South 4th St
Carolina Beach, NC 28428

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Carolina Beach Elementary School",'Carolina_Beach=' + Carolina_Beach.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.90408325,34.10403824),"
Charles P Murray Middle School
655 Veterans Drive
Wilmington, NC 28412

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Charles P Murray Middle School",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.86466217,34.23605728),"
College Park Elementary School
5001 Oriole Dr
Wilmington, NC 28403

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("College Park Elementary School",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.94068909,34.24965286),"
D C Virgo Middle School
813 Nixon St
Wilmington, NC 28401

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("D C Virgo Middle School",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.93934631,34.24874878),"
Dorothy B Johnson Elementary School
1100 Mcrae St
Wilmington, NC 28401

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Dorothy B Johnson Elementary School",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.83444214,34.26513290),"
Dr Hubert Eaton Senior Elementary School
6701 Gordon Road
Wilmington, NC 28405

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Dr Hubert Eaton Senior Elementary School",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.91487122,34.16241837),"
Dr John Codington Elementary School
4321 Carolina Beach Road
Wilmington, NC 28412

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Dr John Codington Elementary School",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.90844727,34.20680618),"
Edwin A Alderman Elementary School
2025 Independence Blvd
Wilmington, NC 28403

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Edwin A Alderman Elementary School",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.87774658,34.30676651),"
Emma B Trask Middle School
2900 N College Rd
Wilmington, NC 28405

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Emma B Trask Middle School",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.87559509,34.30057526),"
Emsley A Laney High School
2700 N College Rd
Wilmington, NC 28405

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Emsley A Laney High School",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.90515137,34.10403824),"
Eugene Ashley High School
555 Veterans Drive
Wilmington, NC 28412

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Eugene Ashley High School",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.91296387,34.22998047),"
Forest Hills Elementary School
602 Colonial Dr
Wilmington, NC 28403

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Forest Hills Elementary School",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.93608856,34.23225403),"
Gregory Elementary School
319 S 10th St
Wilmington, NC 28401

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Gregory Elementary School",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.91139221,34.12428665),"
Heyward C Bellamy Elementary School
70 Sanders Rd
Wilmington, NC 28412

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Heyward C Bellamy Elementary School",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.88316345,34.19382095),"
Holly Tree Elementary School
3020 Web Trace
Wilmington, NC 28409

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Holly Tree Elementary School",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.84148407,34.25627518),"
John J Blair Elementary School
6510 Market St
Wilmington, NC 28405

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("John J Blair Elementary School",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.89158630,34.19919968),"
John T Hoggard High School
4305 Shipyard Blvd
Wilmington, NC 28403

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("John T Hoggard High School",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.93117523,34.21360397),"
Lakeside
1805 S 13th St
Wilmington, NC 28401

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lakeside",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.84139252,34.25631332),"
M C S Noble Middle School
6520 Market St
Wilmington, NC 28405

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("M C S Noble Middle School",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.91497803,34.13995361),"
Mary C Williams Elementary School
801 Silver Lake Rd
Wilmington, NC 28412

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mary C Williams Elementary School",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-10.00000000,10.00000000),"
Murrayville Elementary School
225 Mabee Way
Wilmington, NC 28411

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Murrayville Elementary School",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.88459778,34.13613129),"
Myrtle Grove Middle School
901 Piner Rd
Wilmington, NC 28409

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Myrtle Grove Middle School",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.93259430,34.23685837),"
New Hanover High School
1307 Market St
Wilmington, NC 28401

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Hanover High School",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.80784607,34.26597977),"
Ogden Elementary School
3637 Middle Sound Rd
Wilmington, NC 28411

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ogden Elementary School",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.90085602,34.17974472),"
Pine Valley Elementary School
440 John S Mosby Dr
Wilmington, NC 28412

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pine Valley Elementary School",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.91402435,34.24384689),"
Rachel Freeman Elementary School
2601 Princess Place Drive
Wilmington, NC 28405

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rachel Freeman Elementary School",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.89178467,34.20701981),"
Roland-grise Middle School
4412 Lake Ave
Wilmington, NC 28403

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Roland-grise Middle School",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.94158936,34.20731735),"
Sunset Park Elementary School
613 Alabama Ave
Wilmington, NC 28401

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sunset Park Elementary School",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.86186981,34.17784500),"
Walter L Parsley Elementary School
3518 Masonboro Loop Road
Wilmington, NC 28409

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Walter L Parsley Elementary School",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.86199951,34.25770187),"
William H Blount Elementary School
3702 Princess Pl Dr
Wilmington, NC 28405

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("William H Blount Elementary School",'Wilmington=' + Wilmington.length); Maumee[Maumee.length] = createMarker(new GPoint(-83.68671417,41.58881760),"
William H Blount Elementary School
1757 Indian Wood Cir
Maumee, NC 43537

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("William H Blount Elementary School",'Maumee=' + Maumee.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.93595886,34.23128510),"
Williston Middle School
401 S 10th St
Wilmington, NC 28401

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Williston Middle School",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.88192749,34.21234131),"
Winter Park Model Elementary School
204 S Macmillan Ave
Wilmington, NC 28403

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Winter Park Model Elementary School",'Wilmington=' + Wilmington.length); Wilmington[Wilmington.length] = createMarker(new GPoint(-77.92102814,34.29278183),"
Wrightsboro Elementary School
2716 Castle Hayne Rd
Wilmington, NC 28401

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wrightsboro Elementary School",'Wilmington=' + Wilmington.length); Wrightsville_Beach[Wrightsville_Beach.length] = createMarker(new GPoint(-77.79851532,34.21234894),"
Wrightsville Beach Elementary School
220 Coral Dr
Wrightsville Beach, NC 28480

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wrightsville Beach Elementary School",'Wrightsville_Beach=' + Wrightsville_Beach.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,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(Carolina_Beach); map.removeOverlays(Maumee); map.removeOverlays(Wilmington); map.removeOverlays(Wrightsville_Beach); 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(Carolina_Beach); map.removeOverlays(Maumee); map.removeOverlays(Wilmington); map.removeOverlays(Wrightsville_Beach); map.addOverlays(Carolina_Beach); centerByArray(Carolina_Beach, false, false); cntMarker += Carolina_Beach.length; map.addOverlays(Maumee); centerByArray(Maumee, false, false); cntMarker += Maumee.length; map.addOverlays(Wilmington); centerByArray(Wilmington, false, false); cntMarker += Wilmington.length; map.addOverlays(Wrightsville_Beach); centerByArray(Wrightsville_Beach, false, false); cntMarker += Wrightsville_Beach.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'); } }