function addMarkers(){ mySelect = document.getElementById('selection'); Thomasville = [];Lexington = [];Winston_Salem = [];High_Point = [];mySelect.options[mySelect.options.length] = new Option("High Point schools",'all=High_Point'); mySelect.options[mySelect.options.length] = new Option("Lexington schools",'all=Lexington'); mySelect.options[mySelect.options.length] = new Option("Thomasville schools",'all=Thomasville'); mySelect.options[mySelect.options.length] = new Option("Winston Salem schools",'all=Winston_Salem'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Thomasville[Thomasville.length] = createMarker(new GPoint(-80.05918600,35.85765600),"
Bethany Stepping Stones
584 Tower Road
Thomasville, NC 27360
Co-ed school, PK-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bethany Stepping Stones",'Thomasville=' + Thomasville.length); Thomasville[Thomasville.length] = createMarker(new GPoint(-80.07919500,35.87027300),"
Brittain Academy
175 W Holly Hill Road
Thomasville, NC 27360
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Brittain Academy",'Thomasville=' + Thomasville.length); Thomasville[Thomasville.length] = createMarker(new GPoint(-80.12029900,35.81745000),"
Carolina Christian Academy
367 Academy Drive
Thomasville, NC 27360
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Carolina Christian Academy",'Thomasville=' + Thomasville.length); Lexington[Lexington.length] = createMarker(new GPoint(-80.20680000,35.73510000),"
Davidson Academy
Po Box 2013
Lexington, NC 27293
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Davidson Academy",'Lexington=' + Lexington.length); Thomasville[Thomasville.length] = createMarker(new GPoint(-80.02016700,35.86436400),"
New Hope Christian Academy, Inc.
105 Pineywood Street
Thomasville, NC 27360
Co-ed school, 1-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Hope Christian Academy, Inc.",'Thomasville=' + Thomasville.length); Lexington[Lexington.length] = createMarker(new GPoint(-80.26092600,35.81064900),"
Sheets Memorial Christian School
307 Holt Street
Lexington, NC 27292
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sheets Memorial Christian School",'Lexington=' + Lexington.length); Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.27584700,35.99411900),"
Triad Academy
905 Friedberg Church Road
Winston Salem, NC 27127
Co-ed school, 1-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Triad Academy",'Winston_Salem=' + Winston_Salem.length); Lexington[Lexington.length] = createMarker(new GPoint(-80.26387200,35.97571700),"
Union Grove Christian School
2295 Union Grove Road
Lexington, NC 27295
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Union Grove Christian School",'Lexington=' + Lexington.length); Lexington[Lexington.length] = createMarker(new GPoint(-80.06608100,35.69915200),"
Walter's Grove Christian Academy
2610 Cid Road
Lexington, NC 27292
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Walter's Grove Christian Academy",'Lexington=' + Lexington.length); High_Point[High_Point.length] = createMarker(new GPoint(-80.08461600,35.97154900),"
Westchester Academy
2045 N Old Greensboro Road
High Point, NC 27265
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Westchester Academy",'High_Point=' + High_Point.length); High_Point[High_Point.length] = createMarker(new GPoint(-80.08461600,35.97154900),"
Westchester Country Day School
2045 N. Old Greensboro Road
High Point, NC 27265
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Westchester Country Day School",'High_Point=' + High_Point.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/////3/' + showArray); map.removeOverlays(High_Point); map.removeOverlays(Lexington); map.removeOverlays(Thomasville); map.removeOverlays(Winston_Salem); 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(Thomasville);map.removeOverlays(High_Point); map.removeOverlays(Lexington); map.removeOverlays(Thomasville); map.removeOverlays(Winston_Salem); map.addOverlays(High_Point); centerByArray(High_Point, false, false); cntMarker += High_Point.length; map.addOverlays(Lexington); centerByArray(Lexington, false, false); cntMarker += Lexington.length; map.addOverlays(Thomasville); centerByArray(Thomasville, false, false); cntMarker += Thomasville.length; map.addOverlays(Winston_Salem); centerByArray(Winston_Salem, false, false); cntMarker += Winston_Salem.length; centerByArray(Thomasville,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=3&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; }