function addMarkers(){
mySelect = document.getElementById('selection');
Memphis = [];Nashville = [];Chattanooga = [];Germantown = [];Hendersonville = [];Knoxville = [];Lawrenceburg = [];Loretto = [];Bartlett = [];Cordova = [];Jackson = [];Oak_Ridge = [];Decherd = [];Kingsport = [];Gallatin = [];Madison = [];Clarksville = [];Johnson_City = [];Franklin = [];Mc_Ewen = [];Tullahoma = [];Murfreesboro = [];mySelect.options[mySelect.options.length] = new Option("Bartlett schools",'all=Bartlett');
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("Decherd schools",'all=Decherd');
mySelect.options[mySelect.options.length] = new Option("Franklin schools",'all=Franklin');
mySelect.options[mySelect.options.length] = new Option("Gallatin schools",'all=Gallatin');
mySelect.options[mySelect.options.length] = new Option("Germantown schools",'all=Germantown');
mySelect.options[mySelect.options.length] = new Option("Hendersonville schools",'all=Hendersonville');
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("Kingsport schools",'all=Kingsport');
mySelect.options[mySelect.options.length] = new Option("Knoxville schools",'all=Knoxville');
mySelect.options[mySelect.options.length] = new Option("Lawrenceburg schools",'all=Lawrenceburg');
mySelect.options[mySelect.options.length] = new Option("Loretto schools",'all=Loretto');
mySelect.options[mySelect.options.length] = new Option("Madison schools",'all=Madison');
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("Murfreesboro schools",'all=Murfreesboro');
mySelect.options[mySelect.options.length] = new Option("Nashville schools",'all=Nashville');
mySelect.options[mySelect.options.length] = new Option("Oak Ridge schools",'all=Oak_Ridge');
mySelect.options[mySelect.options.length] = new Option("Tullahoma schools",'all=Tullahoma');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Memphis[Memphis.length] = createMarker(new GPoint(-90.01468600,35.02086300),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bishop Byrne Middle High School",'Memphis=' + Memphis.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);
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);
Memphis[Memphis.length] = createMarker(new GPoint(-90.00431100,35.12612400),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Immaculate Comception Mid. - High School",'Memphis=' + Memphis.length);
Memphis[Memphis.length] = createMarker(new GPoint(-90.00666700,35.12616300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Immaculate Conception Elementa",'Memphis=' + Memphis.length);
Memphis[Memphis.length] = createMarker(new GPoint(-89.99963300,35.13928000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Memphis Cath High School - Middle School",'Memphis=' + Memphis.length);
Chattanooga[Chattanooga.length] = createMarker(new GPoint(-85.25971200,35.03718100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Notre Dame High School",'Chattanooga=' + Chattanooga.length);
Germantown[Germantown.length] = createMarker(new GPoint(-89.79179200,35.08434700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Our Lady Of Perpetual Help",'Germantown=' + Germantown.length);
Chattanooga[Chattanooga.length] = createMarker(new GPoint(-85.23265000,35.00515000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Our Lady Of Perpetual Help School",'Chattanooga=' + Chattanooga.length);
Memphis[Memphis.length] = createMarker(new GPoint(-90.02208400,35.22643300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Our Lady Of Sorrows Elementary School",'Memphis=' + Memphis.length);
Nashville[Nashville.length] = createMarker(new GPoint(-86.83995800,36.12972200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Overbrook School",'Nashville=' + Nashville.length);
Hendersonville[Hendersonville.length] = createMarker(new GPoint(-86.66716600,36.31668600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pope John Paul II High School",'Hendersonville=' + Hendersonville.length);
Knoxville[Knoxville.length] = createMarker(new GPoint(-83.99948800,35.92625800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sacred Heart Cathedral School",'Knoxville=' + Knoxville.length);
Lawrenceburg[Lawrenceburg.length] = createMarker(new GPoint(-87.33510300,35.24603700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sacred Heart Elementary School",'Lawrenceburg=' + Lawrenceburg.length);
Loretto[Loretto.length] = createMarker(new GPoint(-87.42440000,35.07510000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sacred Heart School",'Loretto=' + Loretto.length);
Memphis[Memphis.length] = createMarker(new GPoint(-89.90123600,35.13107900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Agnes Academy-st Dominic School",'Memphis=' + Memphis.length);
Bartlett[Bartlett.length] = createMarker(new GPoint(-89.84557100,35.20456300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Ann Elementary School",'Bartlett=' + Bartlett.length);
Memphis[Memphis.length] = createMarker(new GPoint(-89.94573600,35.11316700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Anne Catholic School, Highland",'Memphis=' + Memphis.length);
Memphis[Memphis.length] = createMarker(new GPoint(-90.02341000,35.10676300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Augustine Catholic School",'Memphis=' + Memphis.length);
Cordova[Cordova.length] = createMarker(new GPoint(-89.79058600,35.18760600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Benedict At Auburndale",'Cordova=' + Cordova.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);
Memphis[Memphis.length] = createMarker(new GPoint(-89.90249900,35.13185100),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("St. Dominic School For Boys",'Memphis=' + Memphis.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.26627700,35.11693100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Jude Elementary School",'Chattanooga=' + Chattanooga.length);
Memphis[Memphis.length] = createMarker(new GPoint(-89.88855100,35.12420100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Louis Elementary School",'Memphis=' + Memphis.length);
Jackson[Jackson.length] = createMarker(new GPoint(-88.85269700,35.65177900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Marys School",'Jackson=' + Jackson.length);
Oak_Ridge[Oak_Ridge.length] = createMarker(new GPoint(-84.25332500,36.01706700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Marys School",'Oak_Ridge=' + Oak_Ridge.length);
Memphis[Memphis.length] = createMarker(new GPoint(-90.01646300,35.02078100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Paul Elementary School",'Memphis=' + Memphis.length);
Decherd[Decherd.length] = createMarker(new GPoint(-86.09457400,35.20800800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("School Of The Good Shepherd",'Decherd=' + Decherd.length);
Kingsport[Kingsport.length] = createMarker(new GPoint(-82.53454500,36.53965500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Dominic School",'Kingsport=' + Kingsport.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);
Knoxville[Knoxville.length] = createMarker(new GPoint(-84.19267000,35.88546300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St John Neumann School",'Knoxville=' + Knoxville.length);
Gallatin[Gallatin.length] = createMarker(new GPoint(-86.44648500,36.39482200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St John Vianney Catholic School",'Gallatin=' + Gallatin.length);
Knoxville[Knoxville.length] = createMarker(new GPoint(-83.94930500,36.02998500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Joseph Elementary School",'Knoxville=' + Knoxville.length);
Madison[Madison.length] = createMarker(new GPoint(-86.72131800,36.24620000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Joseph School",'Madison=' + Madison.length);
Clarksville[Clarksville.length] = createMarker(new GPoint(-87.30264700,36.51454400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Mary S Catholic School",'Clarksville=' + Clarksville.length);
Johnson_City[Johnson_City.length] = createMarker(new GPoint(-82.35064700,36.35276600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Mary School",'Johnson_City=' + Johnson_City.length);
Franklin[Franklin.length] = createMarker(new GPoint(-86.95590900,36.03063000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Matthew Catholic School",'Franklin=' + Franklin.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);
Tullahoma[Tullahoma.length] = createMarker(new GPoint(-86.21560000,35.36406300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Paul The Apostle School",'Tullahoma=' + Tullahoma.length);
Murfreesboro[Murfreesboro.length] = createMarker(new GPoint(-86.36931900,35.86467600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Rose Of Lima Catholic School",'Murfreesboro=' + Murfreesboro.length);
Nashville[Nashville.length] = createMarker(new GPoint(-86.80529500,36.17207100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Vincent School",'Nashville=' + Nashville.length);
map.removeOverlays(Bartlett);
map.removeOverlays(Chattanooga);
map.removeOverlays(Clarksville);
map.removeOverlays(Cordova);
map.removeOverlays(Decherd);
map.removeOverlays(Franklin);
map.removeOverlays(Gallatin);
map.removeOverlays(Germantown);
map.removeOverlays(Hendersonville);
map.removeOverlays(Jackson);
map.removeOverlays(Johnson_City);
map.removeOverlays(Kingsport);
map.removeOverlays(Knoxville);
map.removeOverlays(Lawrenceburg);
map.removeOverlays(Loretto);
map.removeOverlays(Madison);
map.removeOverlays(Mc_Ewen);
map.removeOverlays(Memphis);
map.removeOverlays(Murfreesboro);
map.removeOverlays(Nashville);
map.removeOverlays(Oak_Ridge);
map.removeOverlays(Tullahoma);
setTimeout(function(){map.addOverlays(Bartlett)},1000);
setTimeout(function(){map.addOverlays(Chattanooga)},1000);
setTimeout(function(){map.addOverlays(Clarksville)},1000);
setTimeout(function(){map.addOverlays(Cordova)},1000);
setTimeout(function(){map.addOverlays(Decherd)},1000);
setTimeout(function(){map.addOverlays(Franklin)},1000);
setTimeout(function(){map.addOverlays(Gallatin)},1000);
setTimeout(function(){map.addOverlays(Germantown)},1000);
setTimeout(function(){map.addOverlays(Hendersonville)},1000);
setTimeout(function(){map.addOverlays(Jackson)},1000);
setTimeout(function(){map.addOverlays(Johnson_City)},1000);
setTimeout(function(){map.addOverlays(Kingsport)},1000);
setTimeout(function(){map.addOverlays(Knoxville)},1000);
setTimeout(function(){map.addOverlays(Lawrenceburg)},1000);
setTimeout(function(){map.addOverlays(Loretto)},1000);
setTimeout(function(){map.addOverlays(Madison)},1000);
setTimeout(function(){map.addOverlays(Mc_Ewen)},1000);
setTimeout(function(){map.addOverlays(Memphis)},1000);
setTimeout(function(){map.addOverlays(Murfreesboro)},1000);
setTimeout(function(){map.addOverlays(Nashville)},1000);
setTimeout(function(){map.addOverlays(Oak_Ridge)},1000);
setTimeout(function(){map.addOverlays(Tullahoma)},1000);
maxLng = -82.35064700;
maxLat = 36.53965500;
minLng = -90.02341000;
minLat = 35.00515000;
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(Bartlett);
map.removeOverlays(Chattanooga);
map.removeOverlays(Clarksville);
map.removeOverlays(Cordova);
map.removeOverlays(Decherd);
map.removeOverlays(Franklin);
map.removeOverlays(Gallatin);
map.removeOverlays(Germantown);
map.removeOverlays(Hendersonville);
map.removeOverlays(Jackson);
map.removeOverlays(Johnson_City);
map.removeOverlays(Kingsport);
map.removeOverlays(Knoxville);
map.removeOverlays(Lawrenceburg);
map.removeOverlays(Loretto);
map.removeOverlays(Madison);
map.removeOverlays(Mc_Ewen);
map.removeOverlays(Memphis);
map.removeOverlays(Murfreesboro);
map.removeOverlays(Nashville);
map.removeOverlays(Oak_Ridge);
map.removeOverlays(Tullahoma);
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(Memphis);map.removeOverlays(Bartlett);
map.removeOverlays(Chattanooga);
map.removeOverlays(Clarksville);
map.removeOverlays(Cordova);
map.removeOverlays(Decherd);
map.removeOverlays(Franklin);
map.removeOverlays(Gallatin);
map.removeOverlays(Germantown);
map.removeOverlays(Hendersonville);
map.removeOverlays(Jackson);
map.removeOverlays(Johnson_City);
map.removeOverlays(Kingsport);
map.removeOverlays(Knoxville);
map.removeOverlays(Lawrenceburg);
map.removeOverlays(Loretto);
map.removeOverlays(Madison);
map.removeOverlays(Mc_Ewen);
map.removeOverlays(Memphis);
map.removeOverlays(Murfreesboro);
map.removeOverlays(Nashville);
map.removeOverlays(Oak_Ridge);
map.removeOverlays(Tullahoma);
map.addOverlays(Bartlett);
centerByArray(Bartlett, false, false);
cntMarker += Bartlett.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(Decherd);
centerByArray(Decherd, false, false);
cntMarker += Decherd.length;
map.addOverlays(Franklin);
centerByArray(Franklin, false, false);
cntMarker += Franklin.length;
map.addOverlays(Gallatin);
centerByArray(Gallatin, false, false);
cntMarker += Gallatin.length;
map.addOverlays(Germantown);
centerByArray(Germantown, false, false);
cntMarker += Germantown.length;
map.addOverlays(Hendersonville);
centerByArray(Hendersonville, false, false);
cntMarker += Hendersonville.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(Kingsport);
centerByArray(Kingsport, false, false);
cntMarker += Kingsport.length;
map.addOverlays(Knoxville);
centerByArray(Knoxville, false, false);
cntMarker += Knoxville.length;
map.addOverlays(Lawrenceburg);
centerByArray(Lawrenceburg, false, false);
cntMarker += Lawrenceburg.length;
map.addOverlays(Loretto);
centerByArray(Loretto, false, false);
cntMarker += Loretto.length;
map.addOverlays(Madison);
centerByArray(Madison, false, false);
cntMarker += Madison.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(Murfreesboro);
centerByArray(Murfreesboro, false, false);
cntMarker += Murfreesboro.length;
map.addOverlays(Nashville);
centerByArray(Nashville, false, false);
cntMarker += Nashville.length;
map.addOverlays(Oak_Ridge);
centerByArray(Oak_Ridge, false, false);
cntMarker += Oak_Ridge.length;
map.addOverlays(Tullahoma);
centerByArray(Tullahoma, false, false);
cntMarker += Tullahoma.length;
centerByArray(Memphis,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///26227,26236,26290,35582,25939,26125,26181,26284,26047,26286,26236,26299,36092,26267,36093,34129,26234,26305,26302,26314,26260,26297,26298,26261,26262,26315,26316,26126,26235,26284,26288,26289,26293,26300,26308,34128,25982,26237,26291,26294,26296,26313,26304,26309,/all');
//window.open('/map.php?type=2&schools=26227,26236,26290,35582,25939,26125,26181,26284,26047,26286,26236,26299,36092,26267,36093,34129,26234,26305,26302,26314,26260,26297,26298,26261,26262,26315,26316,26126,26235,26284,26288,26289,26293,26300,26308,34128,25982,26237,26291,26294,26296,26313,26304,26309,&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;
}