function addMarkers(){ mySelect = document.getElementById('selection'); Aiken = [];North_Augusta = [];Clearwater = [];Graniteville = [];N_Augusta = [];mySelect.options[mySelect.options.length] = new Option("Aiken schools",'all=Aiken'); mySelect.options[mySelect.options.length] = new Option("Clearwater schools",'all=Clearwater'); mySelect.options[mySelect.options.length] = new Option("Graniteville schools",'all=Graniteville'); mySelect.options[mySelect.options.length] = new Option("N Augusta schools",'all=N_Augusta'); mySelect.options[mySelect.options.length] = new Option("North Augusta schools",'all=North_Augusta'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Aiken[Aiken.length] = createMarker(new GPoint(-81.72637700,33.56487300),"
Aiken Preparatory School
619 Barnwell Avenue NW
Aiken, SC 29801
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Aiken Preparatory School",'Aiken=' + Aiken.length); North_Augusta[North_Augusta.length] = createMarker(new GPoint(-81.96718400,33.50407000),"
Fairview Presbyterian Early Childhood Center
308 W Martintown Road
North Augusta, SC 29841
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fairview Presbyterian Early Childhood Center",'North_Augusta=' + North_Augusta.length); North_Augusta[North_Augusta.length] = createMarker(new GPoint(-81.97003500,33.49542900),"
First Baptist Ch Kg Of N Augus
625 Georgia Avenue
North Augusta, SC 29841
Co-ed school, K-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("First Baptist Ch Kg Of N Augus",'North_Augusta=' + North_Augusta.length); Aiken[Aiken.length] = createMarker(new GPoint(-81.72230900,33.56170000),"
First Baptist Church Kindergarten
Po Box 3157
Aiken, SC 29802
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("First Baptist Church Kindergarten",'Aiken=' + Aiken.length); Aiken[Aiken.length] = createMarker(new GPoint(-81.72022400,33.56345100),"
First Presbyterian Church Preschool
224 Barnwell Avenue Nw
Aiken, SC 29801
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("First Presbyterian Church Preschool",'Aiken=' + Aiken.length); North_Augusta[North_Augusta.length] = createMarker(new GPoint(-81.96998700,33.49560000),"
Grace Child Development Center
639 Georgia Avenue
North Augusta, SC 29841
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Grace Child Development Center",'North_Augusta=' + North_Augusta.length); Aiken[Aiken.length] = createMarker(new GPoint(-81.72438100,33.56157300),"
Mead Hall Episcopal School
129 Pendleton Street, SW
Aiken, SC 29801
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mead Hall Episcopal School",'Aiken=' + Aiken.length); Clearwater[Clearwater.length] = createMarker(new GPoint(-81.89297300,33.49635500),"
Midland Valley Christian Academy
Po Box 645
Clearwater, SC 29822
Co-ed school, PK-2
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Midland Valley Christian Academy",'Clearwater=' + Clearwater.length); Graniteville[Graniteville.length] = createMarker(new GPoint(-81.80339200,33.55664400),"
Minnie Palmore House Learning Center
283 Ap Nivens Street
Graniteville, SC 29829
Co-ed school, PK-2
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Minnie Palmore House Learning Center",'Graniteville=' + Graniteville.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); 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); Aiken[Aiken.length] = createMarker(new GPoint(-81.72040000,33.56660000),"
Second Baptist Christian Preparatory School
353 Laurens Street
Aiken, SC 29801
Co-ed school, PK-4
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Second Baptist Christian Preparatory School",'Aiken=' + Aiken.length); Aiken[Aiken.length] = createMarker(new GPoint(-81.72746900,33.51597300),"
South Aiken Baptist Christian School
980 Dougherty Road
Aiken, SC 29803
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("South Aiken Baptist Christian School",'Aiken=' + Aiken.length); Aiken[Aiken.length] = createMarker(new GPoint(-81.72361900,33.53008600),"
South Aiken Presbyterian Kindergarten
1711 Whiskey Road
Aiken, SC 29803
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("South Aiken Presbyterian Kindergarten",'Aiken=' + Aiken.length); Aiken[Aiken.length] = createMarker(new GPoint(-81.72025800,33.56123700),"
St John's Methodist Kindergarten
104 Newberry Street Nw
Aiken, SC 29801
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St John's Methodist Kindergarten",'Aiken=' + Aiken.length); North_Augusta[North_Augusta.length] = createMarker(new GPoint(-81.97926900,33.51519800),"
Victory Christian School
620 W Martintown Road
North Augusta, SC 29841
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Victory Christian School",'North_Augusta=' + North_Augusta.length); N_Augusta[N_Augusta.length] = createMarker(new GPoint(-81.97615200,33.53441400),"
Walden Hall/solomon's Christia
1896 Knobcone Ave
N Augusta, SC 29841
Co-ed school, PK-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Walden Hall/solomon's Christia",'N_Augusta=' + N_Augusta.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,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/////1/' + showArray); map.removeOverlays(Aiken); map.removeOverlays(Clearwater); map.removeOverlays(Graniteville); map.removeOverlays(N_Augusta); map.removeOverlays(North_Augusta); 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(Aiken);map.removeOverlays(Aiken); map.removeOverlays(Clearwater); map.removeOverlays(Graniteville); map.removeOverlays(N_Augusta); map.removeOverlays(North_Augusta); map.addOverlays(Aiken); centerByArray(Aiken, false, false); cntMarker += Aiken.length; map.addOverlays(Clearwater); centerByArray(Clearwater, false, false); cntMarker += Clearwater.length; map.addOverlays(Graniteville); centerByArray(Graniteville, false, false); cntMarker += Graniteville.length; map.addOverlays(N_Augusta); centerByArray(N_Augusta, false, false); cntMarker += N_Augusta.length; map.addOverlays(North_Augusta); centerByArray(North_Augusta, false, false); cntMarker += North_Augusta.length; centerByArray(Aiken,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'); //window.open('/map.php?type=1&schools=&school_level=1&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; }