function addMarkers() { mySelect = document.getElementById('selection'); Darlington = [];Hartsville = [];Lamar = [];Society_Hill = [];mySelect.options[mySelect.options.length] = new Option("Darlington schools",'all=Darlington'); mySelect.options[mySelect.options.length] = new Option("Hartsville schools",'all=Hartsville'); mySelect.options[mySelect.options.length] = new Option("Lamar schools",'all=Lamar'); mySelect.options[mySelect.options.length] = new Option("Society Hill schools",'all=Society_Hill'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Darlington[Darlington.length] = createMarker(new GPoint(-79.88583374,34.28801346),"
Brockington Elementary School
413 Brockington Rd
Darlington, SC 29532

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Brockington Elementary School",'Darlington=' + Darlington.length); Darlington[Darlington.length] = createMarker(new GPoint(-79.87950897,34.30572510),"
Brunson-dargan Elementary School
400 Wells Street
Darlington, SC 29532

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Brunson-dargan Elementary School",'Darlington=' + Darlington.length); Hartsville[Hartsville.length] = createMarker(new GPoint(-80.08981323,34.36758041),"
Carolina Elementary School
719 W Carolina Ave
Hartsville, SC 29550

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Carolina Elementary School",'Hartsville=' + Hartsville.length); Darlington[Darlington.length] = createMarker(new GPoint(-79.87719727,34.31878281),"
Darlington High School
525 Spring Street
Darlington, SC 29532

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Darlington High School",'Darlington=' + Darlington.length); Darlington[Darlington.length] = createMarker(new GPoint(-79.87064362,34.28950882),"
Darlington Junior High School
100 Magnolia Street
Darlington, SC 29532

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Darlington Junior High School",'Darlington=' + Darlington.length); Hartsville[Hartsville.length] = createMarker(new GPoint(-80.08628845,34.36159897),"
Hartsville High School
701 Lewellyn Avenue
Hartsville, SC 29550

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hartsville High School",'Hartsville=' + Hartsville.length); Hartsville[Hartsville.length] = createMarker(new GPoint(-80.08096313,34.37108231),"
Hartsville Junior High School
437 West Carolina Av
Hartsville, SC 29550

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Hartsville Junior High School",'Hartsville=' + Hartsville.length); Darlington[Darlington.length] = createMarker(new GPoint(-79.86067963,34.29208374),"
J L Cain Elementary School
607 First Street
Darlington, SC 29532

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("J L Cain Elementary School",'Darlington=' + Darlington.length); Lamar[Lamar.length] = createMarker(new GPoint(-80.06324768,34.16544342),"
Lamar Elementary School
214 Darlington Avenue
Lamar, SC 29069

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lamar Elementary School",'Lamar=' + Lamar.length); Lamar[Lamar.length] = createMarker(new GPoint(-80.06328583,34.16539383),"
Lamar High School
216 Darlington Avenue
Lamar, SC 29069

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lamar High School",'Lamar=' + Lamar.length); Darlington[Darlington.length] = createMarker(new GPoint(-79.86936188,34.29259872),"
Mayo High School
405 Chestnut Street
Darlington, SC 29532

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mayo High School",'Darlington=' + Darlington.length); Hartsville[Hartsville.length] = createMarker(new GPoint(-80.07644653,34.39214325),"
North Hartsville Elementary School
110 School Drive
Hartsville, SC 29550

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Hartsville Elementary School",'Hartsville=' + Hartsville.length); Darlington[Darlington.length] = createMarker(new GPoint(-79.88665771,34.29055786),"
Pate Elementary School
200 Indian Branch Road
Darlington, SC 29532

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pate Elementary School",'Darlington=' + Darlington.length); Society_Hill[Society_Hill.length] = createMarker(new GPoint(-96.88749100,32.92822200),"
Rosenwald/st David's Elementary School
1508 Church Street
Society Hill, SC 29593

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rosenwald/st David's Elementary School",'Society_Hill=' + Society_Hill.length); Darlington[Darlington.length] = createMarker(new GPoint(-96.88548300,32.98340500),"
Saint John's Elementary School
0140 Park Street
Darlington, SC 29532

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Saint John's Elementary School",'Darlington=' + Darlington.length); Hartsville[Hartsville.length] = createMarker(new GPoint(-80.07375000,34.37502500),"
Southside Early Childhood Center
1615 Blanding Drive
Hartsville, SC 29550

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Southside Early Childhood Center",'Hartsville=' + Hartsville.length); Lamar[Lamar.length] = createMarker(new GPoint(-80.06298828,34.16555786),"
Spaulding Elementary School
204 East Pearl St.
Lamar, SC 29069

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Spaulding Elementary School",'Lamar=' + Lamar.length); Lamar[Lamar.length] = createMarker(new GPoint(-80.06132507,34.16603470),"
Spaulding Junior High School
400 South Main Street
Lamar, SC 29069

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Spaulding Junior High School",'Lamar=' + Lamar.length); Hartsville[Hartsville.length] = createMarker(new GPoint(-80.06092072,34.38070679),"
Thornwell Elementary School
604 E Home Ave
Hartsville, SC 29550

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Thornwell Elementary School",'Hartsville=' + Hartsville.length); Hartsville[Hartsville.length] = createMarker(new GPoint(-80.07501221,34.36119080),"
Washington Street Elementary School
325 Washington Ave
Hartsville, SC 29550

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Washington Street Elementary School",'Hartsville=' + Hartsville.length); Hartsville[Hartsville.length] = createMarker(new GPoint(-80.14022064,34.35610580),"
West Hartsville Elementary School
214 Clyde Road
Hartsville, SC 29550

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("West Hartsville Elementary School",'Hartsville=' + Hartsville.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(Darlington); map.removeOverlays(Hartsville); map.removeOverlays(Lamar); map.removeOverlays(Society_Hill); 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(Darlington);map.removeOverlays(Darlington); map.removeOverlays(Hartsville); map.removeOverlays(Lamar); map.removeOverlays(Society_Hill); map.addOverlays(Darlington); centerByArray(Darlington, false, false); cntMarker += Darlington.length; map.addOverlays(Hartsville); centerByArray(Hartsville, false, false); cntMarker += Hartsville.length; map.addOverlays(Lamar); centerByArray(Lamar, false, false); cntMarker += Lamar.length; map.addOverlays(Society_Hill); centerByArray(Society_Hill, false, false); cntMarker += Society_Hill.length; centerByArray(Darlington,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'); } }