function addMarkers(){
mySelect = document.getElementById('selection');
Nashville = [];Morristown = [];Johnson_City = [];Franklin = [];Chattanooga = [];Memphis = [];Eads = [];Knoxville = [];Clarksville = [];Summertown = [];Cordova = [];Grand_Junction = [];Germantown = [];Mc_Ewen = [];Bristol = [];Jackson = [];mySelect.options[mySelect.options.length] = new Option("Bristol schools",'all=Bristol');
mySelect.options[mySelect.options.length] = new Option("Chattanooga schools",'all=Chattanooga');
mySelect.options[mySelect.options.length] = new Option("Clarksville schools",'all=Clarksville');
mySelect.options[mySelect.options.length] = new Option("Cordova schools",'all=Cordova');
mySelect.options[mySelect.options.length] = new Option("Eads schools",'all=Eads');
mySelect.options[mySelect.options.length] = new Option("Franklin schools",'all=Franklin');
mySelect.options[mySelect.options.length] = new Option("Germantown schools",'all=Germantown');
mySelect.options[mySelect.options.length] = new Option("Grand Junction schools",'all=Grand_Junction');
mySelect.options[mySelect.options.length] = new Option("Jackson schools",'all=Jackson');
mySelect.options[mySelect.options.length] = new Option("Johnson City schools",'all=Johnson_City');
mySelect.options[mySelect.options.length] = new Option("Knoxville schools",'all=Knoxville');
mySelect.options[mySelect.options.length] = new Option("Mc Ewen schools",'all=Mc_Ewen');
mySelect.options[mySelect.options.length] = new Option("Memphis schools",'all=Memphis');
mySelect.options[mySelect.options.length] = new Option("Morristown schools",'all=Morristown');
mySelect.options[mySelect.options.length] = new Option("Nashville schools",'all=Nashville');
mySelect.options[mySelect.options.length] = new Option("Summertown schools",'all=Summertown');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Nashville[Nashville.length] = createMarker(new GPoint(-86.89276900,36.08426200),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Akiva School",'Nashville=' + Nashville.length);
Morristown[Morristown.length] = createMarker(new GPoint(-83.33733500,36.18186300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("All Saint's Episcopal School",'Morristown=' + Morristown.length);
Johnson_City[Johnson_City.length] = createMarker(new GPoint(-82.38195000,36.32369900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ashley Academy",'Johnson_City=' + Johnson_City.length);
Franklin[Franklin.length] = createMarker(new GPoint(-86.86168900,35.94858300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Battle Ground Academy",'Franklin=' + Franklin.length);
Chattanooga[Chattanooga.length] = createMarker(new GPoint(-85.30810000,35.04550000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Baylor School",'Chattanooga=' + Chattanooga.length);
Memphis[Memphis.length] = createMarker(new GPoint(-89.84142500,35.11943000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bornblum Solomon Schechter School",'Memphis=' + Memphis.length);
Eads[Eads.length] = createMarker(new GPoint(-89.72804900,35.12950000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Briarcrest Christian High School",'Eads=' + Eads.length);
Eads[Eads.length] = createMarker(new GPoint(-89.72305900,35.11709000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Briarcrest Christian School",'Eads=' + Eads.length);
Memphis[Memphis.length] = createMarker(new GPoint(-89.86173300,35.10669500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Briarcrest Christian School - East Memphis Campus",'Memphis=' + Memphis.length);
Chattanooga[Chattanooga.length] = createMarker(new GPoint(-85.23443200,35.00789200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Calvary Christian School",'Chattanooga=' + Chattanooga.length);
Nashville[Nashville.length] = createMarker(new GPoint(-86.79684800,36.11815900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Christ The King School",'Nashville=' + Nashville.length);
Memphis[Memphis.length] = createMarker(new GPoint(-89.91204100,35.12010000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Christ Methodist Day School",'Memphis=' + Memphis.length);
Knoxville[Knoxville.length] = createMarker(new GPoint(-84.10218300,35.92590900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Christian Academy of Knoxville",'Knoxville=' + Knoxville.length);
Clarksville[Clarksville.length] = createMarker(new GPoint(-87.36204300,36.53657700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Clarksville Academy",'Clarksville=' + Clarksville.length);
Nashville[Nashville.length] = createMarker(new GPoint(-86.77533400,36.27941200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Davidson Academy",'Nashville=' + Nashville.length);
Nashville[Nashville.length] = createMarker(new GPoint(-86.83993800,36.12439700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Ensworth School",'Nashville=' + Nashville.length);
Summertown[Summertown.length] = createMarker(new GPoint(-87.32880100,35.47871900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Farm School",'Summertown=' + Summertown.length);
Nashville[Nashville.length] = createMarker(new GPoint(-86.76836900,36.09923600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Father Ryan High School",'Nashville=' + Nashville.length);
Chattanooga[Chattanooga.length] = createMarker(new GPoint(-85.13587600,35.03521800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Grace Baptist Academy",'Chattanooga=' + Chattanooga.length);
Nashville[Nashville.length] = createMarker(new GPoint(-86.86672100,36.10197700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Harding Academy",'Nashville=' + Nashville.length);
Cordova[Cordova.length] = createMarker(new GPoint(-89.78403300,35.15617700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Harding Academy Cordova Kindergarten",'Cordova=' + Cordova.length);
Memphis[Memphis.length] = createMarker(new GPoint(-89.92938900,35.17819500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Heritage Baptist Academy",'Memphis=' + Memphis.length);
Memphis[Memphis.length] = createMarker(new GPoint(-89.85850400,35.09172900),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hutchison School",'Memphis=' + Memphis.length);
Cordova[Cordova.length] = createMarker(new GPoint(-89.77647000,35.15475500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lamplighter School",'Cordova=' + Cordova.length);
Memphis[Memphis.length] = createMarker(new GPoint(-89.85625600,35.09959300),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Memphis University School",'Memphis=' + Memphis.length);
Nashville[Nashville.length] = createMarker(new GPoint(-86.83785200,36.13020800),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Montgomery Bell Academy",'Nashville=' + Nashville.length);
Grand_Junction[Grand_Junction.length] = createMarker(new GPoint(-89.02470000,35.10540000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("New Life Christian Academy",'Grand_Junction=' + Grand_Junction.length);
Nashville[Nashville.length] = createMarker(new GPoint(-86.77273700,36.08133900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Oak Hill School",'Nashville=' + Nashville.length);
Memphis[Memphis.length] = createMarker(new GPoint(-89.92795500,35.12401600),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Presbyterian Day School",'Memphis=' + Memphis.length);
Nashville[Nashville.length] = createMarker(new GPoint(-86.74089100,36.10280300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Radnor Baptist Academy",'Nashville=' + Nashville.length);
Nashville[Nashville.length] = createMarker(new GPoint(-86.80562000,36.13261600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Bernard Academy",'Nashville=' + Nashville.length);
Nashville[Nashville.length] = createMarker(new GPoint(-86.88650700,36.09188200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Saint Henry Catholic School",'Nashville=' + Nashville.length);
Chattanooga[Chattanooga.length] = createMarker(new GPoint(-85.14195200,35.04352200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Nicholas School",'Chattanooga=' + Chattanooga.length);
Chattanooga[Chattanooga.length] = createMarker(new GPoint(-85.31957300,35.11531100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Scenic Land School",'Chattanooga=' + Chattanooga.length);
Nashville[Nashville.length] = createMarker(new GPoint(-86.84872100,36.15181300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Ann School",'Nashville=' + Nashville.length);
Nashville[Nashville.length] = createMarker(new GPoint(-86.73959700,36.11064700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Edward Elementary School",'Nashville=' + Nashville.length);
Germantown[Germantown.length] = createMarker(new GPoint(-89.78758900,35.08243200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St George's Independent School",'Germantown=' + Germantown.length);
Memphis[Memphis.length] = createMarker(new GPoint(-90.05027900,35.16940500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St George's Independent School, Memphis",'Memphis=' + Memphis.length);
Memphis[Memphis.length] = createMarker(new GPoint(-89.90855700,35.12956500),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("St Mary's Episcopal School",'Memphis=' + Memphis.length);
Mc_Ewen[Mc_Ewen.length] = createMarker(new GPoint(-87.63749800,36.11001100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Patrick Catholic School",'Mc_Ewen=' + Mc_Ewen.length);
Bristol[Bristol.length] = createMarker(new GPoint(-82.17465500,36.58604800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Tennessee Avenue Christian Academy",'Bristol=' + Bristol.length);
Knoxville[Knoxville.length] = createMarker(new GPoint(-83.93682000,35.95393200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Thackston School",'Knoxville=' + Knoxville.length);
Jackson[Jackson.length] = createMarker(new GPoint(-88.88723200,35.70301600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("University School of Jackson",'Jackson=' + Jackson.length);
map.removeOverlays(Bristol);
map.removeOverlays(Chattanooga);
map.removeOverlays(Clarksville);
map.removeOverlays(Cordova);
map.removeOverlays(Eads);
map.removeOverlays(Franklin);
map.removeOverlays(Germantown);
map.removeOverlays(Grand_Junction);
map.removeOverlays(Jackson);
map.removeOverlays(Johnson_City);
map.removeOverlays(Knoxville);
map.removeOverlays(Mc_Ewen);
map.removeOverlays(Memphis);
map.removeOverlays(Morristown);
map.removeOverlays(Nashville);
map.removeOverlays(Summertown);
setTimeout(function(){map.addOverlays(Bristol)},1000);
setTimeout(function(){map.addOverlays(Chattanooga)},1000);
setTimeout(function(){map.addOverlays(Clarksville)},1000);
setTimeout(function(){map.addOverlays(Cordova)},1000);
setTimeout(function(){map.addOverlays(Eads)},1000);
setTimeout(function(){map.addOverlays(Franklin)},1000);
setTimeout(function(){map.addOverlays(Germantown)},1000);
setTimeout(function(){map.addOverlays(Grand_Junction)},1000);
setTimeout(function(){map.addOverlays(Jackson)},1000);
setTimeout(function(){map.addOverlays(Johnson_City)},1000);
setTimeout(function(){map.addOverlays(Knoxville)},1000);
setTimeout(function(){map.addOverlays(Mc_Ewen)},1000);
setTimeout(function(){map.addOverlays(Memphis)},1000);
setTimeout(function(){map.addOverlays(Morristown)},1000);
setTimeout(function(){map.addOverlays(Nashville)},1000);
setTimeout(function(){map.addOverlays(Summertown)},1000);
maxLng = -82.17465500;
maxLat = 36.58604800;
minLng = -90.05027900;
minLat = 35.00789200;
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(Bristol);
map.removeOverlays(Chattanooga);
map.removeOverlays(Clarksville);
map.removeOverlays(Cordova);
map.removeOverlays(Eads);
map.removeOverlays(Franklin);
map.removeOverlays(Germantown);
map.removeOverlays(Grand_Junction);
map.removeOverlays(Jackson);
map.removeOverlays(Johnson_City);
map.removeOverlays(Knoxville);
map.removeOverlays(Mc_Ewen);
map.removeOverlays(Memphis);
map.removeOverlays(Morristown);
map.removeOverlays(Nashville);
map.removeOverlays(Summertown);
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(Nashville);map.removeOverlays(Bristol);
map.removeOverlays(Chattanooga);
map.removeOverlays(Clarksville);
map.removeOverlays(Cordova);
map.removeOverlays(Eads);
map.removeOverlays(Franklin);
map.removeOverlays(Germantown);
map.removeOverlays(Grand_Junction);
map.removeOverlays(Jackson);
map.removeOverlays(Johnson_City);
map.removeOverlays(Knoxville);
map.removeOverlays(Mc_Ewen);
map.removeOverlays(Memphis);
map.removeOverlays(Morristown);
map.removeOverlays(Nashville);
map.removeOverlays(Summertown);
map.addOverlays(Bristol);
centerByArray(Bristol, false, false);
cntMarker += Bristol.length;
map.addOverlays(Chattanooga);
centerByArray(Chattanooga, false, false);
cntMarker += Chattanooga.length;
map.addOverlays(Clarksville);
centerByArray(Clarksville, false, false);
cntMarker += Clarksville.length;
map.addOverlays(Cordova);
centerByArray(Cordova, false, false);
cntMarker += Cordova.length;
map.addOverlays(Eads);
centerByArray(Eads, false, false);
cntMarker += Eads.length;
map.addOverlays(Franklin);
centerByArray(Franklin, false, false);
cntMarker += Franklin.length;
map.addOverlays(Germantown);
centerByArray(Germantown, false, false);
cntMarker += Germantown.length;
map.addOverlays(Grand_Junction);
centerByArray(Grand_Junction, false, false);
cntMarker += Grand_Junction.length;
map.addOverlays(Jackson);
centerByArray(Jackson, false, false);
cntMarker += Jackson.length;
map.addOverlays(Johnson_City);
centerByArray(Johnson_City, false, false);
cntMarker += Johnson_City.length;
map.addOverlays(Knoxville);
centerByArray(Knoxville, false, false);
cntMarker += Knoxville.length;
map.addOverlays(Mc_Ewen);
centerByArray(Mc_Ewen, false, false);
cntMarker += Mc_Ewen.length;
map.addOverlays(Memphis);
centerByArray(Memphis, false, false);
cntMarker += Memphis.length;
map.addOverlays(Morristown);
centerByArray(Morristown, false, false);
cntMarker += Morristown.length;
map.addOverlays(Nashville);
centerByArray(Nashville, false, false);
cntMarker += Nashville.length;
map.addOverlays(Summertown);
centerByArray(Summertown, false, false);
cntMarker += Summertown.length;
centerByArray(Nashville,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///26328,25928,25959,26069,26266,25998,34474,25949,25927,30520,25986,26344,26121,26185,26303,26016,26334,26047,26201,26252,26335,26328,25928,25959,26069,26307,26266,25998,26088,26152,25949,25927,35718,26222,30520,25921,25986,26331,26316,25943,36083,25980,26344,26121,26249,35717,26303,25915,25913,25982,26016,26334,26087,26228,26252,26291,26287,26294,26296,26335,/all');
//window.open('/map.php?type=2&schools=26328,25928,25959,26069,26266,25998,34474,25949,25927,30520,25986,26344,26121,26185,26303,26016,26334,26047,26201,26252,26335,26328,25928,25959,26069,26307,26266,25998,26088,26152,25949,25927,35718,26222,30520,25921,25986,26331,26316,25943,36083,25980,26344,26121,26249,35717,26303,25915,25913,25982,26016,26334,26087,26228,26252,26291,26287,26294,26296,26335,&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;
}