function addMarkers(){ mySelect = document.getElementById('selection'); Charleston = [];Columbia = [];Mount_Pleasant = [];Hanahan = [];North_Augusta = [];Greenville = [];Myrtle_Beach = [];Rock_Hill = [];Sumter = [];Florence = [];Hilton_Head_Island = [];North_Charleston = [];Anderson = [];Aiken = [];Garden_City = [];Beaufort = [];Spartanburg = [];Summerville = [];mySelect.options[mySelect.options.length] = new Option("Aiken schools",'all=Aiken'); mySelect.options[mySelect.options.length] = new Option("Anderson schools",'all=Anderson'); mySelect.options[mySelect.options.length] = new Option("Beaufort schools",'all=Beaufort'); mySelect.options[mySelect.options.length] = new Option("Charleston schools",'all=Charleston'); mySelect.options[mySelect.options.length] = new Option("Columbia schools",'all=Columbia'); mySelect.options[mySelect.options.length] = new Option("Florence schools",'all=Florence'); mySelect.options[mySelect.options.length] = new Option("Garden City schools",'all=Garden_City'); mySelect.options[mySelect.options.length] = new Option("Greenville schools",'all=Greenville'); mySelect.options[mySelect.options.length] = new Option("Hanahan schools",'all=Hanahan'); mySelect.options[mySelect.options.length] = new Option("Hilton Head Island schools",'all=Hilton_Head_Island'); mySelect.options[mySelect.options.length] = new Option("Mount Pleasant schools",'all=Mount_Pleasant'); mySelect.options[mySelect.options.length] = new Option("Myrtle Beach schools",'all=Myrtle_Beach'); mySelect.options[mySelect.options.length] = new Option("North Augusta schools",'all=North_Augusta'); mySelect.options[mySelect.options.length] = new Option("North Charleston schools",'all=North_Charleston'); mySelect.options[mySelect.options.length] = new Option("Rock Hill schools",'all=Rock_Hill'); mySelect.options[mySelect.options.length] = new Option("Spartanburg schools",'all=Spartanburg'); mySelect.options[mySelect.options.length] = new Option("Summerville schools",'all=Summerville'); mySelect.options[mySelect.options.length] = new Option("Sumter schools",'all=Sumter'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Charleston[Charleston.length] = createMarker(new GPoint(-79.91744600,32.85734800),"
Bishop England High School
363 Seven Farms Dr
Charleston, SC 29492
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bishop England High School",'Charleston=' + Charleston.length); Charleston[Charleston.length] = createMarker(new GPoint(-79.98274900,32.78220700),"
Blessed Sacrament School
7 Saint Teresa Drive
Charleston, SC 29407
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Blessed Sacrament School",'Charleston=' + Charleston.length); Columbia[Columbia.length] = createMarker(new GPoint(-80.97109300,34.02013600),"
Cardinal Newman School
4701 Forest Drive
Columbia, SC 29206
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cardinal Newman School",'Columbia=' + Columbia.length); Charleston[Charleston.length] = createMarker(new GPoint(-79.94989200,32.80167900),"
The Charleston Catholic School
888 King Street
Charleston, SC 29403
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Charleston Catholic School",'Charleston=' + Charleston.length); Mount_Pleasant[Mount_Pleasant.length] = createMarker(new GPoint(-79.86258400,32.79517300),"
Christ Our King-stella Maris School
1183 Russell Drive
Mount Pleasant, SC 29464
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Christ Our King-stella Maris School",'Mount_Pleasant=' + Mount_Pleasant.length); Hanahan[Hanahan.length] = createMarker(new GPoint(-80.01287400,32.91956200),"
Divine Redeemer School
1104 Fort Drive
Hanahan, SC 29410
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Divine Redeemer School",'Hanahan=' + Hanahan.length); Charleston[Charleston.length] = createMarker(new GPoint(-79.96905100,32.72570000),"
Nativity School
1125 Pittsford Circle
Charleston, SC 29412
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Nativity School",'Charleston=' + Charleston.length); North_Augusta[North_Augusta.length] = createMarker(new GPoint(-81.95487600,33.50611500),"
Our Lady Of Peace
856 Old Edgefield Rd.
North Augusta, SC 29841
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Our Lady Of Peace",'North_Augusta=' + North_Augusta.length); Greenville[Greenville.length] = createMarker(new GPoint(-82.38020200,34.79868200),"
Our Lady Of The Rosary Catholic Elementary School
2 James Drive
Greenville, SC 29605
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Our Lady Of The Rosary Catholic Elementary School",'Greenville=' + Greenville.length); Myrtle_Beach[Myrtle_Beach.length] = createMarker(new GPoint(-78.85809900,33.71419900),"
St. Andrews Catholic School
3601 N Kings Highway
Myrtle Beach, SC 29577
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Andrews Catholic School",'Myrtle_Beach=' + Myrtle_Beach.length); Rock_Hill[Rock_Hill.length] = createMarker(new GPoint(-81.00087400,34.94363400),"
St. Anne Catholic School
1698 Bird Street
Rock Hill, SC 29730
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Anne Catholic School",'Rock_Hill=' + Rock_Hill.length); Sumter[Sumter.length] = createMarker(new GPoint(-80.33734900,33.91987200),"
St. Anne Elementary School
11 S Magnolia Street
Sumter, SC 29150
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Anne Elementary School",'Sumter=' + Sumter.length); Florence[Florence.length] = createMarker(new GPoint(-79.82204600,34.19909700),"
St. Anthony Catholic School
2536 W Hoffmeyer Rd
Florence, SC 29501
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Anthony Catholic School",'Florence=' + Florence.length); Hilton_Head_Island[Hilton_Head_Island.length] = createMarker(new GPoint(-80.70988300,32.22200200),"
St. Francis Catholic School
45 Beach City Road
Hilton Head Island, SC 29926
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Francis Catholic School",'Hilton_Head_Island=' + Hilton_Head_Island.length); Sumter[Sumter.length] = createMarker(new GPoint(-80.35820500,33.91869300),"
St. Francis Xavier High School
15 School Street
Sumter, SC 29150
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Francis Xavier High School",'Sumter=' + Sumter.length); North_Charleston[North_Charleston.length] = createMarker(new GPoint(-79.97846000,32.86487700),"
St. John Catholic School
3921 Saint John''s Avenue
North Charleston, SC 29405
Co-ed school, NS-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. John Catholic School",'North_Charleston=' + North_Charleston.length); Columbia[Columbia.length] = createMarker(new GPoint(-80.89095900,34.08777800),"
St. John Neumann Catholic Elementary School
721 Polo Road
Columbia, SC 29223
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. John Neumann Catholic Elementary School",'Columbia=' + Columbia.length); Anderson[Anderson.length] = createMarker(new GPoint(-82.63338400,34.52857100),"
St. Joseph Catholic School
1200 Cornelia Road
Anderson, SC 29621
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Joseph Catholic School",'Anderson=' + Anderson.length); Columbia[Columbia.length] = createMarker(new GPoint(-80.98855000,33.99675000),"
St. Joseph School
3700 Devine Street
Columbia, SC 29205
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Joseph School",'Columbia=' + Columbia.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); Columbia[Columbia.length] = createMarker(new GPoint(-81.01875800,34.01059500),"
St. Martin De Porres School
1500 Oak Street
Columbia, SC 29204
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Martin De Porres School",'Columbia=' + Columbia.length); Aiken[Aiken.length] = createMarker(new GPoint(-81.71783000,33.55955600),"
St. Mary Help Of Christians School
118 York Street Se
Aiken, SC 29801
Co-ed school, NS-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Mary Help Of Christians School",'Aiken=' + Aiken.length); Greenville[Greenville.length] = createMarker(new GPoint(-82.40263200,34.85364800),"
St. Marys School
101 Hampton Avenue
Greenville, SC 29601
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Marys School",'Greenville=' + Greenville.length); Garden_City[Garden_City.length] = createMarker(new GPoint(-79.00383900,33.58851500),"
St. Michael Catholic School
542 Cypress Avenue
Garden City, SC 29576
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Michael Catholic School",'Garden_City=' + Garden_City.length); Beaufort[Beaufort.length] = createMarker(new GPoint(-80.65265100,32.41221200),"
St. Peter-beaufort
70 Ladys Island Dr
Beaufort, SC 29902
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Peter-beaufort",'Beaufort=' + Beaufort.length); Columbia[Columbia.length] = createMarker(new GPoint(-81.03812500,34.00454600),"
St. Peters Catholic School
1035 Hampton Street
Columbia, SC 29201
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Peters Catholic School",'Columbia=' + Columbia.length); Greenville[Greenville.length] = createMarker(new GPoint(-82.41642600,34.84814900),"
St Anthony Of Padua Catholic School
309 Gower Street
Greenville, SC 29611
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Anthony Of Padua Catholic School",'Greenville=' + Greenville.length); Spartanburg[Spartanburg.length] = createMarker(new GPoint(-81.92538900,34.95250100),"
St Paul The Apostle Catholic School
152 Alabama Street
Spartanburg, SC 29302
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Paul The Apostle Catholic School",'Spartanburg=' + Spartanburg.length); Beaufort[Beaufort.length] = createMarker(new GPoint(-80.65252500,32.41230500),"
St Peters Catholic School
70 Ladys Island Drive
Beaufort, SC 29907
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Peters Catholic School",'Beaufort=' + Beaufort.length); Summerville[Summerville.length] = createMarker(new GPoint(-80.17702900,33.00639500),"
Summerville Catholic School
226 Black Oak Boulevard
Summerville, SC 29485
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Summerville Catholic School",'Summerville=' + Summerville.length); map.removeOverlays(Aiken); map.removeOverlays(Anderson); map.removeOverlays(Beaufort); map.removeOverlays(Charleston); map.removeOverlays(Columbia); map.removeOverlays(Florence); map.removeOverlays(Garden_City); map.removeOverlays(Greenville); map.removeOverlays(Hanahan); map.removeOverlays(Hilton_Head_Island); map.removeOverlays(Mount_Pleasant); map.removeOverlays(Myrtle_Beach); map.removeOverlays(North_Augusta); map.removeOverlays(North_Charleston); map.removeOverlays(Rock_Hill); map.removeOverlays(Spartanburg); map.removeOverlays(Summerville); map.removeOverlays(Sumter); setTimeout(function(){map.addOverlays(Aiken)},1000); setTimeout(function(){map.addOverlays(Anderson)},1000); setTimeout(function(){map.addOverlays(Beaufort)},1000); setTimeout(function(){map.addOverlays(Charleston)},1000); setTimeout(function(){map.addOverlays(Columbia)},1000); setTimeout(function(){map.addOverlays(Florence)},1000); setTimeout(function(){map.addOverlays(Garden_City)},1000); setTimeout(function(){map.addOverlays(Greenville)},1000); setTimeout(function(){map.addOverlays(Hanahan)},1000); setTimeout(function(){map.addOverlays(Hilton_Head_Island)},1000); setTimeout(function(){map.addOverlays(Mount_Pleasant)},1000); setTimeout(function(){map.addOverlays(Myrtle_Beach)},1000); setTimeout(function(){map.addOverlays(North_Augusta)},1000); setTimeout(function(){map.addOverlays(North_Charleston)},1000); setTimeout(function(){map.addOverlays(Rock_Hill)},1000); setTimeout(function(){map.addOverlays(Spartanburg)},1000); setTimeout(function(){map.addOverlays(Summerville)},1000); setTimeout(function(){map.addOverlays(Sumter)},1000); maxLng = -78.85809900; maxLat = 34.95250100; minLng = -82.63338400; minLat = 32.22200200; reCenterMap(); } // 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//////' + showArray); map.removeOverlays(Aiken); map.removeOverlays(Anderson); map.removeOverlays(Beaufort); map.removeOverlays(Charleston); map.removeOverlays(Columbia); map.removeOverlays(Florence); map.removeOverlays(Garden_City); map.removeOverlays(Greenville); map.removeOverlays(Hanahan); map.removeOverlays(Hilton_Head_Island); map.removeOverlays(Mount_Pleasant); map.removeOverlays(Myrtle_Beach); map.removeOverlays(North_Augusta); map.removeOverlays(North_Charleston); map.removeOverlays(Rock_Hill); map.removeOverlays(Spartanburg); map.removeOverlays(Summerville); map.removeOverlays(Sumter); 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(Charleston);map.removeOverlays(Aiken); map.removeOverlays(Anderson); map.removeOverlays(Beaufort); map.removeOverlays(Charleston); map.removeOverlays(Columbia); map.removeOverlays(Florence); map.removeOverlays(Garden_City); map.removeOverlays(Greenville); map.removeOverlays(Hanahan); map.removeOverlays(Hilton_Head_Island); map.removeOverlays(Mount_Pleasant); map.removeOverlays(Myrtle_Beach); map.removeOverlays(North_Augusta); map.removeOverlays(North_Charleston); map.removeOverlays(Rock_Hill); map.removeOverlays(Spartanburg); map.removeOverlays(Summerville); map.removeOverlays(Sumter); map.addOverlays(Aiken); centerByArray(Aiken, false, false); cntMarker += Aiken.length; map.addOverlays(Anderson); centerByArray(Anderson, false, false); cntMarker += Anderson.length; map.addOverlays(Beaufort); centerByArray(Beaufort, false, false); cntMarker += Beaufort.length; map.addOverlays(Charleston); centerByArray(Charleston, false, false); cntMarker += Charleston.length; map.addOverlays(Columbia); centerByArray(Columbia, false, false); cntMarker += Columbia.length; map.addOverlays(Florence); centerByArray(Florence, false, false); cntMarker += Florence.length; map.addOverlays(Garden_City); centerByArray(Garden_City, false, false); cntMarker += Garden_City.length; map.addOverlays(Greenville); centerByArray(Greenville, false, false); cntMarker += Greenville.length; map.addOverlays(Hanahan); centerByArray(Hanahan, false, false); cntMarker += Hanahan.length; map.addOverlays(Hilton_Head_Island); centerByArray(Hilton_Head_Island, false, false); cntMarker += Hilton_Head_Island.length; map.addOverlays(Mount_Pleasant); centerByArray(Mount_Pleasant, false, false); cntMarker += Mount_Pleasant.length; map.addOverlays(Myrtle_Beach); centerByArray(Myrtle_Beach, false, false); cntMarker += Myrtle_Beach.length; map.addOverlays(North_Augusta); centerByArray(North_Augusta, false, false); cntMarker += North_Augusta.length; map.addOverlays(North_Charleston); centerByArray(North_Charleston, false, false); cntMarker += North_Charleston.length; map.addOverlays(Rock_Hill); centerByArray(Rock_Hill, false, false); cntMarker += Rock_Hill.length; map.addOverlays(Spartanburg); centerByArray(Spartanburg, false, false); cntMarker += Spartanburg.length; map.addOverlays(Summerville); centerByArray(Summerville, false, false); cntMarker += Summerville.length; map.addOverlays(Sumter); centerByArray(Sumter, false, false); cntMarker += Sumter.length; centerByArray(Charleston,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///25473,25496,25748,25745,25741,25751,25747,25754,35714,25475,25771,25656,25756,25746,25750,25755,25737,25708,25680,25748,25752,25738,25536,25740,25513,25731,25679,25745,25706,25757,25764,25736,/all'); //window.open('/map.php?type=2&schools=25473,25496,25748,25745,25741,25751,25747,25754,35714,25475,25771,25656,25756,25746,25750,25755,25737,25708,25680,25748,25752,25738,25536,25740,25513,25731,25679,25745,25706,25757,25764,25736,&school_level=&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; }