function addMarkers(){ mySelect = document.getElementById('selection'); Leland = [];Yadkinville = [];Henderson = [];North_Wilkesboro = [];Pembroke = [];Concord = [];Fayetteville = [];Charlotte = [];Ruffin = [];Jacksonville = [];Hickory = [];Huntersville = [];Red_Springs = [];mySelect.options[mySelect.options.length] = new Option("Charlotte schools",'all=Charlotte'); mySelect.options[mySelect.options.length] = new Option("Concord schools",'all=Concord'); mySelect.options[mySelect.options.length] = new Option("Fayetteville schools",'all=Fayetteville'); mySelect.options[mySelect.options.length] = new Option("Henderson schools",'all=Henderson'); mySelect.options[mySelect.options.length] = new Option("Hickory schools",'all=Hickory'); mySelect.options[mySelect.options.length] = new Option("Huntersville schools",'all=Huntersville'); mySelect.options[mySelect.options.length] = new Option("Jacksonville schools",'all=Jacksonville'); mySelect.options[mySelect.options.length] = new Option("Leland schools",'all=Leland'); mySelect.options[mySelect.options.length] = new Option("North Wilkesboro schools",'all=North_Wilkesboro'); mySelect.options[mySelect.options.length] = new Option("Pembroke schools",'all=Pembroke'); mySelect.options[mySelect.options.length] = new Option("Red Springs schools",'all=Red_Springs'); mySelect.options[mySelect.options.length] = new Option("Ruffin schools",'all=Ruffin'); mySelect.options[mySelect.options.length] = new Option("Yadkinville schools",'all=Yadkinville'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Leland[Leland.length] = createMarker(new GPoint(-78.05980000,34.23990000),"
Emmanuel Christian Academy
Po Box 476
Leland, NC 28451
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Emmanuel Christian Academy",'Leland=' + Leland.length); Yadkinville[Yadkinville.length] = createMarker(new GPoint(-80.63640000,36.11810000),"
Faith Fellowship School
Po Box 1279
Yadkinville, NC 27055
Co-ed school, PK-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Faith Fellowship School",'Yadkinville=' + Yadkinville.length); Henderson[Henderson.length] = createMarker(new GPoint(-78.38687200,36.31073700),"
Great Beginnings Christian Ccc
905 Americal Road
Henderson, NC 27537
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Great Beginnings Christian Ccc",'Henderson=' + Henderson.length); North_Wilkesboro[North_Wilkesboro.length] = createMarker(new GPoint(-81.14130400,36.16251600),"
Harvest Time Christian Academy
501 C Street
North Wilkesboro, NC 28659
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Harvest Time Christian Academy",'North_Wilkesboro=' + North_Wilkesboro.length); Pembroke[Pembroke.length] = createMarker(new GPoint(-79.18470000,34.69290000),"
Mount Zion Christian Academy
9709 Nc Highway 72
Pembroke, NC 28372
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mount Zion Christian Academy",'Pembroke=' + Pembroke.length); Concord[Concord.length] = createMarker(new GPoint(-80.64536500,35.41393400),"
New Life Christian Academy
4065 Poplar Tent Road
Concord, NC 28027
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Life Christian Academy",'Concord=' + Concord.length); Fayetteville[Fayetteville.length] = createMarker(new GPoint(-78.87982600,35.11710300),"
Northwood Temple Academy
4200 Ramsey Street
Fayetteville, NC 28311
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Northwood Temple Academy",'Fayetteville=' + Fayetteville.length); Charlotte[Charlotte.length] = createMarker(new GPoint(-80.91113300,35.24837400),"
Paw Creek Christian Academy
5110 Tuckaseegee Road
Charlotte, NC 28208
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Paw Creek Christian Academy",'Charlotte=' + Charlotte.length); Ruffin[Ruffin.length] = createMarker(new GPoint(-79.62905400,36.49661400),"
Rhema Christian Academy
6901 Nc Highway 700
Ruffin, NC 27326
Co-ed school, PK-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Rhema Christian Academy",'Ruffin=' + Ruffin.length); Jacksonville[Jacksonville.length] = createMarker(new GPoint(-77.23890000,34.66890000),"
Shiloh Institute Of Learning
Po Box 286
Jacksonville, NC 28541
Co-ed school, K-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Shiloh Institute Of Learning",'Jacksonville=' + Jacksonville.length); Hickory[Hickory.length] = createMarker(new GPoint(-81.34130000,35.73300000),"
Solid Rock Christian Academy
Po Box 10066
Hickory, NC 28603
Co-ed school, PK-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Solid Rock Christian Academy",'Hickory=' + Hickory.length); Huntersville[Huntersville.length] = createMarker(new GPoint(-80.93501700,35.42942000),"
South Lake Christian Academy
13901 Haggers Fairy Rd
Huntersville, NC 28078
Co-ed school, KG-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("South Lake Christian Academy",'Huntersville=' + Huntersville.length); Red_Springs[Red_Springs.length] = createMarker(new GPoint(-79.21210000,34.83920000),"
United Pentecostal Christian School
Po Box 368
Red Springs, NC 28377
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("United Pentecostal Christian School",'Red_Springs=' + Red_Springs.length); map.removeOverlays(Charlotte); map.removeOverlays(Concord); map.removeOverlays(Fayetteville); map.removeOverlays(Henderson); map.removeOverlays(Hickory); map.removeOverlays(Huntersville); map.removeOverlays(Jacksonville); map.removeOverlays(Leland); map.removeOverlays(North_Wilkesboro); map.removeOverlays(Pembroke); map.removeOverlays(Red_Springs); map.removeOverlays(Ruffin); map.removeOverlays(Yadkinville); setTimeout(function(){map.addOverlays(Charlotte)},1000); setTimeout(function(){map.addOverlays(Concord)},1000); setTimeout(function(){map.addOverlays(Fayetteville)},1000); setTimeout(function(){map.addOverlays(Henderson)},1000); setTimeout(function(){map.addOverlays(Hickory)},1000); setTimeout(function(){map.addOverlays(Huntersville)},1000); setTimeout(function(){map.addOverlays(Jacksonville)},1000); setTimeout(function(){map.addOverlays(Leland)},1000); setTimeout(function(){map.addOverlays(North_Wilkesboro)},1000); setTimeout(function(){map.addOverlays(Pembroke)},1000); setTimeout(function(){map.addOverlays(Red_Springs)},1000); setTimeout(function(){map.addOverlays(Ruffin)},1000); setTimeout(function(){map.addOverlays(Yadkinville)},1000); maxLng = -77.23890000; maxLat = 36.49661400; minLng = -81.34130000; minLat = 34.23990000; 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(Charlotte); map.removeOverlays(Concord); map.removeOverlays(Fayetteville); map.removeOverlays(Henderson); map.removeOverlays(Hickory); map.removeOverlays(Huntersville); map.removeOverlays(Jacksonville); map.removeOverlays(Leland); map.removeOverlays(North_Wilkesboro); map.removeOverlays(Pembroke); map.removeOverlays(Red_Springs); map.removeOverlays(Ruffin); map.removeOverlays(Yadkinville); 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(Leland);map.removeOverlays(Charlotte); map.removeOverlays(Concord); map.removeOverlays(Fayetteville); map.removeOverlays(Henderson); map.removeOverlays(Hickory); map.removeOverlays(Huntersville); map.removeOverlays(Jacksonville); map.removeOverlays(Leland); map.removeOverlays(North_Wilkesboro); map.removeOverlays(Pembroke); map.removeOverlays(Red_Springs); map.removeOverlays(Ruffin); map.removeOverlays(Yadkinville); map.addOverlays(Charlotte); centerByArray(Charlotte, false, false); cntMarker += Charlotte.length; map.addOverlays(Concord); centerByArray(Concord, false, false); cntMarker += Concord.length; map.addOverlays(Fayetteville); centerByArray(Fayetteville, false, false); cntMarker += Fayetteville.length; map.addOverlays(Henderson); centerByArray(Henderson, false, false); cntMarker += Henderson.length; map.addOverlays(Hickory); centerByArray(Hickory, false, false); cntMarker += Hickory.length; map.addOverlays(Huntersville); centerByArray(Huntersville, false, false); cntMarker += Huntersville.length; map.addOverlays(Jacksonville); centerByArray(Jacksonville, false, false); cntMarker += Jacksonville.length; map.addOverlays(Leland); centerByArray(Leland, false, false); cntMarker += Leland.length; map.addOverlays(North_Wilkesboro); centerByArray(North_Wilkesboro, false, false); cntMarker += North_Wilkesboro.length; map.addOverlays(Pembroke); centerByArray(Pembroke, false, false); cntMarker += Pembroke.length; map.addOverlays(Red_Springs); centerByArray(Red_Springs, false, false); cntMarker += Red_Springs.length; map.addOverlays(Ruffin); centerByArray(Ruffin, false, false); cntMarker += Ruffin.length; map.addOverlays(Yadkinville); centerByArray(Yadkinville, false, false); cntMarker += Yadkinville.length; centerByArray(Leland,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///21087,21070,21146,21150,20875,20952,21037,21244,32743,20891,21087,21062,21070,32753,21146,21150,21141,20875,20952,21037,21244,32743,20891,/all'); //window.open('/map.php?type=2&schools=21087,21070,21146,21150,20875,20952,21037,21244,32743,20891,21087,21062,21070,32753,21146,21150,21141,20875,20952,21037,21244,32743,20891,&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; }