function addMarkers() { mySelect = document.getElementById('selection'); Moncks_Corner = [];Goose_Creek = [];Huger = [];Ladson = [];Cross = [];Hanahan = [];St_Stephen = [];Ridgeville = [];Summerville = [];mySelect.options[mySelect.options.length] = new Option("Cross schools",'all=Cross'); mySelect.options[mySelect.options.length] = new Option("Goose Creek schools",'all=Goose_Creek'); mySelect.options[mySelect.options.length] = new Option("Hanahan schools",'all=Hanahan'); mySelect.options[mySelect.options.length] = new Option("Huger schools",'all=Huger'); mySelect.options[mySelect.options.length] = new Option("Ladson schools",'all=Ladson'); mySelect.options[mySelect.options.length] = new Option("Moncks Corner schools",'all=Moncks_Corner'); mySelect.options[mySelect.options.length] = new Option("Ridgeville schools",'all=Ridgeville'); mySelect.options[mySelect.options.length] = new Option("St Stephen schools",'all=St_Stephen'); mySelect.options[mySelect.options.length] = new Option("Summerville schools",'all=Summerville'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Moncks_Corner[Moncks_Corner.length] = createMarker(new GPoint(-80.05429077,33.20594788),"
Berkeley Elementary School
715 Hwy. 6
Moncks Corner, SC 29461

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Berkeley Elementary School",'Moncks_Corner=' + Moncks_Corner.length); Moncks_Corner[Moncks_Corner.length] = createMarker(new GPoint(-80.02739716,33.20096970),"
Berkeley High School
406 West Main Street
Moncks Corner, SC 29461

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Berkeley High School",'Moncks_Corner=' + Moncks_Corner.length); Moncks_Corner[Moncks_Corner.length] = createMarker(new GPoint(-79.99664307,33.20051575),"
Berkeley Middle School
320 North Live Oak Drive
Moncks Corner, SC 29461

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Berkeley Middle School",'Moncks_Corner=' + Moncks_Corner.length); Moncks_Corner[Moncks_Corner.length] = createMarker(new GPoint(-79.89726257,33.26709366),"
Bonner Elementary School
171 Macedonia Foxes Cr.
Moncks Corner, SC 29461

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bonner Elementary School",'Moncks_Corner=' + Moncks_Corner.length); Goose_Creek[Goose_Creek.length] = createMarker(new GPoint(-80.02895355,33.02434921),"
Boulder Bluff Elementary School
400 Judy Drive
Goose Creek, SC 29445

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Boulder Bluff Elementary School",'Goose_Creek=' + Goose_Creek.length); Huger[Huger.length] = createMarker(new GPoint(-79.85047913,33.01530838),"
Cainhoy Elementary Middle School
2434 Cainhoy Road
Huger, SC 29450

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cainhoy Elementary Middle School",'Huger=' + Huger.length); Ladson[Ladson.length] = createMarker(new GPoint(-80.09127808,33.01526642),"
College Park Elementary School
100 Davidson Dr.
Ladson, SC 29456

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("College Park Elementary School",'Ladson=' + Ladson.length); Ladson[Ladson.length] = createMarker(new GPoint(-80.08876038,33.01836777),"
College Park Middle School
713 College Park Rd
Ladson, SC 29456

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("College Park Middle School",'Ladson=' + Ladson.length); Cross[Cross.length] = createMarker(new GPoint(-80.16666412,33.30036545),"
Cross Elementary School
1325 Ranger Drive
Cross, SC 29436

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cross Elementary School",'Cross=' + Cross.length); Cross[Cross.length] = createMarker(new GPoint(-80.16362000,33.35206985),"
Cross High School
1293 Old Hwy. 6
Cross, SC 29436

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cross High School",'Cross=' + Cross.length); Goose_Creek[Goose_Creek.length] = createMarker(new GPoint(-80.07450867,33.03898239),"
Devon Forest Elementary School
1127 Dorothy Street
Goose Creek, SC 29445

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Devon Forest Elementary School",'Goose_Creek=' + Goose_Creek.length); Goose_Creek[Goose_Creek.length] = createMarker(new GPoint(-80.01730347,32.97211075),"
Goose Creek High School
1137 Redbank Road
Goose Creek, SC 29445

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Goose Creek High School",'Goose_Creek=' + Goose_Creek.length); Goose_Creek[Goose_Creek.length] = createMarker(new GPoint(-80.02760315,32.99649811),"
Goose Creek Primary
200 Foster Creek Road
Goose Creek, SC 29445

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Goose Creek Primary",'Goose_Creek=' + Goose_Creek.length); Hanahan[Hanahan.length] = createMarker(new GPoint(-80.02998352,32.93658447),"
Hanahan Elementary School
4000 Maybeline Road
Hanahan, SC 29406

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hanahan Elementary School",'Hanahan=' + Hanahan.length); Hanahan[Hanahan.length] = createMarker(new GPoint(-80.04588100,32.96497200),"
Hanahan High School
6015 Murray Dr
Hanahan, SC 29406

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hanahan High School",'Hanahan=' + Hanahan.length); Hanahan[Hanahan.length] = createMarker(new GPoint(-79.99347687,32.90804672),"
Hanahan Middle School
5815 Murray Drive
Hanahan, SC 29406

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Hanahan Middle School",'Hanahan=' + Hanahan.length); Goose_Creek[Goose_Creek.length] = createMarker(new GPoint(-80.02901459,32.97971725),"
Howe Hall Elememtary School
115 Howe Hall Rd.
Goose Creek, SC 29445

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Howe Hall Elememtary School",'Goose_Creek=' + Goose_Creek.length); St_Stephen[St_Stephen.length] = createMarker(new GPoint(-79.95810699,33.35953903),"
J K Gourdin Elementary School
2205 Hwy 35
St Stephen, SC 29479

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("J K Gourdin Elementary School",'St_Stephen=' + St_Stephen.length); Ridgeville[Ridgeville.length] = createMarker(new GPoint(-80.31511688,33.09542847),"
Macdougall Youth Correctional Center
Route 1 Box 1178
Ridgeville, SC 29417

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Macdougall Youth Correctional Center",'Ridgeville=' + Ridgeville.length); Moncks_Corner[Moncks_Corner.length] = createMarker(new GPoint(-79.89640045,33.26630783),"
Macedonia Middle School
200 Macdeonia Foxes Cr.
Moncks Corner, SC 29461

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Macedonia Middle School",'Moncks_Corner=' + Moncks_Corner.length); Goose_Creek[Goose_Creek.length] = createMarker(new GPoint(-79.97716522,32.96785355),"
Marrington Elementary School
101 Gearing Street
Goose Creek, SC 29445

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Marrington Elementary School",'Goose_Creek=' + Goose_Creek.length); Goose_Creek[Goose_Creek.length] = createMarker(new GPoint(-79.97716522,32.96791840),"
Marrington Middle School
109 Gearing Street
Goose Creek, SC 29445

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Marrington Middle School",'Goose_Creek=' + Goose_Creek.length); Goose_Creek[Goose_Creek.length] = createMarker(new GPoint(-79.98644257,32.97504044),"
Menriv Park Elementary School
O Pulaski St
Goose Creek, SC 29445

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Menriv Park Elementary School",'Goose_Creek=' + Goose_Creek.length); Summerville[Summerville.length] = createMarker(new GPoint(-80.10937500,33.03429794),"
Sangaree Intermediate
201 School House Lane
Summerville, SC 29483

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Sangaree Intermediate",'Summerville=' + Summerville.length); Ladson[Ladson.length] = createMarker(new GPoint(-80.10751300,33.02673400),"
Sangaree Middle School
1050 Discovery Lane
Ladson, SC 29456

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Sangaree Middle School",'Ladson=' + Ladson.length); Goose_Creek[Goose_Creek.length] = createMarker(new GPoint(-80.01424408,32.97570801),"
Sedgefield Intermediate
225 Garwood Drive
Goose Creek, SC 29445

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Sedgefield Intermediate",'Goose_Creek=' + Goose_Creek.length); Goose_Creek[Goose_Creek.length] = createMarker(new GPoint(-80.03278351,32.98069000),"
Sedgefield Middle School
Charles Gibson Blvd
Goose Creek, SC 29445

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Sedgefield Middle School",'Goose_Creek=' + Goose_Creek.length); St_Stephen[St_Stephen.length] = createMarker(new GPoint(-79.91480255,33.38679886),"
St Stephen Elementary School
Post Office Box 338
St Stephen, SC 29479

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("St Stephen Elementary School",'St_Stephen=' + St_Stephen.length); St_Stephen[St_Stephen.length] = createMarker(new GPoint(-79.93319702,33.40628052),"
St Stephen Middle School
225 Carolina Ave
St Stephen, SC 29479

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("St Stephen Middle School",'St_Stephen=' + St_Stephen.length); St_Stephen[St_Stephen.length] = createMarker(new GPoint(-79.91779327,33.32717133),"
Timberland High School
1418 Gravel Hill Road
St. Stephen, SC 29479

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Timberland High School",'St_Stephen=' + St_Stephen.length); Goose_Creek[Goose_Creek.length] = createMarker(new GPoint(-80.04701233,33.00317764),"
Westview Intermediate
100 Westview Blvd
Goose Creek, SC 29445

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Westview Intermediate",'Goose_Creek=' + Goose_Creek.length); Goose_Creek[Goose_Creek.length] = createMarker(new GPoint(-80.04690552,33.00291443),"
Westview Middle School
101 Westview Blvd
Goose Creek, SC 29445

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Westview Middle School",'Goose_Creek=' + Goose_Creek.length); Goose_Creek[Goose_Creek.length] = createMarker(new GPoint(-80.04664612,33.00333786),"
Westview Primary
98 Westview Blvd.
Goose Creek, SC 29445

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Westview Primary",'Goose_Creek=' + Goose_Creek.length); Moncks_Corner[Moncks_Corner.length] = createMarker(new GPoint(-80.04993439,33.15197372),"
Whitesville Elementary School
324 Gaillard Street
Moncks Corner, SC 29461

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Whitesville Elementary School",'Moncks_Corner=' + Moncks_Corner.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(Cross); map.removeOverlays(Goose_Creek); map.removeOverlays(Hanahan); map.removeOverlays(Huger); map.removeOverlays(Ladson); map.removeOverlays(Moncks_Corner); map.removeOverlays(Ridgeville); map.removeOverlays(St_Stephen); map.removeOverlays(Summerville); 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(Moncks_Corner);map.removeOverlays(Cross); map.removeOverlays(Goose_Creek); map.removeOverlays(Hanahan); map.removeOverlays(Huger); map.removeOverlays(Ladson); map.removeOverlays(Moncks_Corner); map.removeOverlays(Ridgeville); map.removeOverlays(St_Stephen); map.removeOverlays(Summerville); map.addOverlays(Cross); centerByArray(Cross, false, false); cntMarker += Cross.length; map.addOverlays(Goose_Creek); centerByArray(Goose_Creek, false, false); cntMarker += Goose_Creek.length; map.addOverlays(Hanahan); centerByArray(Hanahan, false, false); cntMarker += Hanahan.length; map.addOverlays(Huger); centerByArray(Huger, false, false); cntMarker += Huger.length; map.addOverlays(Ladson); centerByArray(Ladson, false, false); cntMarker += Ladson.length; map.addOverlays(Moncks_Corner); centerByArray(Moncks_Corner, false, false); cntMarker += Moncks_Corner.length; map.addOverlays(Ridgeville); centerByArray(Ridgeville, false, false); cntMarker += Ridgeville.length; map.addOverlays(St_Stephen); centerByArray(St_Stephen, false, false); cntMarker += St_Stephen.length; map.addOverlays(Summerville); centerByArray(Summerville, false, false); cntMarker += Summerville.length; centerByArray(Moncks_Corner,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'); } }