function addMarkers(){
mySelect = document.getElementById('selection');
Sherwood = [];Little_Rock = [];Forrest_City = [];Camden = [];Hot_Springs = [];Magnolia = [];Russellville = [];Conway = [];Fayetteville = [];Monticello = [];Harrison = [];Stuttgart = [];Centerton = [];Rogers = [];Pine_Bluff = [];Mountain_Home = [];Elm_Springs = [];Blytheville = [];Fort_Smith = [];Springdale = [];Van_Buren = [];El_Dorado = [];mySelect.options[mySelect.options.length] = new Option("Blytheville schools",'all=Blytheville');
mySelect.options[mySelect.options.length] = new Option("Camden schools",'all=Camden');
mySelect.options[mySelect.options.length] = new Option("Centerton schools",'all=Centerton');
mySelect.options[mySelect.options.length] = new Option("Conway schools",'all=Conway');
mySelect.options[mySelect.options.length] = new Option("El Dorado schools",'all=El_Dorado');
mySelect.options[mySelect.options.length] = new Option("Elm Springs schools",'all=Elm_Springs');
mySelect.options[mySelect.options.length] = new Option("Fayetteville schools",'all=Fayetteville');
mySelect.options[mySelect.options.length] = new Option("Forrest City schools",'all=Forrest_City');
mySelect.options[mySelect.options.length] = new Option("Fort Smith schools",'all=Fort_Smith');
mySelect.options[mySelect.options.length] = new Option("Harrison schools",'all=Harrison');
mySelect.options[mySelect.options.length] = new Option("Hot Springs schools",'all=Hot_Springs');
mySelect.options[mySelect.options.length] = new Option("Little Rock schools",'all=Little_Rock');
mySelect.options[mySelect.options.length] = new Option("Magnolia schools",'all=Magnolia');
mySelect.options[mySelect.options.length] = new Option("Monticello schools",'all=Monticello');
mySelect.options[mySelect.options.length] = new Option("Mountain Home schools",'all=Mountain_Home');
mySelect.options[mySelect.options.length] = new Option("Pine Bluff schools",'all=Pine_Bluff');
mySelect.options[mySelect.options.length] = new Option("Rogers schools",'all=Rogers');
mySelect.options[mySelect.options.length] = new Option("Russellville schools",'all=Russellville');
mySelect.options[mySelect.options.length] = new Option("Sherwood schools",'all=Sherwood');
mySelect.options[mySelect.options.length] = new Option("Springdale schools",'all=Springdale');
mySelect.options[mySelect.options.length] = new Option("Stuttgart schools",'all=Stuttgart');
mySelect.options[mySelect.options.length] = new Option("Van Buren schools",'all=Van_Buren');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Sherwood[Sherwood.length] = createMarker(new GPoint(-92.23143200,34.83793200),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Abundant Life School",'Sherwood=' + Sherwood.length);
Little_Rock[Little_Rock.length] = createMarker(new GPoint(-92.40199400,34.77819000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Arkansas Baptist School System",'Little_Rock=' + Little_Rock.length);
Little_Rock[Little_Rock.length] = createMarker(new GPoint(-92.28562500,34.58658900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bingham Road Baptist Child Development Center",'Little_Rock=' + Little_Rock.length);
Forrest_City[Forrest_City.length] = createMarker(new GPoint(-90.78970600,35.02680300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Calvary Christian School",'Forrest_City=' + Forrest_City.length);
Camden[Camden.length] = createMarker(new GPoint(-92.84896800,33.56211200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Camden Christian Academy",'Camden=' + Camden.length);
Hot_Springs[Hot_Springs.length] = createMarker(new GPoint(-93.05231400,34.50942400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Christian Ministries Academy",'Hot_Springs=' + Hot_Springs.length);
Magnolia[Magnolia.length] = createMarker(new GPoint(-93.20344600,33.28316200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Columbia Christian School",'Magnolia=' + Magnolia.length);
Russellville[Russellville.length] = createMarker(new GPoint(-93.13481600,35.27826700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Community Christian School",'Russellville=' + Russellville.length);
Conway[Conway.length] = createMarker(new GPoint(-92.40124400,35.08543200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Conway Christian School",'Conway=' + Conway.length);
Little_Rock[Little_Rock.length] = createMarker(new GPoint(-92.34440100,34.67439900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Dayspring Chr Academy",'Little_Rock=' + Little_Rock.length);
Little_Rock[Little_Rock.length] = createMarker(new GPoint(-92.34440100,34.67439900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Faith Christian School Of Litt",'Little_Rock=' + Little_Rock.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-94.13200000,36.08744600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Fayettville Christian School",'Fayetteville=' + Fayetteville.length);
Monticello[Monticello.length] = createMarker(new GPoint(-91.79220000,33.58030000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Grace Christian Academy",'Monticello=' + Monticello.length);
Harrison[Harrison.length] = createMarker(new GPoint(-93.05482900,36.25935000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Grace Christian School",'Harrison=' + Harrison.length);
Stuttgart[Stuttgart.length] = createMarker(new GPoint(-91.54090000,34.46710000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Grand Prairie Evangelical Methodist School",'Stuttgart=' + Stuttgart.length);
Centerton[Centerton.length] = createMarker(new GPoint(-94.28471800,36.36265700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Life Way Christian School",'Centerton=' + Centerton.length);
Hot_Springs[Hot_Springs.length] = createMarker(new GPoint(-92.98891600,34.50551600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lighthouse Christian School",'Hot_Springs=' + Hot_Springs.length);
Little_Rock[Little_Rock.length] = createMarker(new GPoint(-92.37012700,34.75684100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Little Rock Adventist Academy",'Little_Rock=' + Little_Rock.length);
Little_Rock[Little_Rock.length] = createMarker(new GPoint(-92.43980000,34.80250000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Little Rock Christian Academy",'Little_Rock=' + Little_Rock.length);
Rogers[Rogers.length] = createMarker(new GPoint(-94.13576200,36.29980000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("New Covenant Christian Academy",'Rogers=' + Rogers.length);
Pine_Bluff[Pine_Bluff.length] = createMarker(new GPoint(-92.10460000,34.13750000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("New Life Christian School",'Pine_Bluff=' + Pine_Bluff.length);
Mountain_Home[Mountain_Home.length] = createMarker(new GPoint(-92.37800000,36.24000000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("North Central Christian School",'Mountain_Home=' + Mountain_Home.length);
Elm_Springs[Elm_Springs.length] = createMarker(new GPoint(-94.23410000,36.20610000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Northwest Arkansas Christian A",'Elm_Springs=' + Elm_Springs.length);
Blytheville[Blytheville.length] = createMarker(new GPoint(-89.82989600,35.92270600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pathway Christian Academy",'Blytheville=' + Blytheville.length);
Fort_Smith[Fort_Smith.length] = createMarker(new GPoint(-94.37530000,35.33390000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("River Valley Christian School",'Fort_Smith=' + Fort_Smith.length);
Springdale[Springdale.length] = createMarker(new GPoint(-94.15669200,36.16977200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Shiloh Christian School",'Springdale=' + Springdale.length);
Van_Buren[Van_Buren.length] = createMarker(new GPoint(-94.28326000,35.46055100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sonshine Christian School",'Van_Buren=' + Van_Buren.length);
Little_Rock[Little_Rock.length] = createMarker(new GPoint(-92.34528300,34.64810800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Southwest Christian Academy",'Little_Rock=' + Little_Rock.length);
Hot_Springs[Hot_Springs.length] = createMarker(new GPoint(-93.06182900,34.50233500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St John Elementary School",'Hot_Springs=' + Hot_Springs.length);
Fort_Smith[Fort_Smith.length] = createMarker(new GPoint(-94.38479000,35.40053700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Union Christian Academy",'Fort_Smith=' + Fort_Smith.length);
Little_Rock[Little_Rock.length] = createMarker(new GPoint(-92.33981700,34.69041700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Victory Christian Schools",'Little_Rock=' + Little_Rock.length);
El_Dorado[El_Dorado.length] = createMarker(new GPoint(-92.68910100,33.20752300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("West Side Christian School",'El_Dorado=' + El_Dorado.length);
Pine_Bluff[Pine_Bluff.length] = createMarker(new GPoint(-92.09325400,34.25695500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("White Hall Christian Academy",'Pine_Bluff=' + Pine_Bluff.length);
map.removeOverlays(Blytheville);
map.removeOverlays(Camden);
map.removeOverlays(Centerton);
map.removeOverlays(Conway);
map.removeOverlays(El_Dorado);
map.removeOverlays(Elm_Springs);
map.removeOverlays(Fayetteville);
map.removeOverlays(Forrest_City);
map.removeOverlays(Fort_Smith);
map.removeOverlays(Harrison);
map.removeOverlays(Hot_Springs);
map.removeOverlays(Little_Rock);
map.removeOverlays(Magnolia);
map.removeOverlays(Monticello);
map.removeOverlays(Mountain_Home);
map.removeOverlays(Pine_Bluff);
map.removeOverlays(Rogers);
map.removeOverlays(Russellville);
map.removeOverlays(Sherwood);
map.removeOverlays(Springdale);
map.removeOverlays(Stuttgart);
map.removeOverlays(Van_Buren);
setTimeout(function(){map.addOverlays(Blytheville)},1000);
setTimeout(function(){map.addOverlays(Camden)},1000);
setTimeout(function(){map.addOverlays(Centerton)},1000);
setTimeout(function(){map.addOverlays(Conway)},1000);
setTimeout(function(){map.addOverlays(El_Dorado)},1000);
setTimeout(function(){map.addOverlays(Elm_Springs)},1000);
setTimeout(function(){map.addOverlays(Fayetteville)},1000);
setTimeout(function(){map.addOverlays(Forrest_City)},1000);
setTimeout(function(){map.addOverlays(Fort_Smith)},1000);
setTimeout(function(){map.addOverlays(Harrison)},1000);
setTimeout(function(){map.addOverlays(Hot_Springs)},1000);
setTimeout(function(){map.addOverlays(Little_Rock)},1000);
setTimeout(function(){map.addOverlays(Magnolia)},1000);
setTimeout(function(){map.addOverlays(Monticello)},1000);
setTimeout(function(){map.addOverlays(Mountain_Home)},1000);
setTimeout(function(){map.addOverlays(Pine_Bluff)},1000);
setTimeout(function(){map.addOverlays(Rogers)},1000);
setTimeout(function(){map.addOverlays(Russellville)},1000);
setTimeout(function(){map.addOverlays(Sherwood)},1000);
setTimeout(function(){map.addOverlays(Springdale)},1000);
setTimeout(function(){map.addOverlays(Stuttgart)},1000);
setTimeout(function(){map.addOverlays(Van_Buren)},1000);
maxLng = -89.82989600;
maxLat = 36.36265700;
minLng = -94.38479000;
minLat = 33.20752300;
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(Blytheville);
map.removeOverlays(Camden);
map.removeOverlays(Centerton);
map.removeOverlays(Conway);
map.removeOverlays(El_Dorado);
map.removeOverlays(Elm_Springs);
map.removeOverlays(Fayetteville);
map.removeOverlays(Forrest_City);
map.removeOverlays(Fort_Smith);
map.removeOverlays(Harrison);
map.removeOverlays(Hot_Springs);
map.removeOverlays(Little_Rock);
map.removeOverlays(Magnolia);
map.removeOverlays(Monticello);
map.removeOverlays(Mountain_Home);
map.removeOverlays(Pine_Bluff);
map.removeOverlays(Rogers);
map.removeOverlays(Russellville);
map.removeOverlays(Sherwood);
map.removeOverlays(Springdale);
map.removeOverlays(Stuttgart);
map.removeOverlays(Van_Buren);
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(Sherwood);map.removeOverlays(Blytheville);
map.removeOverlays(Camden);
map.removeOverlays(Centerton);
map.removeOverlays(Conway);
map.removeOverlays(El_Dorado);
map.removeOverlays(Elm_Springs);
map.removeOverlays(Fayetteville);
map.removeOverlays(Forrest_City);
map.removeOverlays(Fort_Smith);
map.removeOverlays(Harrison);
map.removeOverlays(Hot_Springs);
map.removeOverlays(Little_Rock);
map.removeOverlays(Magnolia);
map.removeOverlays(Monticello);
map.removeOverlays(Mountain_Home);
map.removeOverlays(Pine_Bluff);
map.removeOverlays(Rogers);
map.removeOverlays(Russellville);
map.removeOverlays(Sherwood);
map.removeOverlays(Springdale);
map.removeOverlays(Stuttgart);
map.removeOverlays(Van_Buren);
map.addOverlays(Blytheville);
centerByArray(Blytheville, false, false);
cntMarker += Blytheville.length;
map.addOverlays(Camden);
centerByArray(Camden, false, false);
cntMarker += Camden.length;
map.addOverlays(Centerton);
centerByArray(Centerton, false, false);
cntMarker += Centerton.length;
map.addOverlays(Conway);
centerByArray(Conway, false, false);
cntMarker += Conway.length;
map.addOverlays(El_Dorado);
centerByArray(El_Dorado, false, false);
cntMarker += El_Dorado.length;
map.addOverlays(Elm_Springs);
centerByArray(Elm_Springs, false, false);
cntMarker += Elm_Springs.length;
map.addOverlays(Fayetteville);
centerByArray(Fayetteville, false, false);
cntMarker += Fayetteville.length;
map.addOverlays(Forrest_City);
centerByArray(Forrest_City, false, false);
cntMarker += Forrest_City.length;
map.addOverlays(Fort_Smith);
centerByArray(Fort_Smith, false, false);
cntMarker += Fort_Smith.length;
map.addOverlays(Harrison);
centerByArray(Harrison, false, false);
cntMarker += Harrison.length;
map.addOverlays(Hot_Springs);
centerByArray(Hot_Springs, false, false);
cntMarker += Hot_Springs.length;
map.addOverlays(Little_Rock);
centerByArray(Little_Rock, false, false);
cntMarker += Little_Rock.length;
map.addOverlays(Magnolia);
centerByArray(Magnolia, false, false);
cntMarker += Magnolia.length;
map.addOverlays(Monticello);
centerByArray(Monticello, false, false);
cntMarker += Monticello.length;
map.addOverlays(Mountain_Home);
centerByArray(Mountain_Home, false, false);
cntMarker += Mountain_Home.length;
map.addOverlays(Pine_Bluff);
centerByArray(Pine_Bluff, false, false);
cntMarker += Pine_Bluff.length;
map.addOverlays(Rogers);
centerByArray(Rogers, false, false);
cntMarker += Rogers.length;
map.addOverlays(Russellville);
centerByArray(Russellville, false, false);
cntMarker += Russellville.length;
map.addOverlays(Sherwood);
centerByArray(Sherwood, false, false);
cntMarker += Sherwood.length;
map.addOverlays(Springdale);
centerByArray(Springdale, false, false);
cntMarker += Springdale.length;
map.addOverlays(Stuttgart);
centerByArray(Stuttgart, false, false);
cntMarker += Stuttgart.length;
map.addOverlays(Van_Buren);
centerByArray(Van_Buren, false, false);
cntMarker += Van_Buren.length;
centerByArray(Sherwood,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///956,852,867,878,886,851,961,894,903,33351,930,844,932,1012,969,1011,865,950,1016,33857,841,966,904,956,852,33352,867,1015,878,886,851,961,894,903,33351,930,974,844,33350,872,883,932,1012,969,1011,865,902,950,949,1016,33857,35808,841,966,904,33353,/all');
//window.open('/map.php?type=2&schools=956,852,867,878,886,851,961,894,903,33351,930,844,932,1012,969,1011,865,950,1016,33857,841,966,904,956,852,33352,867,1015,878,886,851,961,894,903,33351,930,974,844,33350,872,883,932,1012,969,1011,865,902,950,949,1016,33857,35808,841,966,904,33353,&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;
}