function addMarkers(){
mySelect = document.getElementById('selection');
Jonesboro = [];Little_Rock = [];Fort_Smith = [];El_Dorado = [];Stuttgart = [];Blytheville = [];North_Little_Rock = [];Benton = [];Morrilton = [];Pine_Bluff = [];Fayetteville = [];Paris = [];Conway = [];Paragould = [];Rogers = [];Hot_Springs = [];Russellville = [];Lake_Village = [];West_Memphis = [];Pocahontas = [];Subiaco = [];mySelect.options[mySelect.options.length] = new Option("Benton schools",'all=Benton');
mySelect.options[mySelect.options.length] = new Option("Blytheville schools",'all=Blytheville');
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("Fayetteville schools",'all=Fayetteville');
mySelect.options[mySelect.options.length] = new Option("Fort Smith schools",'all=Fort_Smith');
mySelect.options[mySelect.options.length] = new Option("Hot Springs schools",'all=Hot_Springs');
mySelect.options[mySelect.options.length] = new Option("Jonesboro schools",'all=Jonesboro');
mySelect.options[mySelect.options.length] = new Option("Lake Village schools",'all=Lake_Village');
mySelect.options[mySelect.options.length] = new Option("Little Rock schools",'all=Little_Rock');
mySelect.options[mySelect.options.length] = new Option("Morrilton schools",'all=Morrilton');
mySelect.options[mySelect.options.length] = new Option("North Little Rock schools",'all=North_Little_Rock');
mySelect.options[mySelect.options.length] = new Option("Paragould schools",'all=Paragould');
mySelect.options[mySelect.options.length] = new Option("Paris schools",'all=Paris');
mySelect.options[mySelect.options.length] = new Option("Pine Bluff schools",'all=Pine_Bluff');
mySelect.options[mySelect.options.length] = new Option("Pocahontas schools",'all=Pocahontas');
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("Stuttgart schools",'all=Stuttgart');
mySelect.options[mySelect.options.length] = new Option("Subiaco schools",'all=Subiaco');
mySelect.options[mySelect.options.length] = new Option("West Memphis schools",'all=West_Memphis');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Jonesboro[Jonesboro.length] = createMarker(new GPoint(-90.70393000,35.83666900),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Blessed Sacrament School",'Jonesboro=' + Jonesboro.length);
Little_Rock[Little_Rock.length] = createMarker(new GPoint(-92.34405600,34.75609100),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Catholic High School For Boys",'Little_Rock=' + Little_Rock.length);
Fort_Smith[Fort_Smith.length] = createMarker(new GPoint(-94.40416700,35.36520600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Christ The King Catholic School",'Fort_Smith=' + Fort_Smith.length);
Little_Rock[Little_Rock.length] = createMarker(new GPoint(-92.39899300,34.78940000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Christ The King School",'Little_Rock=' + Little_Rock.length);
El_Dorado[El_Dorado.length] = createMarker(new GPoint(-92.67668000,33.21123700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Holy Redeemer School",'El_Dorado=' + El_Dorado.length);
Stuttgart[Stuttgart.length] = createMarker(new GPoint(-91.56300300,34.48516800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Holy Rosary Catholic School",'Stuttgart=' + Stuttgart.length);
Blytheville[Blytheville.length] = createMarker(new GPoint(-89.92006800,35.92723800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Immaculate Conception Catholic School",'Blytheville=' + Blytheville.length);
Fort_Smith[Fort_Smith.length] = createMarker(new GPoint(-94.41853100,35.38157600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Immaculate Conception School",'Fort_Smith=' + Fort_Smith.length);
North_Little_Rock[North_Little_Rock.length] = createMarker(new GPoint(-92.23622700,34.81897700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Immaculate Conception School",'North_Little_Rock=' + North_Little_Rock.length);
North_Little_Rock[North_Little_Rock.length] = createMarker(new GPoint(-92.34392200,34.87660500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Immaculate Heart-mary School",'North_Little_Rock=' + North_Little_Rock.length);
Little_Rock[Little_Rock.length] = createMarker(new GPoint(-92.32930500,34.75967200),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mt St Mary Academy",'Little_Rock=' + Little_Rock.length);
Benton[Benton.length] = createMarker(new GPoint(-92.59418700,34.56706700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Our Lady Of Fatima Catholic School",'Benton=' + Benton.length);
Little_Rock[Little_Rock.length] = createMarker(new GPoint(-92.33017500,34.74083600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Our Lady Of Good Counsel School",'Little_Rock=' + Little_Rock.length);
Little_Rock[Little_Rock.length] = createMarker(new GPoint(-92.33313200,34.76024400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Our Lady-holy Souls School",'Little_Rock=' + Little_Rock.length);
Morrilton[Morrilton.length] = createMarker(new GPoint(-92.74109700,35.15245700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sacred Heart Catholic School",'Morrilton=' + Morrilton.length);
Little_Rock[Little_Rock.length] = createMarker(new GPoint(-92.26446600,34.74024500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Edwards School",'Little_Rock=' + Little_Rock.length);
Pine_Bluff[Pine_Bluff.length] = createMarker(new GPoint(-92.01525600,34.15108800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Joseph Catholic High School",'Pine_Bluff=' + Pine_Bluff.length);
Fayetteville[Fayetteville.length] = createMarker(new GPoint(-94.11230600,36.08388600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Joseph Elementary School",'Fayetteville=' + Fayetteville.length);
Paris[Paris.length] = createMarker(new GPoint(-93.73303100,35.29186100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Joseph Elementary School",'Paris=' + Paris.length);
Conway[Conway.length] = createMarker(new GPoint(-92.43791200,35.08560700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Joseph School",'Conway=' + Conway.length);
Paragould[Paragould.length] = createMarker(new GPoint(-90.48712900,36.05841000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Mary's Catholic School",'Paragould=' + Paragould.length);
North_Little_Rock[North_Little_Rock.length] = createMarker(new GPoint(-92.26836600,34.77316300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Patrick Elementary School",'North_Little_Rock=' + North_Little_Rock.length);
Rogers[Rogers.length] = createMarker(new GPoint(-94.13549200,36.33030300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Vincent De Paul School",'Rogers=' + Rogers.length);
Fort_Smith[Fort_Smith.length] = createMarker(new GPoint(-94.41191700,35.38109900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Boniface Catholic School",'Fort_Smith=' + Fort_Smith.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);
Russellville[Russellville.length] = createMarker(new GPoint(-93.15108400,35.28330400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Johns Catholic School",'Russellville=' + Russellville.length);
Pine_Bluff[Pine_Bluff.length] = createMarker(new GPoint(-92.00200000,34.22120000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Joseph Catholic Jr High School",'Pine_Bluff=' + Pine_Bluff.length);
North_Little_Rock[North_Little_Rock.length] = createMarker(new GPoint(-92.28063200,34.76905100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Mary's Catholic School",'North_Little_Rock=' + North_Little_Rock.length);
Lake_Village[Lake_Village.length] = createMarker(new GPoint(-91.28296100,33.32976300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Mary's School",'Lake_Village=' + Lake_Village.length);
West_Memphis[West_Memphis.length] = createMarker(new GPoint(-90.18463100,35.15068700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Michaels School",'West_Memphis=' + West_Memphis.length);
Pocahontas[Pocahontas.length] = createMarker(new GPoint(-90.97458400,36.26112800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Paul Catholic School",'Pocahontas=' + Pocahontas.length);
Pine_Bluff[Pine_Bluff.length] = createMarker(new GPoint(-92.00203300,34.21429500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Peter's Catholic School",'Pine_Bluff=' + Pine_Bluff.length);
Little_Rock[Little_Rock.length] = createMarker(new GPoint(-92.34806800,34.66881600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Theresa Catholic School",'Little_Rock=' + Little_Rock.length);
Subiaco[Subiaco.length] = createMarker(new GPoint(-93.63245700,35.29820600),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Subiaco Academy",'Subiaco=' + Subiaco.length);
Fort_Smith[Fort_Smith.length] = createMarker(new GPoint(-94.38570500,35.37193700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Trinity Junior High School",'Fort_Smith=' + Fort_Smith.length);
map.removeOverlays(Benton);
map.removeOverlays(Blytheville);
map.removeOverlays(Conway);
map.removeOverlays(El_Dorado);
map.removeOverlays(Fayetteville);
map.removeOverlays(Fort_Smith);
map.removeOverlays(Hot_Springs);
map.removeOverlays(Jonesboro);
map.removeOverlays(Lake_Village);
map.removeOverlays(Little_Rock);
map.removeOverlays(Morrilton);
map.removeOverlays(North_Little_Rock);
map.removeOverlays(Paragould);
map.removeOverlays(Paris);
map.removeOverlays(Pine_Bluff);
map.removeOverlays(Pocahontas);
map.removeOverlays(Rogers);
map.removeOverlays(Russellville);
map.removeOverlays(Stuttgart);
map.removeOverlays(Subiaco);
map.removeOverlays(West_Memphis);
setTimeout(function(){map.addOverlays(Benton)},1000);
setTimeout(function(){map.addOverlays(Blytheville)},1000);
setTimeout(function(){map.addOverlays(Conway)},1000);
setTimeout(function(){map.addOverlays(El_Dorado)},1000);
setTimeout(function(){map.addOverlays(Fayetteville)},1000);
setTimeout(function(){map.addOverlays(Fort_Smith)},1000);
setTimeout(function(){map.addOverlays(Hot_Springs)},1000);
setTimeout(function(){map.addOverlays(Jonesboro)},1000);
setTimeout(function(){map.addOverlays(Lake_Village)},1000);
setTimeout(function(){map.addOverlays(Little_Rock)},1000);
setTimeout(function(){map.addOverlays(Morrilton)},1000);
setTimeout(function(){map.addOverlays(North_Little_Rock)},1000);
setTimeout(function(){map.addOverlays(Paragould)},1000);
setTimeout(function(){map.addOverlays(Paris)},1000);
setTimeout(function(){map.addOverlays(Pine_Bluff)},1000);
setTimeout(function(){map.addOverlays(Pocahontas)},1000);
setTimeout(function(){map.addOverlays(Rogers)},1000);
setTimeout(function(){map.addOverlays(Russellville)},1000);
setTimeout(function(){map.addOverlays(Stuttgart)},1000);
setTimeout(function(){map.addOverlays(Subiaco)},1000);
setTimeout(function(){map.addOverlays(West_Memphis)},1000);
maxLng = -89.92006800;
maxLat = 36.33030300;
minLng = -94.41853100;
minLat = 33.21123700;
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(Benton);
map.removeOverlays(Blytheville);
map.removeOverlays(Conway);
map.removeOverlays(El_Dorado);
map.removeOverlays(Fayetteville);
map.removeOverlays(Fort_Smith);
map.removeOverlays(Hot_Springs);
map.removeOverlays(Jonesboro);
map.removeOverlays(Lake_Village);
map.removeOverlays(Little_Rock);
map.removeOverlays(Morrilton);
map.removeOverlays(North_Little_Rock);
map.removeOverlays(Paragould);
map.removeOverlays(Paris);
map.removeOverlays(Pine_Bluff);
map.removeOverlays(Pocahontas);
map.removeOverlays(Rogers);
map.removeOverlays(Russellville);
map.removeOverlays(Stuttgart);
map.removeOverlays(Subiaco);
map.removeOverlays(West_Memphis);
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(Jonesboro);map.removeOverlays(Benton);
map.removeOverlays(Blytheville);
map.removeOverlays(Conway);
map.removeOverlays(El_Dorado);
map.removeOverlays(Fayetteville);
map.removeOverlays(Fort_Smith);
map.removeOverlays(Hot_Springs);
map.removeOverlays(Jonesboro);
map.removeOverlays(Lake_Village);
map.removeOverlays(Little_Rock);
map.removeOverlays(Morrilton);
map.removeOverlays(North_Little_Rock);
map.removeOverlays(Paragould);
map.removeOverlays(Paris);
map.removeOverlays(Pine_Bluff);
map.removeOverlays(Pocahontas);
map.removeOverlays(Rogers);
map.removeOverlays(Russellville);
map.removeOverlays(Stuttgart);
map.removeOverlays(Subiaco);
map.removeOverlays(West_Memphis);
map.addOverlays(Benton);
centerByArray(Benton, false, false);
cntMarker += Benton.length;
map.addOverlays(Blytheville);
centerByArray(Blytheville, false, false);
cntMarker += Blytheville.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(Fayetteville);
centerByArray(Fayetteville, false, false);
cntMarker += Fayetteville.length;
map.addOverlays(Fort_Smith);
centerByArray(Fort_Smith, false, false);
cntMarker += Fort_Smith.length;
map.addOverlays(Hot_Springs);
centerByArray(Hot_Springs, false, false);
cntMarker += Hot_Springs.length;
map.addOverlays(Jonesboro);
centerByArray(Jonesboro, false, false);
cntMarker += Jonesboro.length;
map.addOverlays(Lake_Village);
centerByArray(Lake_Village, false, false);
cntMarker += Lake_Village.length;
map.addOverlays(Little_Rock);
centerByArray(Little_Rock, false, false);
cntMarker += Little_Rock.length;
map.addOverlays(Morrilton);
centerByArray(Morrilton, false, false);
cntMarker += Morrilton.length;
map.addOverlays(North_Little_Rock);
centerByArray(North_Little_Rock, false, false);
cntMarker += North_Little_Rock.length;
map.addOverlays(Paragould);
centerByArray(Paragould, false, false);
cntMarker += Paragould.length;
map.addOverlays(Paris);
centerByArray(Paris, false, false);
cntMarker += Paris.length;
map.addOverlays(Pine_Bluff);
centerByArray(Pine_Bluff, false, false);
cntMarker += Pine_Bluff.length;
map.addOverlays(Pocahontas);
centerByArray(Pocahontas, false, false);
cntMarker += Pocahontas.length;
map.addOverlays(Rogers);
centerByArray(Rogers, false, false);
cntMarker += Rogers.length;
map.addOverlays(Russellville);
centerByArray(Russellville, false, false);
cntMarker += Russellville.length;
map.addOverlays(Stuttgart);
centerByArray(Stuttgart, false, false);
cntMarker += Stuttgart.length;
map.addOverlays(Subiaco);
centerByArray(Subiaco, false, false);
cntMarker += Subiaco.length;
map.addOverlays(West_Memphis);
centerByArray(West_Memphis, false, false);
cntMarker += West_Memphis.length;
centerByArray(Jonesboro,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///980,1005,34005,946,963,976,977,994,951,916,980,911,978,860,917,972,974,848,983,861,952,953,973,989,963,915,918,986,982,984,979,988,987,993,975,912,985,/all');
//window.open('/map.php?type=2&schools=980,1005,34005,946,963,976,977,994,951,916,980,911,978,860,917,972,974,848,983,861,952,953,973,989,963,915,918,986,982,984,979,988,987,993,975,912,985,&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;
}