function addMarkers() { mySelect = document.getElementById('selection'); Chesapeake = [];mySelect.options[mySelect.options.length] = new Option("Chesapeake schools",'all=Chesapeake'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.25019836,36.75943375),"
B. M. Williams Primary
1100 Battlefield Blvd N
Chesapeake, VA 23320

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("B. M. Williams Primary",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.17864227,36.71446228),"
Butts Road Int. Elementary School
1571 Mt Pleasant Rd
Chesapeake, VA 23322

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Butts Road Int. Elementary School",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.20222473,36.70923615),"
Butts Road Primary
1000 Mt Pleasant Rd
Chesapeake, VA 23322

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Butts Road Primary",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.34841156,36.77890778),"
Camelot Elementary School
2901 Guenevere Dr
Chesapeake, VA 23323

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Camelot Elementary School",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.29898834,36.72615051),"
Cedar Road Elementary School
1605 Cedar Rd
Chesapeake, VA 23322

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cedar Road Elementary School",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.34683990,36.69747925),"
Chesapeake Alternative
920 Minuteman Rd
Chesapeake, VA 23323

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Chesapeake Alternative",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.29936981,36.72630692),"
Chesapeake Ctr For Sc&tch
1617 Cedar Rd
Chesapeake, VA 23322

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Chesapeake Ctr For Sc&tch",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.27724457,36.76109695),"
Crestwood Intermediate
1240 Great Bridge Blvd
Chesapeake, VA 23320

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Crestwood Intermediate",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.28176880,36.76450729),"
Crestwood Middle School
1420 Great Bridge Blvd
Chesapeake, VA 23320

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Crestwood Middle School",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.33750916,36.73980713),"
Deep Creek Central Elementary School
2448 Shipyard Rd
Chesapeake, VA 23323

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Deep Creek Central Elementary School",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.34580231,36.75566483),"
Deep Creek Elementary School
2809 Forehand Dr
Chesapeake, VA 23323

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Deep Creek Elementary School",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.34546661,36.75513840),"
Deep Creek High School
2900 Margaret Booker Dr
Chesapeake, VA 23323

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Deep Creek High School",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.34554291,36.74223709),"
Deep Creek Int. Middle School
140 George Washington Hwy N
Chesapeake, VA 23323

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Deep Creek Int. Middle School",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.34276581,36.75578690),"
Deep Creek Middle School
1955 Deal Dr
Chesapeake, VA 23323

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Deep Creek Middle School",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.40866852,36.81183624),"
Edwin W. Chittum Elementary School
2008 Dock Landing Rd
Chesapeake, VA 23321

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Edwin W. Chittum Elementary School",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.33370972,36.78011322),"
G. A. Treakle Elementary School
2500 Gilmerton Rd
Chesapeake, VA 23323

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("G. A. Treakle Elementary School",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.25976562,36.79958344),"
George W. Carver Int. Elementary School
2601 Broad St
Chesapeake, VA 23324

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("George W. Carver Int. Elementary School",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.24575043,36.80074692),"
Georgetown Primary
436 Providence Rd
Chesapeake, VA 23325

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Georgetown Primary",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.41403961,36.81407928),"
Grassfield Elementary School
2248 Averill Dr.
Chesapeake, VA 23323

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Grassfield Elementary School",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.23854065,36.69052505),"
Great Bridge High School
301 West Hanbury Rd
Chesapeake, VA 23322

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Great Bridge High School",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.23712921,36.69006729),"
Great Bridge Int. Elementary School
253 West Hanbury Rd
Chesapeake, VA 23322

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Great Bridge Int. Elementary School",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.23690796,36.70945740),"
Great Bridge Middle School
441 Battlefield Blvd S
Chesapeake, VA 23322

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Great Bridge Middle School",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.25283813,36.71421051),"
Great Bridge Primary
408 Cedar Rd
Chesapeake, VA 23322

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Great Bridge Primary",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.22067261,36.78668976),"
Greenbrier Int. Elementary School
1701 River Birch Run N
Chesapeake, VA 23320

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Greenbrier Int. Elementary School",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.22471619,36.76058197),"
Greenbrier Middle School
1016 Greenbrier Pkwy
Chesapeake, VA 23320

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Greenbrier Middle School",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.22079468,36.76696396),"
Greenbrier Primary
1551 Eden Way South
Chesapeake, VA 23320

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Greenbrier Primary",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.20876312,36.63186264),"
Hickory Elementary School
109 Benefit Road
Chesapeake, VA 23322

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hickory Elementary School",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.21652222,36.65139771),"
Hickory High School
1996 Hawk Blvd
Chesapeake, VA 23322

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hickory High School",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.21684265,36.65151596),"
Hickory Middle School
1997 Hawk Blvd
Chesapeake, VA 23322

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Hickory Middle School",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.33926392,36.73884201),"
Hugo A. Owens Middle School
1997 Horseback Run
Chesapeake, VA 23323

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Hugo A. Owens Middle School",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.24243164,36.79801559),"
Indian River High School
1969 Braves Trl
Chesapeake, VA 23325

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Indian River High School",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.23482513,36.79899979),"
Indian River Middle School
2300 Old Greenbrier Rd
Chesapeake, VA 23325

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Indian River Middle School",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.41931915,36.78912735),"
Jolliff Middle School
1021 Jolliff Rd.
Chesapeake, VA 23321

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Jolliff Middle School",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.23389435,36.82197571),"
Norfolk Highlands Primary
1115 Myrtle Ave
Chesapeake, VA 23325

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Norfolk Highlands Primary",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.25634003,36.73934174),"
Oscar F. Smith High School
1994 Tiger Dr
Chesapeake, VA 23320

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oscar F. Smith High School",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.27126312,36.79885864),"
Oscar Smith Middle School
2500 Rodgers St
Chesapeake, VA 23324

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Oscar Smith Middle School",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.27153015,36.78871536),"
Portlock Primary
1857 Varsity Dr
Chesapeake, VA 23324

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Portlock Primary",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.27940369,36.81168747),"
Rena B. Wright Primary
600 Park Ave
Chesapeake, VA 23324

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rena B. Wright Primary",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.22363281,36.65724564),"
Southeastern Elementary School
1853 Battlefield Blvd S
Chesapeake, VA 23322

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Southeastern Elementary School",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.22786400,36.79205500),"
Southeastern Va Tr Ctr Ep
2100 Steppingstone Square
Chesapeake, VA 23320

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Southeastern Va Tr Ctr Ep",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.40538025,36.79098892),"
Southwestern Elementary School
4410 Airline Blvd
Chesapeake, VA 23321

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Southwestern Elementary School",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.22561646,36.81158829),"
Sparrow Road Intermediate
1605 Sparrow Rd
Chesapeake, VA 23325

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Sparrow Road Intermediate",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.25388336,36.81670761),"
Thurgood Marshall Elementary School
2706 Border Road
Chesapeake, VA 23324

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Thurgood Marshall Elementary School",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.25372500,36.71774400),"
Tidewater Juvenile Detention Home
420 Albemarle Dr.
Chesapeake, VA 23322

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tidewater Juvenile Detention Home",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.27459717,36.81079483),"
Truitt Intermediate
1100 Holly Ave
Chesapeake, VA 23324

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Truitt Intermediate",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.40806580,36.84800720),"
Western Branch High School
1968 Bruin Pl
Chesapeake, VA 23321

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Western Branch High School",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.40000916,36.84490967),"
Western Branch Int. Elementary School
4013 Terry Dr
Chesapeake, VA 23321

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Western Branch Int. Elementary School",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.40293121,36.85250473),"
Western Branch Middle School
4201 Hawksley Dr
Chesapeake, VA 23321

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Western Branch Middle School",'Chesapeake=' + Chesapeake.length); Chesapeake[Chesapeake.length] = createMarker(new GPoint(-76.40219116,36.84546280),"
Western Branch Primary
4122 Terry Dr
Chesapeake, VA 23321

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Western Branch Primary",'Chesapeake=' + Chesapeake.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(Chesapeake); 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(Chesapeake);map.removeOverlays(Chesapeake); map.addOverlays(Chesapeake); centerByArray(Chesapeake, false, false); cntMarker += Chesapeake.length; centerByArray(Chesapeake,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'); } }