function addMarkers(){ mySelect = document.getElementById('selection'); Greensboro = [];Highpoint = [];High_Point = [];Oak_Ridge = [];mySelect.options[mySelect.options.length] = new Option("Greensboro schools",'all=Greensboro'); mySelect.options[mySelect.options.length] = new Option("High Point schools",'all=High_Point'); mySelect.options[mySelect.options.length] = new Option("Highpoint schools",'all=Highpoint'); mySelect.options[mySelect.options.length] = new Option("Oak Ridge schools",'all=Oak_Ridge'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Greensboro[Greensboro.length] = createMarker(new GPoint(-118.52730000,34.18120000),"
American Hebrew Academy
4334 Hobbs Road
Greensboro, NC 27410
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("American Hebrew Academy",'Greensboro=' + Greensboro.length); Greensboro[Greensboro.length] = createMarker(new GPoint(-79.88656900,36.13494300),"
Caldwell Academy
2900 Horse Pen Creek Rd
Greensboro, NC 27410
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Caldwell Academy",'Greensboro=' + Greensboro.length); Highpoint[Highpoint.length] = createMarker(new GPoint(-79.99376800,35.92256700),"
Calvary Nazarene Christian Aca
622 W. Fairfield Rd.
Highpoint, NC 27263
Co-ed school, PK-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Calvary Nazarene Christian Aca",'Highpoint=' + Highpoint.length); Greensboro[Greensboro.length] = createMarker(new GPoint(-79.83402200,36.14265700),"
Greensboro Day School
5041 Lawndale Drive
Greensboro, NC 27455
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Greensboro Day School",'Greensboro=' + Greensboro.length); Greensboro[Greensboro.length] = createMarker(new GPoint(-79.87394300,36.14750900),"
Guilford Day School
3310 Horsepen Creek Road
Greensboro, NC 27410
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Guilford Day School",'Greensboro=' + Greensboro.length); High_Point[High_Point.length] = createMarker(new GPoint(-80.03381600,35.94871100),"
Hayworth Christian School
1696 Westchester Drive
High Point, NC 27262
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hayworth Christian School",'High_Point=' + High_Point.length); High_Point[High_Point.length] = createMarker(new GPoint(-80.02277700,35.94984300),"
High Point Christian Academy
307 N Rotary Drive
High Point, NC 27262
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("High Point Christian Academy",'High_Point=' + High_Point.length); High_Point[High_Point.length] = createMarker(new GPoint(-80.03127000,35.99190400),"
Matrix Christian Academy
215 W Hartley Drive, Apt. b
High Point, NC 27265
Co-ed school, 3-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Matrix Christian Academy",'High_Point=' + High_Point.length); Greensboro[Greensboro.length] = createMarker(new GPoint(-79.89160300,36.09847400),"
New Garden Friends School
1128 New Garden Road
Greensboro, NC 27410
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Garden Friends School",'Greensboro=' + Greensboro.length); Greensboro[Greensboro.length] = createMarker(new GPoint(-79.95537800,36.14410600),"
Northwest Baptist Dcc
3605 Edgefield Road
Greensboro, NC 27409
Co-ed school, 2-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Northwest Baptist Dcc",'Greensboro=' + Greensboro.length); Oak_Ridge[Oak_Ridge.length] = createMarker(new GPoint(-79.98970000,36.17100000),"
Oak Ridge Military Academy
Po Box 498
Oak Ridge, NC 27310
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oak Ridge Military Academy",'Oak_Ridge=' + Oak_Ridge.length); High_Point[High_Point.length] = createMarker(new GPoint(-80.01916100,36.03143300),"
Paramount Christian Academy
4124 Johnson Street
High Point, NC 27265
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Paramount Christian Academy",'High_Point=' + High_Point.length); Greensboro[Greensboro.length] = createMarker(new GPoint(-79.93919800,36.14911900),"
Ridgefield Academy
2015 Pleasant Ridge Rd
Greensboro, NC 27410
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ridgefield Academy",'Greensboro=' + Greensboro.length); Greensboro[Greensboro.length] = createMarker(new GPoint(-79.90728400,36.05391700),"
Shining Light Academy
4530 W Wendover Avenue
Greensboro, NC 27409
Co-ed school, PK-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Shining Light Academy",'Greensboro=' + Greensboro.length); High_Point[High_Point.length] = createMarker(new GPoint(-79.98711200,36.06158400),"
Tri-city Junior Academy
8000 Clinard Farms Road
High Point, NC 27265
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tri-city Junior Academy",'High_Point=' + High_Point.length); Greensboro[Greensboro.length] = createMarker(new GPoint(-79.77602900,36.01322200),"
Vandalia Christian School
3919 Pleasant Garden Road
Greensboro, NC 27406
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Vandalia Christian School",'Greensboro=' + Greensboro.length); High_Point[High_Point.length] = createMarker(new GPoint(-80.00070900,35.98570100),"
Wesleyan Christian Academy
1917 N Centennial Street
High Point, NC 27262
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wesleyan Christian Academy",'High_Point=' + High_Point.length); Greensboro[Greensboro.length] = createMarker(new GPoint(-79.72721200,36.09689000),"
Youth Focus Mell-burton School
1601 Huffine Mill Road
Greensboro, NC 27405
Co-ed school, 6-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Youth Focus Mell-burton School",'Greensboro=' + Greensboro.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,11); /* 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/////2/' + showArray); map.removeOverlays(Greensboro); map.removeOverlays(High_Point); map.removeOverlays(Highpoint); map.removeOverlays(Oak_Ridge); 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(Greensboro);map.removeOverlays(Greensboro); map.removeOverlays(High_Point); map.removeOverlays(Highpoint); map.removeOverlays(Oak_Ridge); map.addOverlays(Greensboro); centerByArray(Greensboro, false, false); cntMarker += Greensboro.length; map.addOverlays(High_Point); centerByArray(High_Point, false, false); cntMarker += High_Point.length; map.addOverlays(Highpoint); centerByArray(Highpoint, false, false); cntMarker += Highpoint.length; map.addOverlays(Oak_Ridge); centerByArray(Oak_Ridge, false, false); cntMarker += Oak_Ridge.length; centerByArray(Greensboro,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'); //window.open('/map.php?type=1&schools=&school_level=2&radius=&zipcode=&school_type_search=&school_type_code='); } } function createMarker(point, label, icon) { var marker = new GMarker(point, icon); var html = label; GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); return marker; }