function addMarkers(){ mySelect = document.getElementById('selection'); Huntington = [];Charleston = [];Harpers_Ferry = [];Fairmont = [];Point_Pleasant = [];Morgantown = [];Martinsburg = [];Philippi = [];Prosperity = [];Bridgeport = [];Hurricane = [];Marmet = [];Princeton = [];Oak_Hill = [];Parkersburg = [];Delbarton = [];Sophia = [];Scott_Depot = [];Beckley = [];Mac_Arthur = [];Parsons = [];mySelect.options[mySelect.options.length] = new Option("Beckley schools",'all=Beckley'); mySelect.options[mySelect.options.length] = new Option("Bridgeport schools",'all=Bridgeport'); mySelect.options[mySelect.options.length] = new Option("Charleston schools",'all=Charleston'); mySelect.options[mySelect.options.length] = new Option("Delbarton schools",'all=Delbarton'); mySelect.options[mySelect.options.length] = new Option("Fairmont schools",'all=Fairmont'); mySelect.options[mySelect.options.length] = new Option("Harpers Ferry schools",'all=Harpers_Ferry'); mySelect.options[mySelect.options.length] = new Option("Huntington schools",'all=Huntington'); mySelect.options[mySelect.options.length] = new Option("Hurricane schools",'all=Hurricane'); mySelect.options[mySelect.options.length] = new Option("Mac Arthur schools",'all=Mac_Arthur'); mySelect.options[mySelect.options.length] = new Option("Marmet schools",'all=Marmet'); mySelect.options[mySelect.options.length] = new Option("Martinsburg schools",'all=Martinsburg'); mySelect.options[mySelect.options.length] = new Option("Morgantown schools",'all=Morgantown'); mySelect.options[mySelect.options.length] = new Option("Oak Hill schools",'all=Oak_Hill'); mySelect.options[mySelect.options.length] = new Option("Parkersburg schools",'all=Parkersburg'); mySelect.options[mySelect.options.length] = new Option("Parsons schools",'all=Parsons'); mySelect.options[mySelect.options.length] = new Option("Philippi schools",'all=Philippi'); mySelect.options[mySelect.options.length] = new Option("Point Pleasant schools",'all=Point_Pleasant'); mySelect.options[mySelect.options.length] = new Option("Princeton schools",'all=Princeton'); mySelect.options[mySelect.options.length] = new Option("Prosperity schools",'all=Prosperity'); mySelect.options[mySelect.options.length] = new Option("Scott Depot schools",'all=Scott_Depot'); mySelect.options[mySelect.options.length] = new Option("Sophia schools",'all=Sophia'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Huntington[Huntington.length] = createMarker(new GPoint(-82.45789400,38.39695700),"
The Academy Of Huntington
2400 Johnstown Road
Huntington, WV 25701
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Academy Of Huntington",'Huntington=' + Huntington.length); 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); Harpers_Ferry[Harpers_Ferry.length] = createMarker(new GPoint(-77.78438100,39.28132200),"
Bolivar Christian Academy
87 Old Taylor Lane
Harpers Ferry, WV 25425
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bolivar Christian Academy",'Harpers_Ferry=' + Harpers_Ferry.length); Fairmont[Fairmont.length] = createMarker(new GPoint(-80.10630000,39.51750000),"
Calvary Christian School
28 Fellowship Drive
Fairmont, WV 26554
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Calvary Christian School",'Fairmont=' + Fairmont.length); Point_Pleasant[Point_Pleasant.length] = createMarker(new GPoint(-82.11360000,38.86390000),"
Christ Academy
Po Box 224
Point Pleasant, WV 25550
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Christ Academy",'Point_Pleasant=' + Point_Pleasant.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); Morgantown[Morgantown.length] = createMarker(new GPoint(-79.95740000,39.62760000),"
Covenant Christian School
Po Box 342 802 Greenbag Road
Morgantown, WV 26507
Co-ed school, PK-7
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Covenant Christian School",'Morgantown=' + Morgantown.length); Martinsburg[Martinsburg.length] = createMarker(new GPoint(-77.86225400,39.49658900),"
Faith Christian Academy
138 Greensburg Road
Martinsburg, WV 25404
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Faith Christian Academy",'Martinsburg=' + Martinsburg.length); Philippi[Philippi.length] = createMarker(new GPoint(-80.06076000,39.15234000),"
Feed My Sheep Christian School, Inc.
Rr 3 Box 278a1
Philippi, WV 26416
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Feed My Sheep Christian School, Inc.",'Philippi=' + Philippi.length); Prosperity[Prosperity.length] = createMarker(new GPoint(-81.19260900,37.83835000),"
Greater Beckley Christian School
Po Box 670
Prosperity, WV 25909
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Greater Beckley Christian School",'Prosperity=' + Prosperity.length); Bridgeport[Bridgeport.length] = createMarker(new GPoint(-80.25420000,39.28193400),"
Heritage Christian School Inc
225 Newton Avenue
Bridgeport, WV 26330
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Heritage Christian School Inc",'Bridgeport=' + Bridgeport.length); Morgantown[Morgantown.length] = createMarker(new GPoint(-79.89220600,39.67646700),"
Lighthouse Christian Academy
275 Canyon Road
Morgantown, WV 26508
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lighthouse Christian Academy",'Morgantown=' + Morgantown.length); Hurricane[Hurricane.length] = createMarker(new GPoint(-82.02497100,38.41867500),"
Lighthouse Christian Academy
2440 Us Route 60
Hurricane, WV 25526
Co-ed school, PK-4
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lighthouse Christian Academy",'Hurricane=' + Hurricane.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); Martinsburg[Martinsburg.length] = createMarker(new GPoint(-77.93917700,39.50084900),"
Martinsburg Christian Academy
2247 Williamsport Pike
Martinsburg, WV 25401
school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Martinsburg Christian Academy",'Martinsburg=' + Martinsburg.length); Princeton[Princeton.length] = createMarker(new GPoint(-81.06900600,37.36506000),"
Mercer Christian Academy
314 A Oakvale Road
Princeton, WV 24740
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mercer Christian Academy",'Princeton=' + Princeton.length); Oak_Hill[Oak_Hill.length] = createMarker(new GPoint(-81.10263500,37.97889700),"
Mountain View Christian School
Po Box 1246
Oak Hill, WV 25901
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mountain View Christian School",'Oak_Hill=' + Oak_Hill.length); Parkersburg[Parkersburg.length] = createMarker(new GPoint(-81.53831300,39.28595600),"
North Christian School
3109 Emerson Avenue
Parkersburg, WV 26104
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("North Christian School",'Parkersburg=' + Parkersburg.length); Delbarton[Delbarton.length] = createMarker(new GPoint(-82.15662000,37.73399300),"
Regional Christian School
Box 236
Delbarton, WV 25670
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Regional Christian School",'Delbarton=' + Delbarton.length); Sophia[Sophia.length] = createMarker(new GPoint(-81.25402900,37.70950000),"
Sophia Christian Academy
Po Box 1285
Sophia, WV 25921
Co-ed school, PK-1
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sophia Christian Academy",'Sophia=' + Sophia.length); Scott_Depot[Scott_Depot.length] = createMarker(new GPoint(-81.90300000,38.44740000),"
Teays Valley Christian School
4373 Teays Valley Road
Scott Depot, WV 25560
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Teays Valley Christian School",'Scott_Depot=' + Scott_Depot.length); Beckley[Beckley.length] = createMarker(new GPoint(-81.18764400,37.77758800),"
Trinity Christian Academy
Po Box 1123
Beckley, WV 25802
Co-ed school, PK-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Trinity Christian Academy",'Beckley=' + Beckley.length); Mac_Arthur[Mac_Arthur.length] = createMarker(new GPoint(-81.22270000,37.75500000),"
Trinity Christian Academy
Po Box 99
Mac Arthur, WV 25873
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Trinity Christian Academy",'Mac_Arthur=' + Mac_Arthur.length); Morgantown[Morgantown.length] = createMarker(new GPoint(-79.91610200,39.62002300),"
Trinity Christian School
200 Trinity Way
Morgantown, WV 26505
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Trinity Christian School",'Morgantown=' + Morgantown.length); Parsons[Parsons.length] = createMarker(new GPoint(-79.67979000,39.09929500),"
Tucker Christian Academy
222 Water St
Parsons, WV 26287
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tucker Christian Academy",'Parsons=' + Parsons.length); map.removeOverlays(Beckley); map.removeOverlays(Bridgeport); map.removeOverlays(Charleston); map.removeOverlays(Delbarton); map.removeOverlays(Fairmont); map.removeOverlays(Harpers_Ferry); map.removeOverlays(Huntington); map.removeOverlays(Hurricane); map.removeOverlays(Mac_Arthur); map.removeOverlays(Marmet); map.removeOverlays(Martinsburg); map.removeOverlays(Morgantown); map.removeOverlays(Oak_Hill); map.removeOverlays(Parkersburg); map.removeOverlays(Parsons); map.removeOverlays(Philippi); map.removeOverlays(Point_Pleasant); map.removeOverlays(Princeton); map.removeOverlays(Prosperity); map.removeOverlays(Scott_Depot); map.removeOverlays(Sophia); setTimeout(function(){map.addOverlays(Beckley)},1000); setTimeout(function(){map.addOverlays(Bridgeport)},1000); setTimeout(function(){map.addOverlays(Charleston)},1000); setTimeout(function(){map.addOverlays(Delbarton)},1000); setTimeout(function(){map.addOverlays(Fairmont)},1000); setTimeout(function(){map.addOverlays(Harpers_Ferry)},1000); setTimeout(function(){map.addOverlays(Huntington)},1000); setTimeout(function(){map.addOverlays(Hurricane)},1000); setTimeout(function(){map.addOverlays(Mac_Arthur)},1000); setTimeout(function(){map.addOverlays(Marmet)},1000); setTimeout(function(){map.addOverlays(Martinsburg)},1000); setTimeout(function(){map.addOverlays(Morgantown)},1000); setTimeout(function(){map.addOverlays(Oak_Hill)},1000); setTimeout(function(){map.addOverlays(Parkersburg)},1000); setTimeout(function(){map.addOverlays(Parsons)},1000); setTimeout(function(){map.addOverlays(Philippi)},1000); setTimeout(function(){map.addOverlays(Point_Pleasant)},1000); setTimeout(function(){map.addOverlays(Princeton)},1000); setTimeout(function(){map.addOverlays(Prosperity)},1000); setTimeout(function(){map.addOverlays(Scott_Depot)},1000); setTimeout(function(){map.addOverlays(Sophia)},1000); maxLng = -77.78438100; maxLat = 39.67646700; minLng = -82.45789400; minLat = 37.36506000; 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(Beckley); map.removeOverlays(Bridgeport); map.removeOverlays(Charleston); map.removeOverlays(Delbarton); map.removeOverlays(Fairmont); map.removeOverlays(Harpers_Ferry); map.removeOverlays(Huntington); map.removeOverlays(Hurricane); map.removeOverlays(Mac_Arthur); map.removeOverlays(Marmet); map.removeOverlays(Martinsburg); map.removeOverlays(Morgantown); map.removeOverlays(Oak_Hill); map.removeOverlays(Parkersburg); map.removeOverlays(Parsons); map.removeOverlays(Philippi); map.removeOverlays(Point_Pleasant); map.removeOverlays(Princeton); map.removeOverlays(Prosperity); map.removeOverlays(Scott_Depot); map.removeOverlays(Sophia); 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(Huntington);map.removeOverlays(Beckley); map.removeOverlays(Bridgeport); map.removeOverlays(Charleston); map.removeOverlays(Delbarton); map.removeOverlays(Fairmont); map.removeOverlays(Harpers_Ferry); map.removeOverlays(Huntington); map.removeOverlays(Hurricane); map.removeOverlays(Mac_Arthur); map.removeOverlays(Marmet); map.removeOverlays(Martinsburg); map.removeOverlays(Morgantown); map.removeOverlays(Oak_Hill); map.removeOverlays(Parkersburg); map.removeOverlays(Parsons); map.removeOverlays(Philippi); map.removeOverlays(Point_Pleasant); map.removeOverlays(Princeton); map.removeOverlays(Prosperity); map.removeOverlays(Scott_Depot); map.removeOverlays(Sophia); map.addOverlays(Beckley); centerByArray(Beckley, false, false); cntMarker += Beckley.length; map.addOverlays(Bridgeport); centerByArray(Bridgeport, false, false); cntMarker += Bridgeport.length; map.addOverlays(Charleston); centerByArray(Charleston, false, false); cntMarker += Charleston.length; map.addOverlays(Delbarton); centerByArray(Delbarton, false, false); cntMarker += Delbarton.length; map.addOverlays(Fairmont); centerByArray(Fairmont, false, false); cntMarker += Fairmont.length; map.addOverlays(Harpers_Ferry); centerByArray(Harpers_Ferry, false, false); cntMarker += Harpers_Ferry.length; map.addOverlays(Huntington); centerByArray(Huntington, false, false); cntMarker += Huntington.length; map.addOverlays(Hurricane); centerByArray(Hurricane, false, false); cntMarker += Hurricane.length; map.addOverlays(Mac_Arthur); centerByArray(Mac_Arthur, false, false); cntMarker += Mac_Arthur.length; map.addOverlays(Marmet); centerByArray(Marmet, false, false); cntMarker += Marmet.length; map.addOverlays(Martinsburg); centerByArray(Martinsburg, false, false); cntMarker += Martinsburg.length; map.addOverlays(Morgantown); centerByArray(Morgantown, false, false); cntMarker += Morgantown.length; map.addOverlays(Oak_Hill); centerByArray(Oak_Hill, false, false); cntMarker += Oak_Hill.length; map.addOverlays(Parkersburg); centerByArray(Parkersburg, false, false); cntMarker += Parkersburg.length; map.addOverlays(Parsons); centerByArray(Parsons, false, false); cntMarker += Parsons.length; map.addOverlays(Philippi); centerByArray(Philippi, false, false); cntMarker += Philippi.length; map.addOverlays(Point_Pleasant); centerByArray(Point_Pleasant, false, false); cntMarker += Point_Pleasant.length; map.addOverlays(Princeton); centerByArray(Princeton, false, false); cntMarker += Princeton.length; map.addOverlays(Prosperity); centerByArray(Prosperity, false, false); cntMarker += Prosperity.length; map.addOverlays(Scott_Depot); centerByArray(Scott_Depot, false, false); cntMarker += Scott_Depot.length; map.addOverlays(Sophia); centerByArray(Sophia, false, false); cntMarker += Sophia.length; centerByArray(Huntington,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///33781,29257,29327,29250,29244,29271,29292,29290,29361,29305,29363,29255,29293,29276,29356,33781,29278,29242,29257,29327,29250,29244,33782,29287,29360,33779,29271,29292,29263,29290,29361,29305,29314,29363,29272,29255,29293,29276,29356,33780,/all'); //window.open('/map.php?type=2&schools=33781,29257,29327,29250,29244,29271,29292,29290,29361,29305,29363,29255,29293,29276,29356,33781,29278,29242,29257,29327,29250,29244,33782,29287,29360,33779,29271,29292,29263,29290,29361,29305,29314,29363,29272,29255,29293,29276,29356,33780,&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; }