function addMarkers()
{
mySelect = document.getElementById('selection');
Greenland = [];Fayetteville = [];Springdale = [];Elkins = [];Farmington = [];Lincoln = [];Prairie_Grove = [];West_Fork = [];Winslow = [];mySelect.options[mySelect.options.length] = new Option("Elkins schools",'all=Elkins');
mySelect.options[mySelect.options.length] = new Option("Farmington schools",'all=Farmington');
mySelect.options[mySelect.options.length] = new Option("Fayetteville schools",'all=Fayetteville');
mySelect.options[mySelect.options.length] = new Option("Greenland schools",'all=Greenland');
mySelect.options[mySelect.options.length] = new Option("Lincoln schools",'all=Lincoln');
mySelect.options[mySelect.options.length] = new Option("Prairie Grove schools",'all=Prairie_Grove');
mySelect.options[mySelect.options.length] = new Option("Springdale schools",'all=Springdale');
mySelect.options[mySelect.options.length] = new Option("West Fork schools",'all=West_Fork');
mySelect.options[mySelect.options.length] = new Option("Winslow schools",'all=Winslow');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Greenland[Greenland.length] = createMarker(new GPoint(-94.17340088,35.99399948),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ar School For Info Sys & Technology",'Greenland=' + Greenland.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-94.18843079,36.08204269),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Asbell Elementary School",'Fayetteville=' + Fayetteville.length);
Springdale[Springdale.length] = createMarker(new GPoint(-94.11096200,36.20577200),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bayyari Elementary School",'Springdale=' + Springdale.length);
Springdale[Springdale.length] = createMarker(new GPoint(-94.20598602,36.18411636),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bernice Young Elementary School",'Springdale=' + Springdale.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-94.13339996,36.10598755),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Butterfield Elementary School",'Fayetteville=' + Fayetteville.length);
Springdale[Springdale.length] = createMarker(new GPoint(-94.16166687,36.18908310),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Central Junior High School",'Springdale=' + Springdale.length);
Elkins[Elkins.length] = createMarker(new GPoint(-94.01052900,36.00076000),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Elkins Elem. Primary School",'Elkins=' + Elkins.length);
Elkins[Elkins.length] = createMarker(new GPoint(-93.99199677,36.01720047),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Elkins Elementary School",'Elkins=' + Elkins.length);
Elkins[Elkins.length] = createMarker(new GPoint(-93.99199677,36.01720047),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Elkins High School",'Elkins=' + Elkins.length);
Elkins[Elkins.length] = createMarker(new GPoint(-93.99199677,36.01720047),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Elkins Middle School",'Elkins=' + Elkins.length);
Springdale[Springdale.length] = createMarker(new GPoint(-94.14756775,36.18951416),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Elmdale Elementary School",'Springdale=' + Springdale.length);
Farmington[Farmington.length] = createMarker(new GPoint(-94.25316620,36.03976059),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Farmington High School",'Farmington=' + Farmington.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-94.17372131,36.05931473),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Fayetteville High School East",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-94.19307709,36.05650330),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Fayetteville High School West",'Fayetteville=' + Fayetteville.length);
Springdale[Springdale.length] = createMarker(new GPoint(-94.12616730,36.15986252),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("George Elementary School",'Springdale=' + Springdale.length);
Springdale[Springdale.length] = createMarker(new GPoint(-94.12612300,36.15575600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("George Junior High School",'Springdale=' + Springdale.length);
Farmington[Farmington.length] = createMarker(new GPoint(-94.25392914,36.03933716),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("George R. Ledbetter Elementary School",'Farmington=' + Farmington.length);
Greenland[Greenland.length] = createMarker(new GPoint(-94.17500305,35.99409866),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Greenland Elementary School",'Greenland=' + Greenland.length);
Greenland[Greenland.length] = createMarker(new GPoint(-94.17500305,35.99409866),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Greenland High School",'Greenland=' + Greenland.length);
Greenland[Greenland.length] = createMarker(new GPoint(-94.17304993,35.99460983),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Greenland Middle School",'Greenland=' + Greenland.length);
Farmington[Farmington.length] = createMarker(new GPoint(-94.28921300,36.04332400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Haas Hall Academy",'Farmington=' + Farmington.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-94.13305664,36.05831146),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Happy Hollow Elementary School",'Fayetteville=' + Fayetteville.length);
Springdale[Springdale.length] = createMarker(new GPoint(-94.21030700,36.18670600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Har-ber High School",'Springdale=' + Springdale.length);
Springdale[Springdale.length] = createMarker(new GPoint(-94.09476471,36.16006088),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Harp Elementary School",'Springdale=' + Springdale.length);
Springdale[Springdale.length] = createMarker(new GPoint(-94.17536926,36.15556335),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Helen Tyson Middle School",'Springdale=' + Springdale.length);
Springdale[Springdale.length] = createMarker(new GPoint(-94.19605700,36.18631000),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Hellstern Middle School",'Springdale=' + Springdale.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-94.20762634,36.10503769),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Holcomb Elementary School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-94.21517181,36.09201813),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Holt Middle School",'Fayetteville=' + Fayetteville.length);
Springdale[Springdale.length] = createMarker(new GPoint(-94.11048126,36.16666412),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("J. O. Kelly Middle School",'Springdale=' + Springdale.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-94.15795135,36.05607605),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Jefferson Elementary School",'Fayetteville=' + Fayetteville.length);
Farmington[Farmington.length] = createMarker(new GPoint(-94.23595300,36.05238100),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Jerry Pop Williams Elementary School",'Farmington=' + Farmington.length);
Springdale[Springdale.length] = createMarker(new GPoint(-94.15625000,36.16384888),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("John Tyson Elementary School",'Springdale=' + Springdale.length);
Springdale[Springdale.length] = createMarker(new GPoint(-94.12578583,36.17517471),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Jones Elementary School",'Springdale=' + Springdale.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-94.17610168,36.07413864),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Leverett Elementary School",'Fayetteville=' + Fayetteville.length);
Lincoln[Lincoln.length] = createMarker(new GPoint(-94.37729645,35.93330002),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Lincoln=' + Lincoln.length);
Lincoln[Lincoln.length] = createMarker(new GPoint(-94.37729645,35.93330002),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lincoln High School",'Lincoln=' + Lincoln.length);
Lincoln[Lincoln.length] = createMarker(new GPoint(-94.37729645,35.93330002),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Lincoln Middle School",'Lincoln=' + Lincoln.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-94.18946838,36.05805588),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("M. O. Ramey Junior High School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-94.11801147,36.08787537),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Mcnair Middle School",'Fayetteville=' + Fayetteville.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-94.19287300,36.05632500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Nw Ark. Community Coll Regional Tech Ctr.",'Fayetteville=' + Fayetteville.length);
Springdale[Springdale.length] = createMarker(new GPoint(-94.10638428,36.17188644),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Parsons Hills Elementary School",'Springdale=' + Springdale.length);
Prairie_Grove[Prairie_Grove.length] = createMarker(new GPoint(-94.32212830,35.98503876),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Prairie Grove Elementary School",'Prairie_Grove=' + Prairie_Grove.length);
Prairie_Grove[Prairie_Grove.length] = createMarker(new GPoint(-94.31732941,35.98435974),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Prairie Grove High School",'Prairie_Grove=' + Prairie_Grove.length);
Prairie_Grove[Prairie_Grove.length] = createMarker(new GPoint(-94.31732941,35.98435974),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Prairie Grove Junior High School",'Prairie_Grove=' + Prairie_Grove.length);
Prairie_Grove[Prairie_Grove.length] = createMarker(new GPoint(-94.32660675,35.98432922),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Prairie Grove Upper Elementary School",'Prairie_Grove=' + Prairie_Grove.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-94.18946838,36.05805588),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Ramay Junior High School",'Fayetteville=' + Fayetteville.length);
Farmington[Farmington.length] = createMarker(new GPoint(-94.25653076,36.04216385),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Randall G. Lynch Middle School",'Farmington=' + Farmington.length);
Springdale[Springdale.length] = createMarker(new GPoint(-94.13467407,36.17893600),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Robert E. Lee Elementary School",'Springdale=' + Springdale.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-94.14058685,36.08159637),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Root Elementary School",'Fayetteville=' + Fayetteville.length);
Springdale[Springdale.length] = createMarker(new GPoint(-94.15035248,36.17093658),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Southwest Junior High School",'Springdale=' + Springdale.length);
Springdale[Springdale.length] = createMarker(new GPoint(-94.14044189,36.18489075),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Springdale High School",'Springdale=' + Springdale.length);
Springdale[Springdale.length] = createMarker(new GPoint(-94.17208862,36.20053864),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Thurman G. Smith Elementary School",'Springdale=' + Springdale.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-94.12171936,36.09436417),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Vandergriff Elementary School",'Fayetteville=' + Fayetteville.length);
Springdale[Springdale.length] = createMarker(new GPoint(-94.17462921,36.16876221),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Walker Elementary School",'Springdale=' + Springdale.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-94.15670013,36.06267166),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Washington Elementary School",'Fayetteville=' + Fayetteville.length);
West_Fork[West_Fork.length] = createMarker(new GPoint(-94.19139099,35.92282486),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("West Fork Elementary School",'West_Fork=' + West_Fork.length);
West_Fork[West_Fork.length] = createMarker(new GPoint(-94.19139099,35.92282486),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("West Fork High School",'West_Fork=' + West_Fork.length);
West_Fork[West_Fork.length] = createMarker(new GPoint(-94.19139099,35.92282486),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("West Fork Middle School",'West_Fork=' + West_Fork.length);
Springdale[Springdale.length] = createMarker(new GPoint(-94.15122986,36.18190002),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Westwood Elementary School",'Springdale=' + Springdale.length);
Winslow[Winslow.length] = createMarker(new GPoint(-94.12829590,35.79868698),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Winslow Elementary School",'Winslow=' + Winslow.length);
Greenland[Greenland.length] = createMarker(new GPoint(-94.18898800,35.99486400),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Winslow Elementary School",'Greenland=' + Greenland.length);
Winslow[Winslow.length] = createMarker(new GPoint(-94.12829590,35.79868698),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Winslow High School",'Winslow=' + Winslow.length);
Greenland[Greenland.length] = createMarker(new GPoint(-94.18898800,35.99486400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Winslow High School",'Greenland=' + Greenland.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-116.74221802,47.40627670),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Woodland Junior High School",'Fayetteville=' + Fayetteville.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(Elkins);
map.removeOverlays(Farmington);
map.removeOverlays(Fayetteville);
map.removeOverlays(Greenland);
map.removeOverlays(Lincoln);
map.removeOverlays(Prairie_Grove);
map.removeOverlays(Springdale);
map.removeOverlays(West_Fork);
map.removeOverlays(Winslow);
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(Greenland);map.removeOverlays(Elkins);
map.removeOverlays(Farmington);
map.removeOverlays(Fayetteville);
map.removeOverlays(Greenland);
map.removeOverlays(Lincoln);
map.removeOverlays(Prairie_Grove);
map.removeOverlays(Springdale);
map.removeOverlays(West_Fork);
map.removeOverlays(Winslow);
map.addOverlays(Elkins);
centerByArray(Elkins, false, false);
cntMarker += Elkins.length;
map.addOverlays(Farmington);
centerByArray(Farmington, false, false);
cntMarker += Farmington.length;
map.addOverlays(Fayetteville);
centerByArray(Fayetteville, false, false);
cntMarker += Fayetteville.length;
map.addOverlays(Greenland);
centerByArray(Greenland, false, false);
cntMarker += Greenland.length;
map.addOverlays(Lincoln);
centerByArray(Lincoln, false, false);
cntMarker += Lincoln.length;
map.addOverlays(Prairie_Grove);
centerByArray(Prairie_Grove, false, false);
cntMarker += Prairie_Grove.length;
map.addOverlays(Springdale);
centerByArray(Springdale, false, false);
cntMarker += Springdale.length;
map.addOverlays(West_Fork);
centerByArray(West_Fork, false, false);
cntMarker += West_Fork.length;
map.addOverlays(Winslow);
centerByArray(Winslow, false, false);
cntMarker += Winslow.length;
centerByArray(Greenland,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');
}
}