function addMarkers() { mySelect = document.getElementById('selection'); Riegelwood = [];Delco = [];Lake_Waccamaw = [];Whiteville = [];Cerro_Gordo = [];Chadbourn = [];Evergreen = [];Fair_Bluff = [];Tabor_City = [];Hallsboro = [];Nakina = [];mySelect.options[mySelect.options.length] = new Option("Cerro Gordo schools",'all=Cerro_Gordo'); mySelect.options[mySelect.options.length] = new Option("Chadbourn schools",'all=Chadbourn'); mySelect.options[mySelect.options.length] = new Option("Delco schools",'all=Delco'); mySelect.options[mySelect.options.length] = new Option("Evergreen schools",'all=Evergreen'); mySelect.options[mySelect.options.length] = new Option("Fair Bluff schools",'all=Fair_Bluff'); mySelect.options[mySelect.options.length] = new Option("Hallsboro schools",'all=Hallsboro'); mySelect.options[mySelect.options.length] = new Option("Lake Waccamaw schools",'all=Lake_Waccamaw'); mySelect.options[mySelect.options.length] = new Option("Nakina schools",'all=Nakina'); mySelect.options[mySelect.options.length] = new Option("Riegelwood schools",'all=Riegelwood'); mySelect.options[mySelect.options.length] = new Option("Tabor City schools",'all=Tabor_City'); mySelect.options[mySelect.options.length] = new Option("Whiteville schools",'all=Whiteville'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Riegelwood[Riegelwood.length] = createMarker(new GPoint(-78.25849915,34.35530090),"
Acme Delco Elementary School
Po Box 704
Riegelwood, NC 28456

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Acme Delco Elementary School",'Riegelwood=' + Riegelwood.length); Delco[Delco.length] = createMarker(new GPoint(-78.23799896,34.29970169),"
Acme Delco Middle School
Po Box 40
Delco, NC 28436

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Acme Delco Middle School",'Delco=' + Delco.length); Lake_Waccamaw[Lake_Waccamaw.length] = createMarker(new GPoint(-78.50980377,34.33539963),"
Boys And Girls Home
Po Box 250
Lake Waccamaw, NC 28450

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Boys And Girls Home",'Lake_Waccamaw=' + Lake_Waccamaw.length); Whiteville[Whiteville.length] = createMarker(new GPoint(-78.70946503,34.32709885),"
Central Middle School
310 S Martin L King Jr Ave
Whiteville, NC 28472

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Central Middle School",'Whiteville=' + Whiteville.length); Cerro_Gordo[Cerro_Gordo.length] = createMarker(new GPoint(-78.92420197,34.30360031),"
Cerro Gordo Elementary School
Po Box 9
Cerro Gordo, NC 28430

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cerro Gordo Elementary School",'Cerro_Gordo=' + Cerro_Gordo.length); Chadbourn[Chadbourn.length] = createMarker(new GPoint(-78.82540131,34.32500076),"
Chadbourn Elementary School
Po Box 387
Chadbourn, NC 28431

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Chadbourn Elementary School",'Chadbourn=' + Chadbourn.length); Chadbourn[Chadbourn.length] = createMarker(new GPoint(-78.83943176,34.31626129),"
Chadbourn Middle School
801 W Smith Street
Chadbourn, NC 28431

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Chadbourn Middle School",'Chadbourn=' + Chadbourn.length); Lake_Waccamaw[Lake_Waccamaw.length] = createMarker(new GPoint(-78.50980377,34.33539963),"
East Columbus High School
Po Box 401
Lake Waccamaw, NC 28450

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("East Columbus High School",'Lake_Waccamaw=' + Lake_Waccamaw.length); Whiteville[Whiteville.length] = createMarker(new GPoint(-78.69527435,34.33102798),"
Edgewood Elementary School
317 E Calhoun Street
Whiteville, NC 28472

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Edgewood Elementary School",'Whiteville=' + Whiteville.length); Evergreen[Evergreen.length] = createMarker(new GPoint(-78.89788055,34.40770721),"
Evergreen Elementary School
7211 Old 74 Hwy
Evergreen, NC 28438

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Evergreen Elementary School",'Evergreen=' + Evergreen.length); Fair_Bluff[Fair_Bluff.length] = createMarker(new GPoint(-79.00969696,34.29449844),"
Fair Bluff Elementary School
Po Box 277
Fair Bluff, NC 28439

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fair Bluff Elementary School",'Fair_Bluff=' + Fair_Bluff.length); Tabor_City[Tabor_City.length] = createMarker(new GPoint(-78.70085907,34.06719589),"
Guideway Elementary School
11570 Swamp Fox Hwy
Tabor City, NC 28463

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Guideway Elementary School",'Tabor_City=' + Tabor_City.length); Hallsboro[Hallsboro.length] = createMarker(new GPoint(-78.59924100,34.32224500),"
Hallsboro Middle School
Po Box 248
Hallsboro, NC 28442

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Hallsboro Middle School",'Hallsboro=' + Hallsboro.length); Hallsboro[Hallsboro.length] = createMarker(new GPoint(-78.60079956,34.31019974),"
Hallsboro-artesia Elementary School
Po Box 249
Hallsboro, NC 28442

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hallsboro-artesia Elementary School",'Hallsboro=' + Hallsboro.length); Nakina[Nakina.length] = createMarker(new GPoint(-78.65334320,34.10702515),"
Nakina Alternative
9822 Seven Creeks Hwy
Nakina, NC 28472

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Nakina Alternative",'Nakina=' + Nakina.length); Whiteville[Whiteville.length] = createMarker(new GPoint(-78.71504974,34.36975479),"
North Whiteville Academy
2322 James B White Hwy North
Whiteville, NC 28472

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("North Whiteville Academy",'Whiteville=' + Whiteville.length); Whiteville[Whiteville.length] = createMarker(new GPoint(-78.59629059,34.16330338),"
Old Dock Elementary School
12489 New Britton Hwy
Whiteville, NC 28472

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Old Dock Elementary School",'Whiteville=' + Whiteville.length); Tabor_City[Tabor_City.length] = createMarker(new GPoint(-78.79219818,34.16239929),"
South Columbus High School
40 Stallion Drive
Tabor City, NC 28463

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("South Columbus High School",'Tabor_City=' + Tabor_City.length); Tabor_City[Tabor_City.length] = createMarker(new GPoint(-78.87301636,34.15185547),"
Tabor City Elementary School
203 Stake Road
Tabor City, NC 28463

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Tabor City Elementary School",'Tabor_City=' + Tabor_City.length); Tabor_City[Tabor_City.length] = createMarker(new GPoint(-78.88995361,34.14833069),"
Tabor City Middle School
701 W Sixth Street
Tabor City, NC 28463

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Tabor City Middle School",'Tabor_City=' + Tabor_City.length); Cerro_Gordo[Cerro_Gordo.length] = createMarker(new GPoint(-78.92420197,34.30360031),"
West Columbus High School
Po Box 130
Cerro Gordo, NC 28430

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("West Columbus High School",'Cerro_Gordo=' + Cerro_Gordo.length); Whiteville[Whiteville.length] = createMarker(new GPoint(-78.70608521,34.33276367),"
Whiteville High School
413 N Lee Street
Whiteville, NC 28472

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Whiteville High School",'Whiteville=' + Whiteville.length); Whiteville[Whiteville.length] = createMarker(new GPoint(-78.71208191,34.33884430),"
Whiteville Primary
805 Barbcrest Avenue
Whiteville, NC 28472

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Whiteville Primary",'Whiteville=' + Whiteville.length); Whiteville[Whiteville.length] = createMarker(new GPoint(-78.76302338,34.20434570),"
Williams Township Elementary School
10400 James B White Hwy
Whiteville, NC 28472

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Williams Township Elementary School",'Whiteville=' + Whiteville.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(Cerro_Gordo); map.removeOverlays(Chadbourn); map.removeOverlays(Delco); map.removeOverlays(Evergreen); map.removeOverlays(Fair_Bluff); map.removeOverlays(Hallsboro); map.removeOverlays(Lake_Waccamaw); map.removeOverlays(Nakina); map.removeOverlays(Riegelwood); map.removeOverlays(Tabor_City); map.removeOverlays(Whiteville); 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(Riegelwood);map.removeOverlays(Cerro_Gordo); map.removeOverlays(Chadbourn); map.removeOverlays(Delco); map.removeOverlays(Evergreen); map.removeOverlays(Fair_Bluff); map.removeOverlays(Hallsboro); map.removeOverlays(Lake_Waccamaw); map.removeOverlays(Nakina); map.removeOverlays(Riegelwood); map.removeOverlays(Tabor_City); map.removeOverlays(Whiteville); map.addOverlays(Cerro_Gordo); centerByArray(Cerro_Gordo, false, false); cntMarker += Cerro_Gordo.length; map.addOverlays(Chadbourn); centerByArray(Chadbourn, false, false); cntMarker += Chadbourn.length; map.addOverlays(Delco); centerByArray(Delco, false, false); cntMarker += Delco.length; map.addOverlays(Evergreen); centerByArray(Evergreen, false, false); cntMarker += Evergreen.length; map.addOverlays(Fair_Bluff); centerByArray(Fair_Bluff, false, false); cntMarker += Fair_Bluff.length; map.addOverlays(Hallsboro); centerByArray(Hallsboro, false, false); cntMarker += Hallsboro.length; map.addOverlays(Lake_Waccamaw); centerByArray(Lake_Waccamaw, false, false); cntMarker += Lake_Waccamaw.length; map.addOverlays(Nakina); centerByArray(Nakina, false, false); cntMarker += Nakina.length; map.addOverlays(Riegelwood); centerByArray(Riegelwood, false, false); cntMarker += Riegelwood.length; map.addOverlays(Tabor_City); centerByArray(Tabor_City, false, false); cntMarker += Tabor_City.length; map.addOverlays(Whiteville); centerByArray(Whiteville, false, false); cntMarker += Whiteville.length; centerByArray(Riegelwood,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'); } }