function addMarkers() { mySelect = document.getElementById('selection'); Beaufort = [];Ridgeland = [];Bluffton = [];Laurel_Bay = [];Daufuskie_Is = [];Hilton_Head = [];Hilton_Head_Is = [];Dale = [];Burton = [];Port_Royal = [];St_Helena_Is = [];Seabrook = [];mySelect.options[mySelect.options.length] = new Option("Beaufort schools",'all=Beaufort'); mySelect.options[mySelect.options.length] = new Option("Bluffton schools",'all=Bluffton'); mySelect.options[mySelect.options.length] = new Option("Burton schools",'all=Burton'); mySelect.options[mySelect.options.length] = new Option("Dale schools",'all=Dale'); mySelect.options[mySelect.options.length] = new Option("Daufuskie Is schools",'all=Daufuskie_Is'); mySelect.options[mySelect.options.length] = new Option("Hilton Head schools",'all=Hilton_Head'); mySelect.options[mySelect.options.length] = new Option("Hilton Head Is schools",'all=Hilton_Head_Is'); mySelect.options[mySelect.options.length] = new Option("Laurel Bay schools",'all=Laurel_Bay'); mySelect.options[mySelect.options.length] = new Option("Port Royal schools",'all=Port_Royal'); mySelect.options[mySelect.options.length] = new Option("Ridgeland schools",'all=Ridgeland'); mySelect.options[mySelect.options.length] = new Option("Seabrook schools",'all=Seabrook'); mySelect.options[mySelect.options.length] = new Option("St Helena Is schools",'all=St_Helena_Is'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Beaufort[Beaufort.length] = createMarker(new GPoint(-80.74226379,32.43160248),"
Battery Creek High School
1 Blue Dolphin Drive
Beaufort, SC 29902

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Battery Creek High School",'Beaufort=' + Beaufort.length); Beaufort[Beaufort.length] = createMarker(new GPoint(-80.68196106,32.43526840),"
Beaufort Elementary School
1800 Prince Street
Beaufort, SC 29902

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Beaufort Elementary School",'Beaufort=' + Beaufort.length); Ridgeland[Ridgeland.length] = createMarker(new GPoint(-10.00000000,10.00000000),"
Beaufort Jasper Academy For Career Excel
Route 1 Box 127
Ridgeland, SC 29936

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Beaufort Jasper Academy For Career Excel",'Ridgeland=' + Ridgeland.length); Beaufort[Beaufort.length] = createMarker(new GPoint(-80.69172668,32.40066528),"
Beaufort Middle School
2501 Mossy Oaks Road
Beaufort, SC 29902

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Beaufort Middle School",'Beaufort=' + Beaufort.length); Bluffton[Bluffton.length] = createMarker(new GPoint(-80.86068726,32.23722076),"
Bluffton Elementary School
160 H E Mccracken Circle
Bluffton, SC 29910

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bluffton Elementary School",'Bluffton=' + Bluffton.length); Bluffton[Bluffton.length] = createMarker(new GPoint(-80.90128600,32.24543300),"
Bluffton High School
12 H.e. Mccracken Circle
Bluffton, SC 29910

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bluffton High School",'Bluffton=' + Bluffton.length); Beaufort[Beaufort.length] = createMarker(new GPoint(-80.75512695,32.42094040),"
Broad River Elementary School
474 Broad River Blvd
Beaufort, SC 29906

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Broad River Elementary School",'Beaufort=' + Beaufort.length); Laurel_Bay[Laurel_Bay.length] = createMarker(new GPoint(-80.78018400,32.45619500),"
Charles F. Bolden Elementary School
Laurel Bay Schools
Laurel Bay, SC 29906

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Charles F. Bolden Elementary School",'Laurel_Bay=' + Laurel_Bay.length); Beaufort[Beaufort.length] = createMarker(new GPoint(-80.64501953,32.44935989),"
Coosa Elementary School
45 Middle Rd.
Beaufort, SC 29902

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Coosa Elementary School",'Beaufort=' + Beaufort.length); Daufuskie_Is[Daufuskie_Is.length] = createMarker(new GPoint(-80.89006805,32.23725128),"
Daufuskie Island Elementary School
Post Office Box 54
Daufuskie Is, SC 29915

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Daufuskie Island Elementary School",'Daufuskie_Is=' + Daufuskie_Is.length); Hilton_Head[Hilton_Head.length] = createMarker(new GPoint(-80.73004150,32.22087479),"
H. E. Mccracken Middle School
55 Wilborn Road
Hilton Head, SC 29928

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("H. E. Mccracken Middle School",'Hilton_Head=' + Hilton_Head.length); Hilton_Head[Hilton_Head.length] = createMarker(new GPoint(-80.72333700,32.20946900),"
Hilton Head Early Childhood Center
165 Pembroke Avenue
Hilton Head, SC 29926

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hilton Head Early Childhood Center",'Hilton_Head=' + Hilton_Head.length); Hilton_Head_Is[Hilton_Head_Is.length] = createMarker(new GPoint(-80.73636627,32.21832275),"
Hilton Head Elementary School
10 Wilborn Rd.
Hilton Head Is, SC 29926

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hilton Head Elementary School",'Hilton_Head_Is=' + Hilton_Head_Is.length); Hilton_Head[Hilton_Head.length] = createMarker(new GPoint(-80.72980499,32.21909714),"
Hilton Head High School
70 Wilborn Road
Hilton Head, SC 29926

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hilton Head High School",'Hilton_Head=' + Hilton_Head.length); Hilton_Head[Hilton_Head.length] = createMarker(new GPoint(-80.73378200,32.21910400),"
Hilton Head International Baccalaureate
30 School Road
Hilton Head, SC 29926

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hilton Head International Baccalaureate",'Hilton_Head=' + Hilton_Head.length); Hilton_Head[Hilton_Head.length] = createMarker(new GPoint(-80.73004150,32.22087479),"
Hilton Head Middle School
55 Wilborn Road
Hilton Head, SC 29926

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Hilton Head Middle School",'Hilton_Head=' + Hilton_Head.length); Hilton_Head[Hilton_Head.length] = createMarker(new GPoint(-80.73238500,32.21598500),"
Hilton Head School For Creative Arts
10 Wilborn Road
Hilton Head, SC 29926

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hilton Head School For Creative Arts",'Hilton_Head=' + Hilton_Head.length); Dale[Dale.length] = createMarker(new GPoint(-80.70883942,32.55566788),"
James J Davis Elementary School
364 Kean Neck Rd.
Dale, SC 29914

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("James J Davis Elementary School",'Dale=' + Dale.length); Burton[Burton.length] = createMarker(new GPoint(-80.79409790,32.45412827),"
Joseph J. Shanklin Senior Elementary School
121 Morrall Drive
Burton, SC 29902

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Joseph J. Shanklin Senior Elementary School",'Burton=' + Burton.length); Beaufort[Beaufort.length] = createMarker(new GPoint(-97.52490000,25.92896300),"
Lady's Island Middle School
430 Cougar Drive
Beaufort, SC 29902

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Lady's Island Middle School",'Beaufort=' + Beaufort.length); Beaufort[Beaufort.length] = createMarker(new GPoint(-80.62579346,32.39646149),"
Ladys Island Elementary School
73 Chowan Creek Bluff
Beaufort, SC 29902

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ladys Island Elementary School",'Beaufort=' + Beaufort.length); Laurel_Bay[Laurel_Bay.length] = createMarker(new GPoint(-80.78343964,32.45000076),"
Laurel Bay Intermediate School
Laurel Bay Schools
Laurel Bay, SC 29906

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Laurel Bay Intermediate School",'Laurel_Bay=' + Laurel_Bay.length); Laurel_Bay[Laurel_Bay.length] = createMarker(new GPoint(-80.78343964,32.45000076),"
Laurel Bay Primary School
Laurel Bay Schools
Laurel Bay, SC 29906

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Laurel Bay Primary School",'Laurel_Bay=' + Laurel_Bay.length); Bluffton[Bluffton.length] = createMarker(new GPoint(-80.85591888,32.23305511),"
Michael C. Riley Elementary School
200 Burnt Church Rd.
Bluffton, SC 29910

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Michael C. Riley Elementary School",'Bluffton=' + Bluffton.length); Beaufort[Beaufort.length] = createMarker(new GPoint(-80.69252777,32.40046310),"
Mossy Oaks Elementary School
2510 Mossy Oaks Rd.
Beaufort, SC 29902

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mossy Oaks Elementary School",'Beaufort=' + Beaufort.length); Bluffton[Bluffton.length] = createMarker(new GPoint(-80.86389923,32.25843811),"
Okatie Elementary School
1657 Okatie Highway
Bluffton, SC 29910

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Okatie Elementary School",'Bluffton=' + Bluffton.length); Port_Royal[Port_Royal.length] = createMarker(new GPoint(-80.69243622,32.37769699),"
Port Royal Elementary School
1214 Paris Ave.
Port Royal, SC 29935

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Port Royal Elementary School",'Port_Royal=' + Port_Royal.length); Burton[Burton.length] = createMarker(new GPoint(-80.73602295,32.42585754),"
Robert Small Towns Middle School
43 W K Alston Drive
Burton, SC 29902

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Robert Small Towns Middle School",'Burton=' + Burton.length); Beaufort[Beaufort.length] = createMarker(new GPoint(-80.74255371,32.38631821),"
Shell Point Elementary School
81 Savannah Hwy.
Beaufort, SC 29902

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Shell Point Elementary School",'Beaufort=' + Beaufort.length); St_Helena_Is[St_Helena_Is.length] = createMarker(new GPoint(-80.50650024,32.44430161),"
St Helena Elementary School
1025 Saint Helena Pkwy
St. Helena Is., SC 29920

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("St Helena Elementary School",'St_Helena_Is=' + St_Helena_Is.length); Seabrook[Seabrook.length] = createMarker(new GPoint(-80.74570465,32.53169250),"
Whale Branch Elementary School
15 Stuart Point Rd
Seabrook, SC 29940

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Whale Branch Elementary School",'Seabrook=' + Seabrook.length); Burton[Burton.length] = createMarker(new GPoint(-80.73602295,32.42585754),"
Whale Branch Middle School
43 W. K. Alston Drive
Burton, SC 29902

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Whale Branch Middle School",'Burton=' + Burton.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(Beaufort); map.removeOverlays(Bluffton); map.removeOverlays(Burton); map.removeOverlays(Dale); map.removeOverlays(Daufuskie_Is); map.removeOverlays(Hilton_Head); map.removeOverlays(Hilton_Head_Is); map.removeOverlays(Laurel_Bay); map.removeOverlays(Port_Royal); map.removeOverlays(Ridgeland); map.removeOverlays(Seabrook); map.removeOverlays(St_Helena_Is); 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(Beaufort);map.removeOverlays(Beaufort); map.removeOverlays(Bluffton); map.removeOverlays(Burton); map.removeOverlays(Dale); map.removeOverlays(Daufuskie_Is); map.removeOverlays(Hilton_Head); map.removeOverlays(Hilton_Head_Is); map.removeOverlays(Laurel_Bay); map.removeOverlays(Port_Royal); map.removeOverlays(Ridgeland); map.removeOverlays(Seabrook); map.removeOverlays(St_Helena_Is); map.addOverlays(Beaufort); centerByArray(Beaufort, false, false); cntMarker += Beaufort.length; map.addOverlays(Bluffton); centerByArray(Bluffton, false, false); cntMarker += Bluffton.length; map.addOverlays(Burton); centerByArray(Burton, false, false); cntMarker += Burton.length; map.addOverlays(Dale); centerByArray(Dale, false, false); cntMarker += Dale.length; map.addOverlays(Daufuskie_Is); centerByArray(Daufuskie_Is, false, false); cntMarker += Daufuskie_Is.length; map.addOverlays(Hilton_Head); centerByArray(Hilton_Head, false, false); cntMarker += Hilton_Head.length; map.addOverlays(Hilton_Head_Is); centerByArray(Hilton_Head_Is, false, false); cntMarker += Hilton_Head_Is.length; map.addOverlays(Laurel_Bay); centerByArray(Laurel_Bay, false, false); cntMarker += Laurel_Bay.length; map.addOverlays(Port_Royal); centerByArray(Port_Royal, false, false); cntMarker += Port_Royal.length; map.addOverlays(Ridgeland); centerByArray(Ridgeland, false, false); cntMarker += Ridgeland.length; map.addOverlays(Seabrook); centerByArray(Seabrook, false, false); cntMarker += Seabrook.length; map.addOverlays(St_Helena_Is); centerByArray(St_Helena_Is, false, false); cntMarker += St_Helena_Is.length; centerByArray(Beaufort,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'); } }