function addMarkers(){ mySelect = document.getElementById('selection'); Landrum = [];Greenville = [];Greer = [];Conestee = [];Simpsonville = [];Taylors = [];Piedmont = [];mySelect.options[mySelect.options.length] = new Option("Conestee schools",'all=Conestee'); mySelect.options[mySelect.options.length] = new Option("Greenville schools",'all=Greenville'); mySelect.options[mySelect.options.length] = new Option("Greer schools",'all=Greer'); mySelect.options[mySelect.options.length] = new Option("Landrum schools",'all=Landrum'); mySelect.options[mySelect.options.length] = new Option("Piedmont schools",'all=Piedmont'); mySelect.options[mySelect.options.length] = new Option("Simpsonville schools",'all=Simpsonville'); mySelect.options[mySelect.options.length] = new Option("Taylors schools",'all=Taylors'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Landrum[Landrum.length] = createMarker(new GPoint(-82.33768200,35.09949200),"
Blue Ridge Christian Academy
424 Highway 101
Landrum, SC 29356
Co-ed school, PK-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Blue Ridge Christian Academy",'Landrum=' + Landrum.length); Greenville[Greenville.length] = createMarker(new GPoint(-82.36351700,34.87676700),"
Bob Jones Academy
1700 Wade Hampton Blvd
Greenville, SC 29614
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bob Jones Academy",'Greenville=' + Greenville.length); Greenville[Greenville.length] = createMarker(new GPoint(-82.36351700,34.87676700),"
Bob Jones Jr High School
1700 Wade Hampton Blvd
Greenville, SC 29614
Co-ed school, 7-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bob Jones Jr High School",'Greenville=' + Greenville.length); Greenville[Greenville.length] = createMarker(new GPoint(-82.39564600,34.78012800),"
Buried Treasure Christian Learning Center
906 White Horse Road
Greenville, SC 29605
Co-ed school, K-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Buried Treasure Christian Learning Center",'Greenville=' + Greenville.length); Greer[Greer.length] = createMarker(new GPoint(-82.23450700,34.93630800),"
Calvary Christian School
100 Duke Street
Greer, SC 29650
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Calvary Christian School",'Greer=' + Greer.length); Greenville[Greenville.length] = createMarker(new GPoint(-82.34853300,34.79860300),"
Christ Church Episcopal School
567 Wenwood Road
Greenville, SC 29607
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Christ Church Episcopal School",'Greenville=' + Greenville.length); Conestee[Conestee.length] = createMarker(new GPoint(-82.35000000,34.76800000),"
Conestee Baptist Day School
P. O. Box 157
Conestee, SC 29636
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Conestee Baptist Day School",'Conestee=' + Conestee.length); Simpsonville[Simpsonville.length] = createMarker(new GPoint(-82.24340000,34.77050000),"
E Georgia Rd Baptist Church
Po Box 189
Simpsonville, SC 29681
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("E Georgia Rd Baptist Church",'Simpsonville=' + Simpsonville.length); Simpsonville[Simpsonville.length] = createMarker(new GPoint(-82.23629400,34.76125500),"
Five Oaks Academy
1101 Jonesville rd
Simpsonville, SC 29681
Co-ed school, NS-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Five Oaks Academy",'Simpsonville=' + Simpsonville.length); Greenville[Greenville.length] = createMarker(new GPoint(-82.41703100,34.83427400),"
Fuller Normal Industrial Institute
901 Anderson Road
Greenville, SC 29601
school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fuller Normal Industrial Institute",'Greenville=' + Greenville.length); Simpsonville[Simpsonville.length] = createMarker(new GPoint(-82.23853000,34.81007700),"
Greenville Classical Academy
2519 Woodruff Road
Simpsonville, SC 29681
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Greenville Classical Academy",'Simpsonville=' + Simpsonville.length); Greenville[Greenville.length] = createMarker(new GPoint(-82.39461100,34.89773700),"
Hampton Park Christian School
875 State Park Road
Greenville, SC 29609
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hampton Park Christian School",'Greenville=' + Greenville.length); Taylors[Taylors.length] = createMarker(new GPoint(-82.35108500,34.89496600),"
Hidden Treasure Christian School
500 W Lee Rd
Taylors, SC 29687
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hidden Treasure Christian School",'Taylors=' + Taylors.length); Piedmont[Piedmont.length] = createMarker(new GPoint(-82.44451200,34.69918800),"
Piedmont Christian Academy
750 Oil Mill Road
Piedmont, SC 29673
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Piedmont Christian Academy",'Piedmont=' + Piedmont.length); Taylors[Taylors.length] = createMarker(new GPoint(-82.31767700,34.94813000),"
Pleasant View Christian Academy
110 Old Rutherford Road
Taylors, SC 29687
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pleasant View Christian Academy",'Taylors=' + Taylors.length); Greenville[Greenville.length] = createMarker(new GPoint(-82.33899500,34.81230300),"
St. Joseph's Catholic School
100 St. Joseph''s Drive
Greenville, SC 29607
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Joseph's Catholic School",'Greenville=' + Greenville.length); Greenville[Greenville.length] = createMarker(new GPoint(-82.27276100,34.84168000),"
Shannon Forest Christian School
829 Garlington Road
Greenville, SC 29615
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Shannon Forest Christian School",'Greenville=' + Greenville.length); Simpsonville[Simpsonville.length] = createMarker(new GPoint(-82.25307400,34.81974300),"
Southside Christian School
2211 Woodruff Rd
Simpsonville, SC 29681
Co-ed school, NS-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Southside Christian School",'Simpsonville=' + Simpsonville.length); Greenville[Greenville.length] = createMarker(new GPoint(-82.44673100,34.82976600),"
Tabernacle Christian School
3931 White Horse Road
Greenville, SC 29611
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tabernacle Christian School",'Greenville=' + Greenville.length); Piedmont[Piedmont.length] = createMarker(new GPoint(-82.43563200,34.74678300),"
Trinity Christian Academy
824 Piedmont Highway
Piedmont, SC 29673
Co-ed school, K-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Trinity Christian Academy",'Piedmont=' + Piedmont.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(Conestee); map.removeOverlays(Greenville); map.removeOverlays(Greer); map.removeOverlays(Landrum); map.removeOverlays(Piedmont); map.removeOverlays(Simpsonville); map.removeOverlays(Taylors); 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(Landrum);map.removeOverlays(Conestee); map.removeOverlays(Greenville); map.removeOverlays(Greer); map.removeOverlays(Landrum); map.removeOverlays(Piedmont); map.removeOverlays(Simpsonville); map.removeOverlays(Taylors); map.addOverlays(Conestee); centerByArray(Conestee, false, false); cntMarker += Conestee.length; map.addOverlays(Greenville); centerByArray(Greenville, false, false); cntMarker += Greenville.length; map.addOverlays(Greer); centerByArray(Greer, false, false); cntMarker += Greer.length; map.addOverlays(Landrum); centerByArray(Landrum, false, false); cntMarker += Landrum.length; map.addOverlays(Piedmont); centerByArray(Piedmont, false, false); cntMarker += Piedmont.length; map.addOverlays(Simpsonville); centerByArray(Simpsonville, false, false); cntMarker += Simpsonville.length; map.addOverlays(Taylors); centerByArray(Taylors, false, false); cntMarker += Taylors.length; centerByArray(Landrum,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; }