function addMarkers() { mySelect = document.getElementById('selection'); Benson = [];Clayton = [];Garner = [];Zebulon = [];Four_Oaks = [];Kenly = [];Smithfield = [];Angier = [];Pine_Level = [];Micro = [];Princeton = [];Selma = [];Wilsons_Mills = [];mySelect.options[mySelect.options.length] = new Option("Angier schools",'all=Angier'); mySelect.options[mySelect.options.length] = new Option("Benson schools",'all=Benson'); mySelect.options[mySelect.options.length] = new Option("Clayton schools",'all=Clayton'); mySelect.options[mySelect.options.length] = new Option("Four Oaks schools",'all=Four_Oaks'); mySelect.options[mySelect.options.length] = new Option("Garner schools",'all=Garner'); mySelect.options[mySelect.options.length] = new Option("Kenly schools",'all=Kenly'); mySelect.options[mySelect.options.length] = new Option("Micro schools",'all=Micro'); mySelect.options[mySelect.options.length] = new Option("Pine Level schools",'all=Pine_Level'); mySelect.options[mySelect.options.length] = new Option("Princeton schools",'all=Princeton'); mySelect.options[mySelect.options.length] = new Option("Selma schools",'all=Selma'); mySelect.options[mySelect.options.length] = new Option("Smithfield schools",'all=Smithfield'); mySelect.options[mySelect.options.length] = new Option("Wilsons Mills schools",'all=Wilsons_Mills'); mySelect.options[mySelect.options.length] = new Option("Zebulon schools",'all=Zebulon'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Benson[Benson.length] = createMarker(new GPoint(-78.55718994,35.40326691),"
Benson Elementary School
2040 Hwy 50 N
Benson, NC 27504

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Benson Elementary School",'Benson=' + Benson.length); Benson[Benson.length] = createMarker(new GPoint(-78.54786682,35.37750244),"
Benson Middle School
1600 N Wall Street
Benson, NC 27504

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Benson Middle School",'Benson=' + Benson.length); Clayton[Clayton.length] = createMarker(new GPoint(-78.46468353,35.64956665),"
Clayton High School
600 S Fayetteville St
Clayton, NC 27520

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Clayton High School",'Clayton=' + Clayton.length); Clayton[Clayton.length] = createMarker(new GPoint(-78.48583221,35.64376068),"
Clayton Middle School
490 Guy Rd
Clayton, NC 27520

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Clayton Middle School",'Clayton=' + Clayton.length); Clayton[Clayton.length] = createMarker(new GPoint(-78.53711700,35.57504272),"
Cleveland Elementary School
10225 Cleveland Rd
Clayton, NC 27520

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cleveland Elementary School",'Clayton=' + Clayton.length); Garner[Garner.length] = createMarker(new GPoint(-78.54724884,35.57546616),"
Cleveland Middle School
2323 Cornwallis Road
Garner, NC 27529

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Cleveland Middle School",'Garner=' + Garner.length); Clayton[Clayton.length] = createMarker(new GPoint(-78.45153809,35.65639877),"
Cooper Elementary School
849 North Mial St
Clayton, NC 27520

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cooper Elementary School",'Clayton=' + Clayton.length); Zebulon[Zebulon.length] = createMarker(new GPoint(-78.31462860,35.82429886),"
Corinth Holders Elementary School
3976 Nc 231
Zebulon, NC 27597

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Corinth Holders Elementary School",'Zebulon=' + Zebulon.length); Clayton[Clayton.length] = createMarker(new GPoint(-78.40378571,35.64755249),"
East Clayton Elementary School
2075 Nc Highway 42 East
Clayton, NC 27527

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("East Clayton Elementary School",'Clayton=' + Clayton.length); Four_Oaks[Four_Oaks.length] = createMarker(new GPoint(-78.43324280,35.44944000),"
Four Oaks Elementary School
180 Hatcher St
Four Oaks, NC 27524

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Four Oaks Elementary School",'Four_Oaks=' + Four_Oaks.length); Four_Oaks[Four_Oaks.length] = createMarker(new GPoint(-78.40360260,35.44887543),"
Four Oaks Middle School
1475 Boyette Road
Four Oaks, NC 27524

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Four Oaks Middle School",'Four_Oaks=' + Four_Oaks.length); Kenly[Kenly.length] = createMarker(new GPoint(-78.13619995,35.61090088),"
Glendale-kenly Elementary School
Po Box 279
Kenly, NC 27542

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Glendale-kenly Elementary School",'Kenly=' + Kenly.length); Smithfield[Smithfield.length] = createMarker(new GPoint(-78.33697500,35.50105600),"
Johnston Co Middle College
245 College Rd
Smithfield, NC 27577

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Johnston Co Middle College",'Smithfield=' + Smithfield.length); Angier[Angier.length] = createMarker(new GPoint(-83.52335400,40.53353700),"
Mcgee's Crossroads Elementary School
110330 Hwy 50 North
Angier, NC 27501

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mcgee's Crossroads Elementary School",'Angier=' + Angier.length); Benson[Benson.length] = createMarker(new GPoint(-83.51528100,40.80074600),"
Mcgee's Crossroads Middle School
313353 Nc Highway 210
Benson, NC 27504

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Mcgee's Crossroads Middle School",'Benson=' + Benson.length); Benson[Benson.length] = createMarker(new GPoint(-78.54894257,35.38199997),"
Meadow Elementary School
7507 Nc Hwy 50 S
Benson, NC 27504

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Meadow Elementary School",'Benson=' + Benson.length); Pine_Level[Pine_Level.length] = createMarker(new GPoint(-78.24469757,35.51300049),"
Micro-pine Level Elementary School
Po Box 69
Pine Level, NC 27568

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Micro-pine Level Elementary School",'Pine_Level=' + Pine_Level.length); Kenly[Kenly.length] = createMarker(new GPoint(-78.13619995,35.61090088),"
North Johnston High School
Po Box 339
Kenly, NC 27542

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("North Johnston High School",'Kenly=' + Kenly.length); Micro[Micro.length] = createMarker(new GPoint(-78.20469666,35.56359863),"
North Johnston Middle School
Po Box 69
Micro, NC 27555

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("North Johnston Middle School",'Micro=' + Micro.length); Garner[Garner.length] = createMarker(new GPoint(-78.51256561,35.57516098),"
Polenta Elementary School
105 Josephine Road
Garner, NC 27529

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Polenta Elementary School",'Garner=' + Garner.length); Princeton[Princeton.length] = createMarker(new GPoint(-78.17009735,35.46250153),"
Princeton High School
Po Box 38
Princeton, NC 27569

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Princeton High School",'Princeton=' + Princeton.length); Clayton[Clayton.length] = createMarker(new GPoint(-78.47160339,35.62459946),"
River Dell Elementary School
12100 Buffalo Road
Clayton, NC 27527

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("River Dell Elementary School",'Clayton=' + Clayton.length); Clayton[Clayton.length] = createMarker(new GPoint(-78.45639801,35.65069962),"
Riverwood Elementary School
108 Athletic Club Blvd
Clayton, NC 27527

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Riverwood Elementary School",'Clayton=' + Clayton.length); Clayton[Clayton.length] = createMarker(new GPoint(-78.42337036,35.69352722),"
Riverwood Middle School
204 Athletic Club Blvd
Clayton, NC 27527

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Riverwood Middle School",'Clayton=' + Clayton.length); Selma[Selma.length] = createMarker(new GPoint(-78.28325653,35.54059219),"
Selma Elementary School
311 W Richardson St
Selma, NC 27576

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Selma Elementary School",'Selma=' + Selma.length); Selma[Selma.length] = createMarker(new GPoint(-78.28443909,35.53631973),"
Selma Middle School
1533 Hwy 301 N
Selma, NC 27576

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Selma Middle School",'Selma=' + Selma.length); Smithfield[Smithfield.length] = createMarker(new GPoint(-78.34950256,35.50939941),"
Smithfield Middle School
Po Box 2270
Smithfield, NC 27577

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Smithfield Middle School",'Smithfield=' + Smithfield.length); Smithfield[Smithfield.length] = createMarker(new GPoint(-78.34950256,35.50939941),"
Smithfield-selma High School
Po Box 1497
Smithfield, NC 27577

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Smithfield-selma High School",'Smithfield=' + Smithfield.length); Smithfield[Smithfield.length] = createMarker(new GPoint(-78.34950256,35.50939941),"
South Campus Community
Po Box 1336
Smithfield, NC 27577

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("South Campus Community",'Smithfield=' + Smithfield.length); Smithfield[Smithfield.length] = createMarker(new GPoint(-78.34671400,35.51151500),"
South Campus Community Middle School
Po Box 1336
Smithfield, NC 27577

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("South Campus Community Middle School",'Smithfield=' + Smithfield.length); Four_Oaks[Four_Oaks.length] = createMarker(new GPoint(-78.42790985,35.44449997),"
South Johnston High School
10381 Us Hwy 301 S
Four Oaks, NC 27524

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("South Johnston High School",'Four_Oaks=' + Four_Oaks.length); Smithfield[Smithfield.length] = createMarker(new GPoint(-78.35731506,35.49990082),"
South Smithfield Elementary School
201 W Sanders St
Smithfield, NC 27577

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("South Smithfield Elementary School",'Smithfield=' + Smithfield.length); Clayton[Clayton.length] = createMarker(new GPoint(-78.46295929,35.64525986),"
West Clayton Elementary School
1012 S Lombard St
Clayton, NC 27520

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West Clayton Elementary School",'Clayton=' + Clayton.length); Benson[Benson.length] = createMarker(new GPoint(-78.54220581,35.52420807),"
West Johnston High School
5935 Raleigh Road
Benson, NC 27504

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("West Johnston High School",'Benson=' + Benson.length); Smithfield[Smithfield.length] = createMarker(new GPoint(-78.34941864,35.50502014),"
West Smithfield Elementary School
2665 Galilee Road
Smithfield, NC 27577

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West Smithfield Elementary School",'Smithfield=' + Smithfield.length); Wilsons_Mills[Wilsons_Mills.length] = createMarker(new GPoint(-83.79156200,41.10525400),"
Wilson's Mills Elementary School
8po Box 176
Wilson's Mills, NC 27593

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wilson's Mills Elementary School",'Wilsons_Mills=' + Wilsons_Mills.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(Angier); map.removeOverlays(Benson); map.removeOverlays(Clayton); map.removeOverlays(Four_Oaks); map.removeOverlays(Garner); map.removeOverlays(Kenly); map.removeOverlays(Micro); map.removeOverlays(Pine_Level); map.removeOverlays(Princeton); map.removeOverlays(Selma); map.removeOverlays(Smithfield); map.removeOverlays(Wilsons_Mills); map.removeOverlays(Zebulon); 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(Benson);map.removeOverlays(Angier); map.removeOverlays(Benson); map.removeOverlays(Clayton); map.removeOverlays(Four_Oaks); map.removeOverlays(Garner); map.removeOverlays(Kenly); map.removeOverlays(Micro); map.removeOverlays(Pine_Level); map.removeOverlays(Princeton); map.removeOverlays(Selma); map.removeOverlays(Smithfield); map.removeOverlays(Wilsons_Mills); map.removeOverlays(Zebulon); map.addOverlays(Angier); centerByArray(Angier, false, false); cntMarker += Angier.length; map.addOverlays(Benson); centerByArray(Benson, false, false); cntMarker += Benson.length; map.addOverlays(Clayton); centerByArray(Clayton, false, false); cntMarker += Clayton.length; map.addOverlays(Four_Oaks); centerByArray(Four_Oaks, false, false); cntMarker += Four_Oaks.length; map.addOverlays(Garner); centerByArray(Garner, false, false); cntMarker += Garner.length; map.addOverlays(Kenly); centerByArray(Kenly, false, false); cntMarker += Kenly.length; map.addOverlays(Micro); centerByArray(Micro, false, false); cntMarker += Micro.length; map.addOverlays(Pine_Level); centerByArray(Pine_Level, false, false); cntMarker += Pine_Level.length; map.addOverlays(Princeton); centerByArray(Princeton, false, false); cntMarker += Princeton.length; map.addOverlays(Selma); centerByArray(Selma, false, false); cntMarker += Selma.length; map.addOverlays(Smithfield); centerByArray(Smithfield, false, false); cntMarker += Smithfield.length; map.addOverlays(Wilsons_Mills); centerByArray(Wilsons_Mills, false, false); cntMarker += Wilsons_Mills.length; map.addOverlays(Zebulon); centerByArray(Zebulon, false, false); cntMarker += Zebulon.length; centerByArray(Benson,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'); } }