function addMarkers()
{
mySelect = document.getElementById('selection');
Winston_Salem = [];Winston_salem = [];Kernersville = [];Clemmons = [];Lewisville = [];Walkertown = [];Tobaccoville = [];Pfafftown = [];Rural_Hall = [];mySelect.options[mySelect.options.length] = new Option("Clemmons schools",'all=Clemmons');
mySelect.options[mySelect.options.length] = new Option("Kernersville schools",'all=Kernersville');
mySelect.options[mySelect.options.length] = new Option("Lewisville schools",'all=Lewisville');
mySelect.options[mySelect.options.length] = new Option("Pfafftown schools",'all=Pfafftown');
mySelect.options[mySelect.options.length] = new Option("Rural Hall schools",'all=Rural_Hall');
mySelect.options[mySelect.options.length] = new Option("Tobaccoville schools",'all=Tobaccoville');
mySelect.options[mySelect.options.length] = new Option("Walkertown schools",'all=Walkertown');
mySelect.options[mySelect.options.length] = new Option("Winston Salem schools",'all=Winston_Salem');
mySelect.options[mySelect.options.length] = new Option("Winston salem schools",'all=Winston_salem');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.26432037,36.03951645),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("12th Street Academy",'Winston_Salem=' + Winston_Salem.length);
Winston_salem[Winston_salem.length] = createMarker(new GPoint(-80.24420166,36.10419846),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Arts Based Elementary School",'Winston_salem=' + Winston_salem.length);
Winston_salem[Winston_salem.length] = createMarker(new GPoint(-80.22431183,36.11843872),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Ashley Elementary School",'Winston_salem=' + Winston_salem.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.29011536,36.07463455),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bolton Elementary School",'Winston_Salem=' + Winston_Salem.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.26552582,36.09478760),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Brunson Elementary School",'Winston_Salem=' + Winston_Salem.length);
Winston_salem[Winston_salem.length] = createMarker(new GPoint(-80.23118591,36.06729126),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("C G Woodson Sch Of Challenge",'Winston_salem=' + Winston_salem.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.30999756,36.06549835),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Career Center",'Winston_Salem=' + Winston_Salem.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.20881653,36.13463211),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Carver High School",'Winston_Salem=' + Winston_Salem.length);
Kernersville[Kernersville.length] = createMarker(new GPoint(-80.12179565,36.13777161),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Cash Elementary School",'Kernersville=' + Kernersville.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.27966309,36.11649323),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Children's Center",'Winston_Salem=' + Winston_Salem.length);
Clemmons[Clemmons.length] = createMarker(new GPoint(-80.37723541,36.02533340),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Clemmons Elementary School",'Clemmons=' + Clemmons.length);
Winston_salem[Winston_salem.length] = createMarker(new GPoint(-80.34293365,36.02695847),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Clemmons Middle School",'Winston_salem=' + Winston_salem.length);
Winston_salem[Winston_salem.length] = createMarker(new GPoint(-80.25952148,36.10879898),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Cook Elementary School",'Winston_salem=' + Winston_salem.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.23202515,36.07880783),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Diggs Elementary School",'Winston_Salem=' + Winston_Salem.length);
Winston_salem[Winston_salem.length] = createMarker(new GPoint(-80.24360657,36.09231567),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Downtown Middle School",'Winston_salem=' + Winston_salem.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.24745941,36.10127258),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Downtown School",'Winston_Salem=' + Winston_Salem.length);
Kernersville[Kernersville.length] = createMarker(new GPoint(-80.15095520,36.12131119),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("East Forsyth High School",'Kernersville=' + Kernersville.length);
Kernersville[Kernersville.length] = createMarker(new GPoint(-80.12124400,36.13745100),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("East Forsyth Middle School",'Kernersville=' + Kernersville.length);
Winston_salem[Winston_salem.length] = createMarker(new GPoint(-80.22543335,36.11285019),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("East Winston Primary",'Winston_salem=' + Winston_salem.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.22335052,36.05631638),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Easton Elementary School",'Winston_Salem=' + Winston_Salem.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.21717072,36.07296371),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Forest Park Elementary School",'Winston_Salem=' + Winston_Salem.length);
Winston_salem[Winston_salem.length] = createMarker(new GPoint(-80.30004120,36.17168808),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Forsyth Academies Elementary School",'Winston_salem=' + Winston_salem.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.23867035,36.06286240),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Forsyth Vocational High School",'Winston_Salem=' + Winston_Salem.length);
Winston_salem[Winston_salem.length] = createMarker(new GPoint(-80.31000519,36.18894958),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Gibson Elementary School",'Winston_salem=' + Winston_salem.length);
Winston_salem[Winston_salem.length] = createMarker(new GPoint(-80.24452200,36.04752500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Griffith Alternative School",'Winston_salem=' + Winston_salem.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.26366425,36.03968811),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Griffith Elementary School",'Winston_Salem=' + Winston_Salem.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.17613220,36.07914352),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hall-woodward Elementary School",'Winston_Salem=' + Winston_Salem.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.23683167,36.12676239),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Hanes Middle School",'Winston_Salem=' + Winston_Salem.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.20565796,36.06866074),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Hill Middle School",'Winston_Salem=' + Winston_Salem.length);
Winston_salem[Winston_salem.length] = createMarker(new GPoint(-80.22428131,36.11843872),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Homebound/hospital Educ Center",'Winston_salem=' + Winston_salem.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.20282745,36.15800095),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Ibraham Elementary School",'Winston_Salem=' + Winston_Salem.length);
Winston_salem[Winston_salem.length] = createMarker(new GPoint(-80.34925842,36.12614822),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Jefferson Elementary School",'Winston_salem=' + Winston_salem.length);
Winston_salem[Winston_salem.length] = createMarker(new GPoint(-80.32167053,36.11603546),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Jefferson Middle School",'Winston_salem=' + Winston_salem.length);
Kernersville[Kernersville.length] = createMarker(new GPoint(-80.07979584,36.12517929),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Kernersville Elementary School",'Kernersville=' + Kernersville.length);
Kernersville[Kernersville.length] = createMarker(new GPoint(-80.07186890,36.13483429),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Kernersville Middle School",'Kernersville=' + Kernersville.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.24334717,36.09997940),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Kimberley Park Elementary School",'Winston_Salem=' + Winston_Salem.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.24593353,36.05144882),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Konnoak Elementary School",'Winston_Salem=' + Winston_Salem.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.25534058,36.07809830),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Latham Elementary School",'Winston_Salem=' + Winston_Salem.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.23332214,36.10676193),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Leap At Kennedy Middle School",'Winston_Salem=' + Winston_Salem.length);
Lewisville[Lewisville.length] = createMarker(new GPoint(-80.41984558,36.09568787),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lewisville Elementary School",'Lewisville=' + Lewisville.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.23683167,36.12676239),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lowrance Middle School",'Winston_Salem=' + Winston_Salem.length);
Winston_salem[Winston_salem.length] = createMarker(new GPoint(-80.36588800,36.10177300),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Meadowlark Elementary School",'Winston_salem=' + Winston_salem.length);
Winston_salem[Winston_salem.length] = createMarker(new GPoint(-80.36591339,36.09899902),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Meadowlark Middle School",'Winston_salem=' + Winston_salem.length);
Winston_salem[Winston_salem.length] = createMarker(new GPoint(-80.30999756,36.06549835),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Middle College Of Forsyth Cnty",'Winston_salem=' + Winston_salem.length);
Walkertown[Walkertown.length] = createMarker(new GPoint(-80.16973200,36.14040000),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Middle Fork Elementary School",'Walkertown=' + Walkertown.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.23612976,36.15644073),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mineral Springs Elementary School",'Winston_Salem=' + Winston_Salem.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.23612976,36.15742493),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Mineral Springs Middle School",'Winston_Salem=' + Winston_Salem.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.28607941,36.08742905),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Moore Elementary School",'Winston_Salem=' + Winston_Salem.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.31346893,36.12781525),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mount Tabor High School",'Winston_Salem=' + Winston_Salem.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.28405762,36.16902924),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("North Forsyth High School",'Winston_Salem=' + Winston_Salem.length);
Winston_salem[Winston_salem.length] = createMarker(new GPoint(-80.25193787,36.14893723),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("North Hills Elementary School",'Winston_salem=' + Winston_salem.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.30927277,36.19181824),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Northwest Middle School",'Winston_Salem=' + Winston_Salem.length);
Tobaccoville[Tobaccoville.length] = createMarker(new GPoint(-80.38865662,36.20704269),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Old Richmond Elementary School",'Tobaccoville=' + Tobaccoville.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.33181763,36.16542816),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Old Town Elementary School",'Winston_Salem=' + Winston_Salem.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.25827026,36.11346436),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Paisley Middle School",'Winston_Salem=' + Winston_Salem.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.25767517,36.05537033),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Parkland High School",'Winston_Salem=' + Winston_Salem.length);
Winston_salem[Winston_salem.length] = createMarker(new GPoint(-80.19184113,36.11160278),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Petree Elementary School",'Winston_salem=' + Winston_salem.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.24623871,36.05347443),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Philo Middle School",'Winston_Salem=' + Winston_Salem.length);
Kernersville[Kernersville.length] = createMarker(new GPoint(-80.05503082,36.16038895),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Piney Grove Elementary School",'Kernersville=' + Kernersville.length);
Winston_salem[Winston_salem.length] = createMarker(new GPoint(-80.23780060,36.14770126),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Quality Education Academy",'Winston_salem=' + Winston_salem.length);
Kernersville[Kernersville.length] = createMarker(new GPoint(-80.11167145,36.06916428),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("R B Glenn High School",'Kernersville=' + Kernersville.length);
Pfafftown[Pfafftown.length] = createMarker(new GPoint(-80.36442400,36.16905300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Reagen High School",'Pfafftown=' + Pfafftown.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.26654053,36.10085678),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Reynolds High School",'Winston_Salem=' + Winston_Salem.length);
Rural_Hall[Rural_Hall.length] = createMarker(new GPoint(-80.29095459,36.24092865),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Rural Hall Elementary School",'Rural_Hall=' + Rural_Hall.length);
Winston_salem[Winston_salem.length] = createMarker(new GPoint(-80.19592600,36.10797300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sch Computer Technology Atkins",'Winston_salem=' + Winston_salem.length);
Winston_salem[Winston_salem.length] = createMarker(new GPoint(-80.19592600,36.10797300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sch Of Biotechnology Atkins High School",'Winston_salem=' + Winston_salem.length);
Winston_salem[Winston_salem.length] = createMarker(new GPoint(-80.19592600,36.10797300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sch Pre-engineering Atkins Hig",'Winston_salem=' + Winston_salem.length);
Kernersville[Kernersville.length] = createMarker(new GPoint(-80.13729095,36.09654617),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sedge Garden Elementary School",'Kernersville=' + Kernersville.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.31029510,36.10551071),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sherwood Forest Elementary School",'Winston_Salem=' + Winston_Salem.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.32467651,36.08504868),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("South Fork Elementary School",'Winston_Salem=' + Winston_Salem.length);
Kernersville[Kernersville.length] = createMarker(new GPoint(-80.09072876,36.08301544),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Southeast Middle School",'Kernersville=' + Kernersville.length);
Clemmons[Clemmons.length] = createMarker(new GPoint(-80.38442993,36.06733704),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Southwest Elementary School",'Clemmons=' + Clemmons.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.29653931,36.13100433),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Speas Elementary School",'Winston_Salem=' + Winston_Salem.length);
Kernersville[Kernersville.length] = createMarker(new GPoint(-80.11895752,36.04844284),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Union Cross Elementary School",'Kernersville=' + Kernersville.length);
Pfafftown[Pfafftown.length] = createMarker(new GPoint(-80.38948059,36.14147568),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Vienna Elementary School",'Pfafftown=' + Pfafftown.length);
Walkertown[Walkertown.length] = createMarker(new GPoint(-80.15155029,36.17083740),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Walkertown Elementary School",'Walkertown=' + Walkertown.length);
Walkertown[Walkertown.length] = createMarker(new GPoint(-80.15830231,36.17969894),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Walkertown Middle School",'Walkertown=' + Walkertown.length);
Winston_salem[Winston_salem.length] = createMarker(new GPoint(-80.34262848,36.02637863),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Ward Elementary School",'Winston_salem=' + Winston_salem.length);
Clemmons[Clemmons.length] = createMarker(new GPoint(-80.38912964,36.06293869),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("West Forsyth High School",'Clemmons=' + Clemmons.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.28433228,36.10675049),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Whitaker Elementary School",'Winston_Salem=' + Winston_Salem.length);
Winston_Salem[Winston_Salem.length] = createMarker(new GPoint(-80.26243591,36.10200882),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Wiley Middle School",'Winston_Salem=' + Winston_Salem.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,10);
/*
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(Clemmons);
map.removeOverlays(Kernersville);
map.removeOverlays(Lewisville);
map.removeOverlays(Pfafftown);
map.removeOverlays(Rural_Hall);
map.removeOverlays(Tobaccoville);
map.removeOverlays(Walkertown);
map.removeOverlays(Winston_Salem);
map.removeOverlays(Winston_salem);
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(Winston_Salem);map.removeOverlays(Clemmons);
map.removeOverlays(Kernersville);
map.removeOverlays(Lewisville);
map.removeOverlays(Pfafftown);
map.removeOverlays(Rural_Hall);
map.removeOverlays(Tobaccoville);
map.removeOverlays(Walkertown);
map.removeOverlays(Winston_Salem);
map.removeOverlays(Winston_salem);
map.addOverlays(Clemmons);
centerByArray(Clemmons, false, false);
cntMarker += Clemmons.length;
map.addOverlays(Kernersville);
centerByArray(Kernersville, false, false);
cntMarker += Kernersville.length;
map.addOverlays(Lewisville);
centerByArray(Lewisville, false, false);
cntMarker += Lewisville.length;
map.addOverlays(Pfafftown);
centerByArray(Pfafftown, false, false);
cntMarker += Pfafftown.length;
map.addOverlays(Rural_Hall);
centerByArray(Rural_Hall, false, false);
cntMarker += Rural_Hall.length;
map.addOverlays(Tobaccoville);
centerByArray(Tobaccoville, false, false);
cntMarker += Tobaccoville.length;
map.addOverlays(Walkertown);
centerByArray(Walkertown, false, false);
cntMarker += Walkertown.length;
map.addOverlays(Winston_Salem);
centerByArray(Winston_Salem, false, false);
cntMarker += Winston_Salem.length;
map.addOverlays(Winston_salem);
centerByArray(Winston_salem, false, false);
cntMarker += Winston_salem.length;
centerByArray(Winston_Salem,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');
}
}