function addMarkers() { mySelect = document.getElementById('selection'); Newton = [];Catawba = [];Vale = [];Claremont = [];Hickory = [];Maiden = [];Conover = [];Sherrills_Ford = [];mySelect.options[mySelect.options.length] = new Option("Catawba schools",'all=Catawba'); mySelect.options[mySelect.options.length] = new Option("Claremont schools",'all=Claremont'); mySelect.options[mySelect.options.length] = new Option("Conover schools",'all=Conover'); mySelect.options[mySelect.options.length] = new Option("Hickory schools",'all=Hickory'); mySelect.options[mySelect.options.length] = new Option("Maiden schools",'all=Maiden'); mySelect.options[mySelect.options.length] = new Option("Newton schools",'all=Newton'); mySelect.options[mySelect.options.length] = new Option("Sherrills Ford schools",'all=Sherrills_Ford'); mySelect.options[mySelect.options.length] = new Option("Vale schools",'all=Vale'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Newton[Newton.length] = createMarker(new GPoint(-81.12824249,35.63122177),"
Balls Creek Elementary School
2620 Balls Creek Road
Newton, NC 28658

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Balls Creek Elementary School",'Newton=' + Newton.length); Catawba[Catawba.length] = createMarker(new GPoint(-81.05960083,35.68610001),"
Bandys High School
5040 E Bandys Road
Catawba, NC 28609

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bandys High School",'Catawba=' + Catawba.length); Vale[Vale.length] = createMarker(new GPoint(-81.42120361,35.55039978),"
Banoak Elementary School
7651 W Nc 10 Hwy
Vale, NC 28168

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Banoak Elementary School",'Vale=' + Vale.length); Newton[Newton.length] = createMarker(new GPoint(-81.23439789,35.65039825),"
Blackburn Elementary School
4377 W Nc 10 Hwy
Newton, NC 28658

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Blackburn Elementary School",'Newton=' + Newton.length); Claremont[Claremont.length] = createMarker(new GPoint(-81.11064148,35.74196625),"
Bunker Hill High School
4675 Oxford School Road
Claremont, NC 28610

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bunker Hill High School",'Claremont=' + Claremont.length); Catawba[Catawba.length] = createMarker(new GPoint(-81.07620239,35.70273972),"
Catawba Intermediate
403 6th Avenue Sw
Catawba, NC 28609

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Catawba Intermediate",'Catawba=' + Catawba.length); Hickory[Hickory.length] = createMarker(new GPoint(-81.35592200,35.69237000),"
Catawba Valley Early College High School
2550 Hwy 70 Se
Hickory, NC 28602

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Catawba Valley Early College High School",'Hickory=' + Hickory.length); Hickory[Hickory.length] = createMarker(new GPoint(-81.33087921,35.74293518),"
Catawba Valley High School
409 8th Avenue Ne
Hickory, NC 28601

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Catawba Valley High School",'Hickory=' + Hickory.length); Maiden[Maiden.length] = createMarker(new GPoint(-81.15625000,35.58747864),"
Charles H Tuttle Middle School
2872 Water Plant Road
Maiden, NC 28650

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Charles H Tuttle Middle School",'Maiden=' + Maiden.length); Claremont[Claremont.length] = createMarker(new GPoint(-81.14029694,35.72589874),"
Claremont Elementary School
3384 E Main Street
Claremont, NC 28610

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Claremont Elementary School",'Claremont=' + Claremont.length); Hickory[Hickory.length] = createMarker(new GPoint(-81.32659912,35.76499939),"
Clyde Campbell Elementary School
2121 35th Avenue Drive Ne
Hickory, NC 28601

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Clyde Campbell Elementary School",'Hickory=' + Hickory.length); Conover[Conover.length] = createMarker(new GPoint(-81.22069550,35.70151138),"
Conover Special Education
108 7th Street Place Sw
Conover, NC 28613

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Conover Special Education",'Conover=' + Conover.length); Claremont[Claremont.length] = createMarker(new GPoint(-81.15452576,35.71735764),"
Engelmann School Of Art And Sci
2952 N Oxford Street
Claremont, NC 28610

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Engelmann School Of Art And Sci",'Claremont=' + Claremont.length); Newton[Newton.length] = createMarker(new GPoint(-81.35803986,35.60586166),"
Fred T Foard High School
3407 Plateau Road
Newton, NC 28658

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fred T Foard High School",'Newton=' + Newton.length); Hickory[Hickory.length] = createMarker(new GPoint(-81.33989716,35.73283005),"
Frye School
S Campus 420 N Center St
Hickory, NC 28601

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Frye School",'Hickory=' + Hickory.length); Hickory[Hickory.length] = createMarker(new GPoint(-81.38364400,35.72936100),"
Grandview Middle School
451 Catawba Valley Boulevard
Hickory, NC 28602

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Grandview Middle School",'Hickory=' + Hickory.length); Hickory[Hickory.length] = createMarker(new GPoint(-81.32659912,35.76499939),"
Harry M Arndt Middle School
3350 34th Street Drive Ne
Hickory, NC 28601

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Harry M Arndt Middle School",'Hickory=' + Hickory.length); Hickory[Hickory.length] = createMarker(new GPoint(-81.33295441,35.74945068),"
Hickory High School
1234 3rd Street Ne
Hickory, NC 28601

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hickory High School",'Hickory=' + Hickory.length); Newton[Newton.length] = createMarker(new GPoint(-81.35784912,35.60568619),"
Jacobs Fork Middle School
3431 Plateau Road
Newton, NC 28658

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Jacobs Fork Middle School",'Newton=' + Newton.length); Hickory[Hickory.length] = createMarker(new GPoint(-81.38027191,35.72757339),"
Longview Elementary School
2430 2nd Avenue Sw
Hickory, NC 28602

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Longview Elementary School",'Hickory=' + Hickory.length); Conover[Conover.length] = createMarker(new GPoint(-81.33067322,35.80836487),"
Lyle Creek Elementary School
1845 Edgewater Drive
Conover, NC 28613

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lyle Creek Elementary School",'Conover=' + Conover.length); Maiden[Maiden.length] = createMarker(new GPoint(-81.21250153,35.57787704),"
Maiden Elementary School
201 N Main Avenue
Maiden, NC 28650

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Maiden Elementary School",'Maiden=' + Maiden.length); Maiden[Maiden.length] = createMarker(new GPoint(-81.21688080,35.57973099),"
Maiden High School
518 North C Avenue
Maiden, NC 28650

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Maiden High School",'Maiden=' + Maiden.length); Claremont[Claremont.length] = createMarker(new GPoint(-81.09722137,35.67012787),"
Mill Creek Middle School
1041 Shiloh Road
Claremont, NC 28610

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Mill Creek Middle School",'Claremont=' + Claremont.length); Hickory[Hickory.length] = createMarker(new GPoint(-81.38487244,35.66369247),"
Mountain View Elementary School
5911 Dwayne Starnes Road
Hickory, NC 28602

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mountain View Elementary School",'Hickory=' + Hickory.length); Newton[Newton.length] = createMarker(new GPoint(-81.22101600,35.66741200),"
Newton-conover Health/science
338 West 15th Street
Newton, NC 28658

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Newton-conover Health/science",'Newton=' + Newton.length); Newton[Newton.length] = createMarker(new GPoint(-81.22380829,35.67753983),"
Newton-conover High School
338 W 15th Street
Newton, NC 28658

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Newton-conover High School",'Newton=' + Newton.length); Newton[Newton.length] = createMarker(new GPoint(-81.22021484,35.69054794),"
Newton-conover Middle School
221 W 26th Street
Newton, NC 28658

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Newton-conover Middle School",'Newton=' + Newton.length); Hickory[Hickory.length] = createMarker(new GPoint(-81.32577515,35.76824188),"
Northview Middle School
302 28th Avenue Ne
Hickory, NC 28601

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Northview Middle School",'Hickory=' + Hickory.length); Hickory[Hickory.length] = createMarker(new GPoint(-81.34426880,35.73711777),"
Oakwood Elementary School
366 4th Street Nw
Hickory, NC 28601

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Oakwood Elementary School",'Hickory=' + Hickory.length); Claremont[Claremont.length] = createMarker(new GPoint(-81.16054535,35.73331451),"
Oxford Elementary School
5915 Oxford Road
Claremont, NC 28610

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Oxford Elementary School",'Claremont=' + Claremont.length); Claremont[Claremont.length] = createMarker(new GPoint(-81.11109924,35.74214935),"
River Bend Middle School
4670 Oxford School Road
Claremont, NC 28610

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("River Bend Middle School",'Claremont=' + Claremont.length); Conover[Conover.length] = createMarker(new GPoint(-81.27320862,35.73557663),"
Saint Stephens Elementary School
684 30th Street Ne
Conover, NC 28613

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Saint Stephens Elementary School",'Conover=' + Conover.length); Hickory[Hickory.length] = createMarker(new GPoint(-81.32659912,35.76499939),"
Saint Stephens High School
3205 34th Street Drive Ne
Hickory, NC 28601

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Saint Stephens High School",'Hickory=' + Hickory.length); Sherrills_Ford[Sherrills_Ford.length] = createMarker(new GPoint(-80.99539948,35.59479904),"
Sherrills Ford Elementary School
Po Box 10
Sherrills Ford, NC 28673

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sherrills Ford Elementary School",'Sherrills_Ford=' + Sherrills_Ford.length); Conover[Conover.length] = createMarker(new GPoint(-81.19888306,35.71810913),"
Shuford Elementary School
810 Hunsucker Road
Conover, NC 28613

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Shuford Elementary School",'Conover=' + Conover.length); Newton[Newton.length] = createMarker(new GPoint(-81.22606659,35.66509628),"
South Newton Elementary School
306 West 1st Street
Newton, NC 28658

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("South Newton Elementary School",'Newton=' + Newton.length); Hickory[Hickory.length] = createMarker(new GPoint(-81.38689423,35.71021652),"
Southwest Elementary School
1580 32nd Street Sw
Hickory, NC 28602

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Southwest Elementary School",'Hickory=' + Hickory.length); Newton[Newton.length] = createMarker(new GPoint(-81.26884460,35.64271927),"
Startown Elementary School
4119 Startown Road
Newton, NC 28658

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Startown Elementary School",'Newton=' + Newton.length); Hickory[Hickory.length] = createMarker(new GPoint(-81.29901886,35.73176956),"
Sweetwater Elementary School
2110 Main Avenue Se
Hickory, NC 28602

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sweetwater Elementary School",'Hickory=' + Hickory.length); Newton[Newton.length] = createMarker(new GPoint(-81.22139740,35.68057251),"
Thornton Elementary School
301 W 18th Street
Newton, NC 28658

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Thornton Elementary School",'Newton=' + Newton.length); Hickory[Hickory.length] = createMarker(new GPoint(-81.33741760,35.75336456),"
Viewmont Elementary School
21 16th Avenue Nw
Hickory, NC 28601

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Viewmont Elementary School",'Hickory=' + Hickory.length); Hickory[Hickory.length] = createMarker(new GPoint(-81.32326508,35.78076172),"
W M Jenkins Elementary School
3750 N Center Street
Hickory, NC 28601

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("W M Jenkins Elementary School",'Hickory=' + Hickory.length); Hickory[Hickory.length] = createMarker(new GPoint(-81.25127411,35.74149323),"
Webb A Murray Elementary School
3901 Section House Road
Hickory, NC 28601

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Webb A Murray Elementary School",'Hickory=' + Hickory.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(Catawba); map.removeOverlays(Claremont); map.removeOverlays(Conover); map.removeOverlays(Hickory); map.removeOverlays(Maiden); map.removeOverlays(Newton); map.removeOverlays(Sherrills_Ford); map.removeOverlays(Vale); 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(Newton);map.removeOverlays(Catawba); map.removeOverlays(Claremont); map.removeOverlays(Conover); map.removeOverlays(Hickory); map.removeOverlays(Maiden); map.removeOverlays(Newton); map.removeOverlays(Sherrills_Ford); map.removeOverlays(Vale); map.addOverlays(Catawba); centerByArray(Catawba, false, false); cntMarker += Catawba.length; map.addOverlays(Claremont); centerByArray(Claremont, false, false); cntMarker += Claremont.length; map.addOverlays(Conover); centerByArray(Conover, false, false); cntMarker += Conover.length; map.addOverlays(Hickory); centerByArray(Hickory, false, false); cntMarker += Hickory.length; map.addOverlays(Maiden); centerByArray(Maiden, false, false); cntMarker += Maiden.length; map.addOverlays(Newton); centerByArray(Newton, false, false); cntMarker += Newton.length; map.addOverlays(Sherrills_Ford); centerByArray(Sherrills_Ford, false, false); cntMarker += Sherrills_Ford.length; map.addOverlays(Vale); centerByArray(Vale, false, false); cntMarker += Vale.length; centerByArray(Newton,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'); } }