function addMarkers(){ mySelect = document.getElementById('selection'); Charleston = [];Cross_Lanes = [];Elkview = [];Belva = [];Marmet = [];Saint_Albans = [];Saint__Albans = [];mySelect.options[mySelect.options.length] = new Option("Belva schools",'all=Belva'); mySelect.options[mySelect.options.length] = new Option("Charleston schools",'all=Charleston'); mySelect.options[mySelect.options.length] = new Option("Cross Lanes schools",'all=Cross_Lanes'); mySelect.options[mySelect.options.length] = new Option("Elkview schools",'all=Elkview'); mySelect.options[mySelect.options.length] = new Option("Marmet schools",'all=Marmet'); mySelect.options[mySelect.options.length] = new Option("Saint Albans schools",'all=Saint_Albans'); mySelect.options[mySelect.options.length] = new Option("Saint Albans schools",'all=Saint__Albans'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Charleston[Charleston.length] = createMarker(new GPoint(-81.67689800,38.34298000),"
Bible Center School
1111 Oakhurst Drive
Charleston, WV 25314
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bible Center School",'Charleston=' + Charleston.length); Charleston[Charleston.length] = createMarker(new GPoint(-81.63220000,38.34950000),"
Brookside Christian Academy
Po Box 112
Charleston, WV 25321
Co-ed school, 3-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Brookside Christian Academy",'Charleston=' + Charleston.length); Charleston[Charleston.length] = createMarker(new GPoint(-81.63370100,38.34708000),"
Charleston Catholic High School
1033 Virginia Street E
Charleston, WV 25301
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Charleston Catholic High School",'Charleston=' + Charleston.length); Charleston[Charleston.length] = createMarker(new GPoint(-81.65323400,38.35961200),"
Charleston Sda School
622 Kanawha Blvd W
Charleston, WV 25302
Co-ed school, 2-7
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Charleston Sda School",'Charleston=' + Charleston.length); Charleston[Charleston.length] = createMarker(new GPoint(-81.75530000,38.44610000),"
Christian Family Academy
Po Box 7536
Charleston, WV 25356
Co-ed school, PK-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Christian Family Academy",'Charleston=' + Charleston.length); Cross_Lanes[Cross_Lanes.length] = createMarker(new GPoint(-81.78087000,38.43696600),"
Cross Lanes Christian School
5330 Floradale Drive
Cross Lanes, WV 25313
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cross Lanes Christian School",'Cross_Lanes=' + Cross_Lanes.length); Elkview[Elkview.length] = createMarker(new GPoint(-81.47393200,38.44402900),"
Elk Valley Christian School
5110 Elk River Road North
Elkview, WV 25071
Co-ed school, NS-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Elk Valley Christian School",'Elkview=' + Elkview.length); Charleston[Charleston.length] = createMarker(new GPoint(-81.50791100,38.32334600),"
Fairhaven Christian School
689 Fairhavenuen Dr
Charleston, WV 25306
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fairhaven Christian School",'Charleston=' + Charleston.length); Belva[Belva.length] = createMarker(new GPoint(-81.17080000,38.25380000),"
Joshua Scott Boarding School
Po Box 67
Belva, WV 26656
All-boys school, K-10
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Joshua Scott Boarding School",'Belva=' + Belva.length); Marmet[Marmet.length] = createMarker(new GPoint(-81.57039300,38.24778500),"
Living Faith Christian Academy
9203 Ohio Avenue
Marmet, WV 25315
Co-ed school, PK-4
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Living Faith Christian Academy",'Marmet=' + Marmet.length); Charleston[Charleston.length] = createMarker(new GPoint(-81.62027200,38.33436500),"
Mountaineer Montessori School
308 20th Street Se
Charleston, WV 25304
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mountaineer Montessori School",'Charleston=' + Charleston.length); Charleston[Charleston.length] = createMarker(new GPoint(-81.63268600,38.34776600),"
Sacred Heart Grade School
1035 Quarrier Street
Charleston, WV 25301
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sacred Heart Grade School",'Charleston=' + Charleston.length); Charleston[Charleston.length] = createMarker(new GPoint(-81.57869600,38.32173700),"
St. Agnes School
4801 Staunton Avenue Se
Charleston, WV 25304
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Agnes School",'Charleston=' + Charleston.length); Charleston[Charleston.length] = createMarker(new GPoint(-81.65503200,38.36567500),"
St Anthony Catholic School
1027 6th Street
Charleston, WV 25302
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Anthony Catholic School",'Charleston=' + Charleston.length); Saint_Albans[Saint_Albans.length] = createMarker(new GPoint(-81.82467400,38.38427800),"
St Francis Of Assisi School
525 Holley Street
Saint Albans, WV 25177
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Francis Of Assisi School",'Saint_Albans=' + Saint_Albans.length); Charleston[Charleston.length] = createMarker(new GPoint(-81.53465900,38.22203800),"
Upper Kanawha Valley Christian School
12721 Maccorkle Avenue
Charleston, WV 25315
Co-ed school, 5-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Upper Kanawha Valley Christian School",'Charleston=' + Charleston.length); Saint__Albans[Saint__Albans.length] = createMarker(new GPoint(-81.80503000,38.38251000),"
Zion Christian Academy
2405 Grant Ave
Saint Albans, WV 25177
Co-ed school, 4-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Zion Christian Academy",'Saint__Albans=' + Saint__Albans.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(Belva); map.removeOverlays(Charleston); map.removeOverlays(Cross_Lanes); map.removeOverlays(Elkview); map.removeOverlays(Marmet); map.removeOverlays(Saint_Albans); map.removeOverlays(Saint__Albans); 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(Belva); map.removeOverlays(Charleston); map.removeOverlays(Cross_Lanes); map.removeOverlays(Elkview); map.removeOverlays(Marmet); map.removeOverlays(Saint_Albans); map.removeOverlays(Saint__Albans); map.addOverlays(Belva); centerByArray(Belva, false, false); cntMarker += Belva.length; map.addOverlays(Charleston); centerByArray(Charleston, false, false); cntMarker += Charleston.length; map.addOverlays(Cross_Lanes); centerByArray(Cross_Lanes, false, false); cntMarker += Cross_Lanes.length; map.addOverlays(Elkview); centerByArray(Elkview, false, false); cntMarker += Elkview.length; map.addOverlays(Marmet); centerByArray(Marmet, false, false); cntMarker += Marmet.length; map.addOverlays(Saint_Albans); centerByArray(Saint_Albans, false, false); cntMarker += Saint_Albans.length; map.addOverlays(Saint__Albans); centerByArray(Saint__Albans, false, false); cntMarker += Saint__Albans.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////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; }