function addMarkers() { mySelect = document.getElementById('selection'); Belton = [];Honea_Path = [];Anderson = [];Williamston = [];Easley = [];Iva = [];La_France = [];Pelzer = [];Pendleton = [];Greenville = [];Piedmont = [];Starr = [];Townville = [];West_Pelzer = [];mySelect.options[mySelect.options.length] = new Option("Anderson schools",'all=Anderson'); mySelect.options[mySelect.options.length] = new Option("Belton schools",'all=Belton'); mySelect.options[mySelect.options.length] = new Option("Easley schools",'all=Easley'); mySelect.options[mySelect.options.length] = new Option("Greenville schools",'all=Greenville'); mySelect.options[mySelect.options.length] = new Option("Honea Path schools",'all=Honea_Path'); mySelect.options[mySelect.options.length] = new Option("Iva schools",'all=Iva'); mySelect.options[mySelect.options.length] = new Option("La France schools",'all=La_France'); mySelect.options[mySelect.options.length] = new Option("Pelzer schools",'all=Pelzer'); mySelect.options[mySelect.options.length] = new Option("Pendleton schools",'all=Pendleton'); mySelect.options[mySelect.options.length] = new Option("Piedmont schools",'all=Piedmont'); mySelect.options[mySelect.options.length] = new Option("Starr schools",'all=Starr'); mySelect.options[mySelect.options.length] = new Option("Townville schools",'all=Townville'); mySelect.options[mySelect.options.length] = new Option("West Pelzer schools",'all=West_Pelzer'); mySelect.options[mySelect.options.length] = new Option("Williamston schools",'all=Williamston'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Belton[Belton.length] = createMarker(new GPoint(-82.49295807,34.51587677),"
Belton Elementary School
202 Watkins St
Belton, SC 29627

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Belton Elementary School",'Belton=' + Belton.length); Honea_Path[Honea_Path.length] = createMarker(new GPoint(-82.44128418,34.47483063),"
Belton Honea Path High School
11000 Belton-honea Path
Honea Path, SC 29654

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Belton Honea Path High School",'Honea_Path=' + Honea_Path.length); Belton[Belton.length] = createMarker(new GPoint(-82.50090027,34.49742508),"
Belton Middle School
102 Cherokee Road
Belton, SC 29627

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Belton Middle School",'Belton=' + Belton.length); Anderson[Anderson.length] = createMarker(new GPoint(-82.62615967,34.52464294),"
Calhoun Street Elementary School
1520 Calhoun St
Anderson, SC 29621

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Calhoun Street Elementary School",'Anderson=' + Anderson.length); Williamston[Williamston.length] = createMarker(new GPoint(-82.55003900,34.58623500),"
Career/tech Ctr Anderson 1 & 2
702 Belton Highway
Williamston, SC 29697

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Career/tech Ctr Anderson 1 & 2",'Williamston=' + Williamston.length); Williamston[Williamston.length] = createMarker(new GPoint(-82.49365234,34.59186554),"
Cedar Grove Elementary School
107 Melvin Lane
Williamston, SC 29697

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cedar Grove Elementary School",'Williamston=' + Williamston.length); Anderson[Anderson.length] = createMarker(new GPoint(-82.70645905,34.52939987),"
Centerville Elementary School
1529 Whitehall Rd
Anderson, SC 29621

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Centerville Elementary School",'Anderson=' + Anderson.length); Anderson[Anderson.length] = createMarker(new GPoint(-82.65647888,34.53656769),"
Concord Elementary School
2701 Calrossie
Anderson, SC 29621

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Concord Elementary School",'Anderson=' + Anderson.length); Easley[Easley.length] = createMarker(new GPoint(-82.50840759,34.79577255),"
Concrete Primary School
535 Powdersville Main
Easley, SC 29642

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Concrete Primary School",'Easley=' + Easley.length); Iva[Iva.length] = createMarker(new GPoint(-82.68488312,34.33412552),"
Crescent High School
9104 Hwy 81 South
Iva, SC 29655

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Crescent High School",'Iva=' + Iva.length); Anderson[Anderson.length] = createMarker(new GPoint(-82.65572357,34.46398544),"
Homeland Park Elementary School
3519 Wilmont St
Anderson, SC 29624

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Homeland Park Elementary School",'Anderson=' + Anderson.length); Honea_Path[Honea_Path.length] = createMarker(new GPoint(-82.38710022,34.44599915),"
Honea Path Elementary School
East Greer
Honea Path, SC 29654

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Honea Path Elementary School",'Honea_Path=' + Honea_Path.length); Honea_Path[Honea_Path.length] = createMarker(new GPoint(-82.39898682,34.44943619),"
Honea Path Middle School
107 Brock Avenue
Honea Path, SC 29654

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Honea Path Middle School",'Honea_Path=' + Honea_Path.length); Easley[Easley.length] = createMarker(new GPoint(-82.57614136,34.75707245),"
Hunt Meadows Elementary School
420 Hunt Road
Easley, SC 29642

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hunt Meadows Elementary School",'Easley=' + Easley.length); Iva[Iva.length] = createMarker(new GPoint(-82.64469910,34.30179977),"
Iva Elementary School
P O Box 268
Iva, SC 29655

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Iva Elementary School",'Iva=' + Iva.length); La_France[La_France.length] = createMarker(new GPoint(-82.76519775,34.61190033),"
La France Elementary School
P O Box 487
La France, SC 29656

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("La France Elementary School",'La_France=' + La_France.length); Anderson[Anderson.length] = createMarker(new GPoint(-82.68493652,34.50512314),"
Lakeside Middle School
115 Pearman Dairy Rd
Anderson, SC 29621

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Lakeside Middle School",'Anderson=' + Anderson.length); Belton[Belton.length] = createMarker(new GPoint(-82.50312042,34.52399826),"
Marshall Primary School
218 Bannister St
Belton, SC 29627

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Marshall Primary School",'Belton=' + Belton.length); Anderson[Anderson.length] = createMarker(new GPoint(-82.62892151,34.52540970),"
Mccants Middle School
2123 Marchbanks Avenue
Anderson, SC 29621

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Mccants Middle School",'Anderson=' + Anderson.length); Anderson[Anderson.length] = createMarker(new GPoint(-82.58155823,34.43157959),"
Mclees Elementary School
4900 Dobbins Bridge Road
Anderson, SC 29626

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mclees Elementary School",'Anderson=' + Anderson.length); Anderson[Anderson.length] = createMarker(new GPoint(-82.58155823,34.43157959),"
Midway Elementary School
1221 Harriet Circle
Anderson, SC 29621

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Midway Elementary School",'Anderson=' + Anderson.length); Anderson[Anderson.length] = createMarker(new GPoint(-82.60336304,34.49285507),"
Nevitt Forest Elementary School
1401 Bolt Drive
Anderson, SC 29621

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Nevitt Forest Elementary School",'Anderson=' + Anderson.length); Anderson[Anderson.length] = createMarker(new GPoint(-82.70677948,34.50785065),"
New Prospect Elementary School
126 New Prospect Church Road
Anderson, SC 29621

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("New Prospect Elementary School",'Anderson=' + Anderson.length); Williamston[Williamston.length] = createMarker(new GPoint(-82.46887970,34.63057327),"
Palmetto Elementary School
1 Roberts Drive
Williamston, SC 29697

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Palmetto Elementary School",'Williamston=' + Williamston.length); Williamston[Williamston.length] = createMarker(new GPoint(-82.51280212,34.62260056),"
Palmetto High School
P.o. Box 429
Williamston, SC 29697

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Palmetto High School",'Williamston=' + Williamston.length); Williamston[Williamston.length] = createMarker(new GPoint(-82.48230743,34.64509583),"
Palmetto Middle School
803 N. Hamilton St.
Williamston, SC 29697

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Palmetto Middle School",'Williamston=' + Williamston.length); Pelzer[Pelzer.length] = createMarker(new GPoint(-82.45517731,34.64293671),"
Pelzer Elementary School
30 Lebby Street
Pelzer, SC 29669

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pelzer Elementary School",'Pelzer=' + Pelzer.length); Pendleton[Pendleton.length] = createMarker(new GPoint(-82.76972961,34.65348434),"
Pendleton Elementary School
902 E. Queen Street
Pendleton, SC 29670

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pendleton Elementary School",'Pendleton=' + Pendleton.length); Pendleton[Pendleton.length] = createMarker(new GPoint(-82.75389862,34.63700104),"
Pendleton High School
Post Office Box 869
Pendleton, SC 29670

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pendleton High School",'Pendleton=' + Pendleton.length); Easley[Easley.length] = createMarker(new GPoint(-82.57614136,34.75707245),"
Powdersville Elementary School
420 Hunt Road
Easley, SC 29642

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Powdersville Elementary School",'Easley=' + Easley.length); Greenville[Greenville.length] = createMarker(new GPoint(-82.48767090,34.79447174),"
Powdersville Middle School
135 Hood Road
Greenville, SC 29611

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Powdersville Middle School",'Greenville=' + Greenville.length); Pendleton[Pendleton.length] = createMarker(new GPoint(-82.79507446,34.65449524),"
Riverside Middle School
458 Riverside Street
Pendleton, SC 29670

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Riverside Middle School",'Pendleton=' + Pendleton.length); Anderson[Anderson.length] = createMarker(new GPoint(-82.64256287,34.48989868),"
South Fant Street Elementary School
1700 S Fant St
Anderson, SC 29624

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("South Fant Street Elementary School",'Anderson=' + Anderson.length); Anderson[Anderson.length] = createMarker(new GPoint(-82.66154480,34.49077225),"
Southwood Middle School
1110 Southwood St
Anderson, SC 29624

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Southwood Middle School",'Anderson=' + Anderson.length); Piedmont[Piedmont.length] = createMarker(new GPoint(-82.54631042,34.68203354),"
Spearman Elementary School
2048 Easley Highway
Piedmont, SC 29673

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Spearman Elementary School",'Piedmont=' + Piedmont.length); Starr[Starr.length] = createMarker(new GPoint(-82.69597626,34.37686157),"
Starr Elementary School
7400 Highway 81 South
Starr, SC 29684

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Starr Elementary School",'Starr=' + Starr.length); Starr[Starr.length] = createMarker(new GPoint(-82.72509766,34.38226318),"
Starr Iva Middle School
1034 Rainey Road
Starr, SC 29684

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Starr Iva Middle School",'Starr=' + Starr.length); Anderson[Anderson.length] = createMarker(new GPoint(-82.62669373,34.56347275),"
T L Hanna High School
2600 Hwy. 81 North
Anderson, SC 29621

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("T L Hanna High School",'Anderson=' + Anderson.length); Townville[Townville.length] = createMarker(new GPoint(-82.87110138,34.53450012),"
Townville Elementary School
P O Box 10
Townville, SC 29689

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Townville Elementary School",'Townville=' + Townville.length); Anderson[Anderson.length] = createMarker(new GPoint(-82.64279938,34.46419907),"
Varennes Elementary School
1820 So. Hwy. 29
Anderson, SC 29624

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Varennes Elementary School",'Anderson=' + Anderson.length); Anderson[Anderson.length] = createMarker(new GPoint(-82.68316650,34.49821472),"
West Market Family Ed. Center
1909 Dobbins Bridge Rd.
Anderson, SC 29624

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West Market Family Ed. Center",'Anderson=' + Anderson.length); West_Pelzer[West_Pelzer.length] = createMarker(new GPoint(-82.45856476,34.65387344),"
West Pelzer Elementary School
10 Stewart St
West Pelzer, SC 29669

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West Pelzer Elementary School",'West_Pelzer=' + West_Pelzer.length); Anderson[Anderson.length] = createMarker(new GPoint(-82.69163513,34.51942825),"
Westside High School
806 Pearman Dairy Rd
Anderson, SC 29625

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Westside High School",'Anderson=' + Anderson.length); Anderson[Anderson.length] = createMarker(new GPoint(-82.67841339,34.52989960),"
Whitehall Elementary School
702 Whitehall Road
Anderson, SC 29625

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Whitehall Elementary School",'Anderson=' + Anderson.length); Williamston[Williamston.length] = createMarker(new GPoint(-82.46887970,34.63057327),"
Williamston Child Dev. Center
1a Roberts Boulevard
Williamston, SC 29697

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Williamston Child Dev. Center",'Williamston=' + Williamston.length); Piedmont[Piedmont.length] = createMarker(new GPoint(-82.40339661,34.69010162),"
Woodmont High School
150 Woodmont Road
Piedmont, SC 29673

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Woodmont High School",'Piedmont=' + Piedmont.length); Piedmont[Piedmont.length] = createMarker(new GPoint(-82.54714203,34.72302628),"
Wren Elementary School
226 Roper Road
Piedmont, SC 29673

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wren Elementary School",'Piedmont=' + Piedmont.length); Piedmont[Piedmont.length] = createMarker(new GPoint(-82.54342651,34.72110748),"
Wren High School
905 Wren School Road
Piedmont, SC 29673

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wren High School",'Piedmont=' + Piedmont.length); Piedmont[Piedmont.length] = createMarker(new GPoint(-82.54453278,34.72308731),"
Wren Middle School
1010 Wren School Road
Piedmont, SC 29673

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Wren Middle School",'Piedmont=' + Piedmont.length); Belton[Belton.length] = createMarker(new GPoint(-82.52701569,34.39945984),"
Wright Elementary School
1136 Wright School Road
Belton, SC 29627

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wright Elementary School",'Belton=' + Belton.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(Anderson); map.removeOverlays(Belton); map.removeOverlays(Easley); map.removeOverlays(Greenville); map.removeOverlays(Honea_Path); map.removeOverlays(Iva); map.removeOverlays(La_France); map.removeOverlays(Pelzer); map.removeOverlays(Pendleton); map.removeOverlays(Piedmont); map.removeOverlays(Starr); map.removeOverlays(Townville); map.removeOverlays(West_Pelzer); map.removeOverlays(Williamston); 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(Belton);map.removeOverlays(Anderson); map.removeOverlays(Belton); map.removeOverlays(Easley); map.removeOverlays(Greenville); map.removeOverlays(Honea_Path); map.removeOverlays(Iva); map.removeOverlays(La_France); map.removeOverlays(Pelzer); map.removeOverlays(Pendleton); map.removeOverlays(Piedmont); map.removeOverlays(Starr); map.removeOverlays(Townville); map.removeOverlays(West_Pelzer); map.removeOverlays(Williamston); map.addOverlays(Anderson); centerByArray(Anderson, false, false); cntMarker += Anderson.length; map.addOverlays(Belton); centerByArray(Belton, false, false); cntMarker += Belton.length; map.addOverlays(Easley); centerByArray(Easley, false, false); cntMarker += Easley.length; map.addOverlays(Greenville); centerByArray(Greenville, false, false); cntMarker += Greenville.length; map.addOverlays(Honea_Path); centerByArray(Honea_Path, false, false); cntMarker += Honea_Path.length; map.addOverlays(Iva); centerByArray(Iva, false, false); cntMarker += Iva.length; map.addOverlays(La_France); centerByArray(La_France, false, false); cntMarker += La_France.length; map.addOverlays(Pelzer); centerByArray(Pelzer, false, false); cntMarker += Pelzer.length; map.addOverlays(Pendleton); centerByArray(Pendleton, false, false); cntMarker += Pendleton.length; map.addOverlays(Piedmont); centerByArray(Piedmont, false, false); cntMarker += Piedmont.length; map.addOverlays(Starr); centerByArray(Starr, false, false); cntMarker += Starr.length; map.addOverlays(Townville); centerByArray(Townville, false, false); cntMarker += Townville.length; map.addOverlays(West_Pelzer); centerByArray(West_Pelzer, false, false); cntMarker += West_Pelzer.length; map.addOverlays(Williamston); centerByArray(Williamston, false, false); cntMarker += Williamston.length; centerByArray(Belton,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'); } }