function addMarkers() { mySelect = document.getElementById('selection'); China_Grove = [];Salisbury = [];Cleveland = [];Landis = [];Faith = [];Granite_Quarry = [];Kannapolis = [];Gold_Hill = [];Mount_Ulla = [];Spencer = [];Rockwell = [];Woodleaf = [];mySelect.options[mySelect.options.length] = new Option("China Grove schools",'all=China_Grove'); mySelect.options[mySelect.options.length] = new Option("Cleveland schools",'all=Cleveland'); mySelect.options[mySelect.options.length] = new Option("Faith schools",'all=Faith'); mySelect.options[mySelect.options.length] = new Option("Gold Hill schools",'all=Gold_Hill'); mySelect.options[mySelect.options.length] = new Option("Granite Quarry schools",'all=Granite_Quarry'); mySelect.options[mySelect.options.length] = new Option("Kannapolis schools",'all=Kannapolis'); mySelect.options[mySelect.options.length] = new Option("Landis schools",'all=Landis'); mySelect.options[mySelect.options.length] = new Option("Mount Ulla schools",'all=Mount_Ulla'); mySelect.options[mySelect.options.length] = new Option("Rockwell schools",'all=Rockwell'); mySelect.options[mySelect.options.length] = new Option("Salisbury schools",'all=Salisbury'); mySelect.options[mySelect.options.length] = new Option("Spencer schools",'all=Spencer'); mySelect.options[mySelect.options.length] = new Option("Woodleaf schools",'all=Woodleaf'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); China_Grove[China_Grove.length] = createMarker(new GPoint(-80.54244232,35.52484894),"
Bostian Elementary School
4245 Old Beatty Ford Rd
China Grove, NC 28023

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bostian Elementary School",'China_Grove=' + China_Grove.length); Salisbury[Salisbury.length] = createMarker(new GPoint(-80.47391510,35.68873596),"
Carroll T Overton Elementary School
1825 Park Rd W
Salisbury, NC 28144

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Carroll T Overton Elementary School",'Salisbury=' + Salisbury.length); Salisbury[Salisbury.length] = createMarker(new GPoint(-82.72666200,38.81347000),"
Charles C Erwin Middle School
170 St Luke''s Church Rd
Salisbury, NC 28146

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Charles C Erwin Middle School",'Salisbury=' + Salisbury.length); China_Grove[China_Grove.length] = createMarker(new GPoint(-80.58448029,35.56783676),"
China Grove Elementary School
514 S Franklin St
China Grove, NC 28023

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("China Grove Elementary School",'China_Grove=' + China_Grove.length); China_Grove[China_Grove.length] = createMarker(new GPoint(-80.56953430,35.57596207),"
China Grove Middle School
1013 N Main St
China Grove, NC 28023

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("China Grove Middle School",'China_Grove=' + China_Grove.length); Cleveland[Cleveland.length] = createMarker(new GPoint(-80.68200684,35.72968292),"
Cleveland Elementary School
107 School Street
Cleveland, NC 27013

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cleveland Elementary School",'Cleveland=' + Cleveland.length); Landis[Landis.length] = createMarker(new GPoint(-80.61460114,35.54549408),"
Corriher Lipe Middle School
214 W Rice St
Landis, NC 28088

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Corriher Lipe Middle School",'Landis=' + Landis.length); Salisbury[Salisbury.length] = createMarker(new GPoint(-80.42434692,35.67137909),"
E Hanford Dole Elementary School
465 Choate Road
Salisbury, NC 28146

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("E Hanford Dole Elementary School",'Salisbury=' + Salisbury.length); Salisbury[Salisbury.length] = createMarker(new GPoint(-82.85874900,38.86041800),"
East Rowan High School
175 St Luke''s Church Rd
Salisbury, NC 28146

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("East Rowan High School",'Salisbury=' + Salisbury.length); China_Grove[China_Grove.length] = createMarker(new GPoint(-80.66616821,35.53321075),"
Enochville Elementary School
925 N Enochville Ave
China Grove, NC 28023

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Enochville Elementary School",'China_Grove=' + China_Grove.length); Faith[Faith.length] = createMarker(new GPoint(-80.50550079,35.65140152),"
Faith Elementary School
Po Box 161
Faith, NC 28041

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Faith Elementary School",'Faith=' + Faith.length); Granite_Quarry[Granite_Quarry.length] = createMarker(new GPoint(-80.44689941,35.61220169),"
Granite Quarry Elementary School
Po Box 279
Granite Quarry, NC 28072

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Granite Quarry Elementary School",'Granite_Quarry=' + Granite_Quarry.length); Salisbury[Salisbury.length] = createMarker(new GPoint(-80.50299835,35.70419693),"
H D Isenberg Elementary School
2800 Jake Alexander Blvd N
Salisbury, NC 28147

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("H D Isenberg Elementary School",'Salisbury=' + Salisbury.length); Salisbury[Salisbury.length] = createMarker(new GPoint(-80.45722198,35.67700958),"
Henderson Independent High School
1215 N Main Street
Salisbury, NC 28144

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Henderson Independent High School",'Salisbury=' + Salisbury.length); Salisbury[Salisbury.length] = createMarker(new GPoint(-80.55950928,35.70001602),"
Hurley Elementary School
625 Hurley School Rd
Salisbury, NC 28147

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hurley Elementary School",'Salisbury=' + Salisbury.length); Kannapolis[Kannapolis.length] = createMarker(new GPoint(-80.60192871,35.50476456),"
Jackson Park Elementary School
1400 Jackson Street
Kannapolis, NC 28083

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jackson Park Elementary School",'Kannapolis=' + Kannapolis.length); Salisbury[Salisbury.length] = createMarker(new GPoint(-80.57286835,35.61553574),"
Knollwood Elementary School
3075 Shue Rd
Salisbury, NC 28147

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Knollwood Elementary School",'Salisbury=' + Salisbury.length); Salisbury[Salisbury.length] = createMarker(new GPoint(-80.47777557,35.68485260),"
Knox Middle School
1625 Park Rd W
Salisbury, NC 28144

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Knox Middle School",'Salisbury=' + Salisbury.length); Landis[Landis.length] = createMarker(new GPoint(-80.61774445,35.55301285),"
Landis Elementary School
801 W Ryder Ave
Landis, NC 28088

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Landis Elementary School",'Landis=' + Landis.length); China_Grove[China_Grove.length] = createMarker(new GPoint(-80.65435600,35.60024600),"
Millbridge Elementary School
155 Ed Deal Road
China Grove, NC 28023

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Millbridge Elementary School",'China_Grove=' + China_Grove.length); Gold_Hill[Gold_Hill.length] = createMarker(new GPoint(-80.33579254,35.58047485),"
Morgan Elementary School
3860 Liberty Rd
Gold Hill, NC 28071

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Morgan Elementary School",'Gold_Hill=' + Gold_Hill.length); Mount_Ulla[Mount_Ulla.length] = createMarker(new GPoint(-80.71814728,35.66586304),"
Mount Ulla Elementary School
13155 Nc 801 Hwy
Mount Ulla, NC 28125

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mount Ulla Elementary School",'Mount_Ulla=' + Mount_Ulla.length); Spencer[Spencer.length] = createMarker(new GPoint(-80.42787170,35.70109558),"
North Rowan Elementary School
600 Charles St
Spencer, NC 28159

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Rowan Elementary School",'Spencer=' + Spencer.length); Spencer[Spencer.length] = createMarker(new GPoint(-80.42836761,35.69603729),"
North Rowan High School
300 N Whitehead Ave
Spencer, NC 28159

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("North Rowan High School",'Spencer=' + Spencer.length); Spencer[Spencer.length] = createMarker(new GPoint(-80.42485046,35.69958115),"
North Rowan Middle School
512 Charles Street
Spencer, NC 28159

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("North Rowan Middle School",'Spencer=' + Spencer.length); Rockwell[Rockwell.length] = createMarker(new GPoint(-80.41426849,35.55582428),"
Rockwell Elementary School
114 Link St
Rockwell, NC 28138

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rockwell Elementary School",'Rockwell=' + Rockwell.length); Salisbury[Salisbury.length] = createMarker(new GPoint(-80.53211212,35.63871384),"
Rowan Academy
1010 Airport Road
Salisbury, NC 28147

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rowan Academy",'Salisbury=' + Salisbury.length); Salisbury[Salisbury.length] = createMarker(new GPoint(-80.48326874,35.66383743),"
Salisbury High School
500 Lincolnton Rd
Salisbury, NC 28144

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Salisbury High School",'Salisbury=' + Salisbury.length); China_Grove[China_Grove.length] = createMarker(new GPoint(-80.61116791,35.57434464),"
South Rowan High School
1655 Patterson St
China Grove, NC 28023

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("South Rowan High School",'China_Grove=' + China_Grove.length); Salisbury[Salisbury.length] = createMarker(new GPoint(-80.50906372,35.60681915),"
Southeast Middle School
1570 Peeler Road
Salisbury, NC 28146

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Southeast Middle School",'Salisbury=' + Salisbury.length); Mount_Ulla[Mount_Ulla.length] = createMarker(new GPoint(-80.64236450,35.70052719),"
West Rowan High School
8050 Nc 801 Hwy
Mount Ulla, NC 28125

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("West Rowan High School",'Mount_Ulla=' + Mount_Ulla.length); Salisbury[Salisbury.length] = createMarker(new GPoint(-80.58491516,35.71533585),"
West Rowan Middle School
5925 Statesville Blvd
Salisbury, NC 28147

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("West Rowan Middle School",'Salisbury=' + Salisbury.length); Woodleaf[Woodleaf.length] = createMarker(new GPoint(-80.58984375,35.77050781),"
Woodleaf Elementary School
9055 School Street
Woodleaf, NC 27054

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Woodleaf Elementary School",'Woodleaf=' + Woodleaf.length); Kannapolis[Kannapolis.length] = createMarker(new GPoint(-80.61986542,35.50804138),"
Woodrow Wilson Elementary School
800 N Walnut Street
Kannapolis, NC 28081

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Woodrow Wilson Elementary School",'Kannapolis=' + Kannapolis.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(China_Grove); map.removeOverlays(Cleveland); map.removeOverlays(Faith); map.removeOverlays(Gold_Hill); map.removeOverlays(Granite_Quarry); map.removeOverlays(Kannapolis); map.removeOverlays(Landis); map.removeOverlays(Mount_Ulla); map.removeOverlays(Rockwell); map.removeOverlays(Salisbury); map.removeOverlays(Spencer); map.removeOverlays(Woodleaf); 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(China_Grove);map.removeOverlays(China_Grove); map.removeOverlays(Cleveland); map.removeOverlays(Faith); map.removeOverlays(Gold_Hill); map.removeOverlays(Granite_Quarry); map.removeOverlays(Kannapolis); map.removeOverlays(Landis); map.removeOverlays(Mount_Ulla); map.removeOverlays(Rockwell); map.removeOverlays(Salisbury); map.removeOverlays(Spencer); map.removeOverlays(Woodleaf); map.addOverlays(China_Grove); centerByArray(China_Grove, false, false); cntMarker += China_Grove.length; map.addOverlays(Cleveland); centerByArray(Cleveland, false, false); cntMarker += Cleveland.length; map.addOverlays(Faith); centerByArray(Faith, false, false); cntMarker += Faith.length; map.addOverlays(Gold_Hill); centerByArray(Gold_Hill, false, false); cntMarker += Gold_Hill.length; map.addOverlays(Granite_Quarry); centerByArray(Granite_Quarry, false, false); cntMarker += Granite_Quarry.length; map.addOverlays(Kannapolis); centerByArray(Kannapolis, false, false); cntMarker += Kannapolis.length; map.addOverlays(Landis); centerByArray(Landis, false, false); cntMarker += Landis.length; map.addOverlays(Mount_Ulla); centerByArray(Mount_Ulla, false, false); cntMarker += Mount_Ulla.length; map.addOverlays(Rockwell); centerByArray(Rockwell, false, false); cntMarker += Rockwell.length; map.addOverlays(Salisbury); centerByArray(Salisbury, false, false); cntMarker += Salisbury.length; map.addOverlays(Spencer); centerByArray(Spencer, false, false); cntMarker += Spencer.length; map.addOverlays(Woodleaf); centerByArray(Woodleaf, false, false); cntMarker += Woodleaf.length; centerByArray(China_Grove,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'); } }