function addMarkers(){
mySelect = document.getElementById('selection');
Memphis = [];Chattanooga = [];Cleveland = [];Columbia = [];Clarksville = [];Nashville = [];Dyersburg = [];Knoxville = [];Madisonville = [];Cordova = [];Jackson = [];Cookeville = [];Tullahoma = [];Blountville = [];Goodlettsville = [];Harriman = [];Gallatin = [];Morristown = [];mySelect.options[mySelect.options.length] = new Option("Blountville Schools",'all=Blountville');
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("Cleveland Schools",'all=Cleveland');
mySelect.options[mySelect.options.length] = new Option("Columbia Schools",'all=Columbia');
mySelect.options[mySelect.options.length] = new Option("Cookeville Schools",'all=Cookeville');
mySelect.options[mySelect.options.length] = new Option("Cordova Schools",'all=Cordova');
mySelect.options[mySelect.options.length] = new Option("Dyersburg Schools",'all=Dyersburg');
mySelect.options[mySelect.options.length] = new Option("Gallatin Schools",'all=Gallatin');
mySelect.options[mySelect.options.length] = new Option("Goodlettsville Schools",'all=Goodlettsville');
mySelect.options[mySelect.options.length] = new Option("Harriman Schools",'all=Harriman');
mySelect.options[mySelect.options.length] = new Option("Jackson Schools",'all=Jackson');
mySelect.options[mySelect.options.length] = new Option("Knoxville Schools",'all=Knoxville');
mySelect.options[mySelect.options.length] = new Option("Madisonville Schools",'all=Madisonville');
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("Tullahoma Schools",'all=Tullahoma');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
var tmpLatLng=0;
var tmpLen=0;
tmpLatLng=new GLatLng(35.138949,-90.028189);
tmpLen=Memphis.length;
Memphis[tmpLen] = createMarker(tmpLatLng,"
",iconRd);
Memphis[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Baptist Memorial College Of Health Sciences",'Memphis=' + Memphis.length);
tmpLatLng=new GLatLng(35.09631799999999657,-85.2373369999999965);
tmpLen=Chattanooga.length;
Chattanooga[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Chattanooga[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Chattanooga State Technical Community College",'Chattanooga=' + Chattanooga.length);
tmpLatLng=new GLatLng(35.20401999999999986,-84.8766600000000011);
tmpLen=Cleveland.length;
Cleveland[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Cleveland[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Cleveland State Community College",'Cleveland=' + Cleveland.length);
tmpLatLng=new GLatLng(35.61844399999999666,-87.1007620000000031);
tmpLen=Columbia.length;
Columbia[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Columbia[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Columbia State Community College",'Columbia=' + Columbia.length);
tmpLatLng=new GLatLng(36.55556399999999683,-87.3223480000000051);
tmpLen=Clarksville.length;
Clarksville[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Clarksville[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Draughons Junior College",'Clarksville=' + Clarksville.length);
tmpLatLng=new GLatLng(36.16534000000000048,-86.7843170000000014);
tmpLen=Nashville.length;
Nashville[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Nashville[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Draughons Junior College Inc",'Nashville=' + Nashville.length);
tmpLatLng=new GLatLng(36.04681000000000068,-89.3927829999999943);
tmpLen=Dyersburg.length;
Dyersburg[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Dyersburg[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Dyersburg State Community College",'Dyersburg=' + Dyersburg.length);
tmpLatLng=new GLatLng(35.02243899999999854,-85.2423890000000028);
tmpLen=Chattanooga.length;
Chattanooga[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Chattanooga[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Electronic Computer Programming College Inc",'Chattanooga=' + Chattanooga.length);
tmpLatLng=new GLatLng(36.02841399999999794,-83.9216980000000063);
tmpLen=Knoxville.length;
Knoxville[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Knoxville[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Fountainhead College Of Technology",'Knoxville=' + Knoxville.length);
tmpLatLng=new GLatLng(35.55864199999999897,-84.3620540000000005);
tmpLen=Madisonville.length;
Madisonville[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Madisonville[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Hiwassee College",'Madisonville=' + Madisonville.length);
tmpLatLng=new GLatLng(35.14876900000000148,-90.0454560000000014);
tmpLen=Cordova.length;
Cordova[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Cordova[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Itt Technical Institute-cordova",'Cordova=' + Cordova.length);
tmpLatLng=new GLatLng(35.64790699999999645,-88.7962260000000043);
tmpLen=Jackson.length;
Jackson[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Jackson[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Jackson State Community College",'Jackson=' + Jackson.length);
tmpLatLng=new GLatLng(36.15655699999999939,-86.7945260000000047);
tmpLen=Nashville.length;
Nashville[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Nashville[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("John A Gupton College",'Nashville=' + Nashville.length);
tmpLatLng=new GLatLng(36.14226000000000027,-85.4781349999999946);
tmpLen=Cookeville.length;
Cookeville[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Cookeville[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Medvance Institute-cookeville",'Cookeville=' + Cookeville.length);
tmpLatLng=new GLatLng(36.55512800000000339,-87.3250670000000042);
tmpLen=Clarksville.length;
Clarksville[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Clarksville[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Miller-motte Technical College",'Clarksville=' + Clarksville.length);
tmpLatLng=new GLatLng(35.36515299999999939,-86.3009050000000002);
tmpLen=Tullahoma.length;
Tullahoma[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Tullahoma[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Motlow State Community College",'Tullahoma=' + Tullahoma.length);
tmpLatLng=new GLatLng(36.19411800000000312,-86.7436359999999950);
tmpLen=Nashville.length;
Nashville[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Nashville[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Nashville Auto Diesel College Inc",'Nashville=' + Nashville.length);
tmpLatLng=new GLatLng(36.13434199999999663,-86.8581140000000004);
tmpLen=Nashville.length;
Nashville[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Nashville[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Nashville State Technical Community College",'Nashville=' + Nashville.length);
tmpLatLng=new GLatLng(36.09150700000000000,-86.7349799999999930);
tmpLen=Nashville.length;
Nashville[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Nashville[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("National College Of Business And Technology-nashvi",'Nashville=' + Nashville.length);
tmpLatLng=new GLatLng(36.61560800000000170,-87.4263650000000041);
tmpLen=Clarksville.length;
Clarksville[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Clarksville[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("North Central Institute",'Clarksville=' + Clarksville.length);
tmpLatLng=new GLatLng(36.48460800000000148,-82.4101979999999940);
tmpLen=Blountville.length;
Blountville[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Blountville[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Northeast State Technical Community College",'Blountville=' + Blountville.length);
tmpLatLng=new GLatLng(36.30013900000000148,-86.7007729999999980);
tmpLen=Goodlettsville.length;
Goodlettsville[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Goodlettsville[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Nossi College Of Art",'Goodlettsville=' + Goodlettsville.length);
tmpLatLng=new GLatLng(35.94443199999999905,-84.1651839999999964);
tmpLen=Knoxville.length;
Knoxville[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Knoxville[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Pellissippi State Technical Community College",'Knoxville=' + Knoxville.length);
tmpLatLng=new GLatLng(35.87976299999999696,-84.6169689999999974);
tmpLen=Harriman.length;
Harriman[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Harriman[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Roane State Community College",'Harriman=' + Harriman.length);
tmpLatLng=new GLatLng(35.97743499999999983,-83.9165930000000059);
tmpLen=Knoxville.length;
Knoxville[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Knoxville[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("South College",'Knoxville=' + Knoxville.length);
tmpLatLng=new GLatLng(35.16298900000000315,-89.8638349999999945);
tmpLen=Memphis.length;
Memphis[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Memphis[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Southwest Tennessee Community College",'Memphis=' + Memphis.length);
tmpLatLng=new GLatLng(36.36240699999999748,-86.4952569999999951);
tmpLen=Gallatin.length;
Gallatin[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Gallatin[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Volunteer State Community College",'Gallatin=' + Gallatin.length);
tmpLatLng=new GLatLng(36.21134800000000098,-83.2618839999999948);
tmpLen=Morristown.length;
Morristown[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Morristown[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Walters State Community College",'Morristown=' + Morristown.length);
tmpLatLng=new GLatLng(36.19349299999999658,-86.8067159999999944);
tmpLen=Nashville.length;
Nashville[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Nashville[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Watkins College Of Art And Design",'Nashville=' + Nashville.length);
map.removeOverlays(Blountville);
map.removeOverlays(Chattanooga);
map.removeOverlays(Clarksville);
map.removeOverlays(Cleveland);
map.removeOverlays(Columbia);
map.removeOverlays(Cookeville);
map.removeOverlays(Cordova);
map.removeOverlays(Dyersburg);
map.removeOverlays(Gallatin);
map.removeOverlays(Goodlettsville);
map.removeOverlays(Harriman);
map.removeOverlays(Jackson);
map.removeOverlays(Knoxville);
map.removeOverlays(Madisonville);
map.removeOverlays(Memphis);
map.removeOverlays(Morristown);
map.removeOverlays(Nashville);
map.removeOverlays(Tullahoma);
setTimeout(function(){map.addOverlays(Blountville)},1000);
setTimeout(function(){map.addOverlays(Chattanooga)},1000);
setTimeout(function(){map.addOverlays(Clarksville)},1000);
setTimeout(function(){map.addOverlays(Cleveland)},1000);
setTimeout(function(){map.addOverlays(Columbia)},1000);
setTimeout(function(){map.addOverlays(Cookeville)},1000);
setTimeout(function(){map.addOverlays(Cordova)},1000);
setTimeout(function(){map.addOverlays(Dyersburg)},1000);
setTimeout(function(){map.addOverlays(Gallatin)},1000);
setTimeout(function(){map.addOverlays(Goodlettsville)},1000);
setTimeout(function(){map.addOverlays(Harriman)},1000);
setTimeout(function(){map.addOverlays(Jackson)},1000);
setTimeout(function(){map.addOverlays(Knoxville)},1000);
setTimeout(function(){map.addOverlays(Madisonville)},1000);
setTimeout(function(){map.addOverlays(Memphis)},1000);
setTimeout(function(){map.addOverlays(Morristown)},1000);
setTimeout(function(){map.addOverlays(Nashville)},1000);
setTimeout(function(){map.addOverlays(Tullahoma)},1000);
getPoly("","state","","TN");}
// End addStateMarkers JavaScript Function
//open all when map is defined
function openAll() {
if (map) {
selectChange("all");
} else {
setTimeout("openAll()",200);
}
}
// 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].point.x;
var markLat = myArray[i].point.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].point.x;
maxLat = myArray[0].point.y;
minLng = myArray[0].point.x;
minLat = myArray[0].point.y;
}
// Recenter map based on global max/mins
function reCenterMap(){
//alert('#' + minLat + '#' + minLng + '#' + maxLat + '#' + maxLng);
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) {
if (selection.options) {
var _openNewWindow=true;
var myVal = selection.options[selection.selectedIndex].value;
} else {
var _openNewWindow=false;
var myVal=selection;
}
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('schools-by-distance') == -1)
window.open(location.href + '/map/all');
else
window.open('/search////all');
map.removeOverlays(Blountville);
map.removeOverlays(Chattanooga);
map.removeOverlays(Clarksville);
map.removeOverlays(Cleveland);
map.removeOverlays(Columbia);
map.removeOverlays(Cookeville);
map.removeOverlays(Cordova);
map.removeOverlays(Dyersburg);
map.removeOverlays(Gallatin);
map.removeOverlays(Goodlettsville);
map.removeOverlays(Harriman);
map.removeOverlays(Jackson);
map.removeOverlays(Knoxville);
map.removeOverlays(Madisonville);
map.removeOverlays(Memphis);
map.removeOverlays(Morristown);
map.removeOverlays(Nashville);
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(Blountville);
map.removeOverlays(Chattanooga);
map.removeOverlays(Clarksville);
map.removeOverlays(Cleveland);
map.removeOverlays(Columbia);
map.removeOverlays(Cookeville);
map.removeOverlays(Cordova);
map.removeOverlays(Dyersburg);
map.removeOverlays(Gallatin);
map.removeOverlays(Goodlettsville);
map.removeOverlays(Harriman);
map.removeOverlays(Jackson);
map.removeOverlays(Knoxville);
map.removeOverlays(Madisonville);
map.removeOverlays(Memphis);
map.removeOverlays(Morristown);
map.removeOverlays(Nashville);
map.removeOverlays(Tullahoma);
map.addOverlays(Blountville);
centerByArray(Blountville, false, false);
cntMarker += Blountville.length;
map.addOverlays(Chattanooga);
centerByArray(Chattanooga, false, false);
cntMarker += Chattanooga.length;
map.addOverlays(Clarksville);
centerByArray(Clarksville, false, false);
cntMarker += Clarksville.length;
map.addOverlays(Cleveland);
centerByArray(Cleveland, false, false);
cntMarker += Cleveland.length;
map.addOverlays(Columbia);
centerByArray(Columbia, false, false);
cntMarker += Columbia.length;
map.addOverlays(Cookeville);
centerByArray(Cookeville, false, false);
cntMarker += Cookeville.length;
map.addOverlays(Cordova);
centerByArray(Cordova, false, false);
cntMarker += Cordova.length;
map.addOverlays(Dyersburg);
centerByArray(Dyersburg, false, false);
cntMarker += Dyersburg.length;
map.addOverlays(Gallatin);
centerByArray(Gallatin, false, false);
cntMarker += Gallatin.length;
map.addOverlays(Goodlettsville);
centerByArray(Goodlettsville, false, false);
cntMarker += Goodlettsville.length;
map.addOverlays(Harriman);
centerByArray(Harriman, false, false);
cntMarker += Harriman.length;
map.addOverlays(Jackson);
centerByArray(Jackson, false, false);
cntMarker += Jackson.length;
map.addOverlays(Knoxville);
centerByArray(Knoxville, false, false);
cntMarker += Knoxville.length;
map.addOverlays(Madisonville);
centerByArray(Madisonville, false, false);
cntMarker += Madisonville.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(Tullahoma);
centerByArray(Tullahoma, false, false);
cntMarker += Tullahoma.length;
reCenterMap();
//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');
}
}
function createMarker(point, label, icon){
var marker = new GMarker(point, icon);
var html = label;
GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); });
return marker;
}