function addMarkers()
{
mySelect = document.getElementById('selection');
Durham = [];Durham[Durham.length] = createMarker(new GPoint(-78.83850098,35.94208145),"
",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bethesda Elementary School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.90798950,36.02546310),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Brogden Middle School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.88787842,35.97967529),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Burton Elementary School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.90586853,35.97913742),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("C C Spaulding Elementary School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.96106720,35.92369461),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("C E Jordan High School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.91287994,36.01694489),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Carter Community Charter",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.89759827,35.99840164),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Central Park School For Child",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.82752228,36.09524536),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Chewning Middle School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.89612579,36.01905060),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Club Boulevard Elementary School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.87857819,35.98904037),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Communities In Sch Academy",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.99312400,35.92955500),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Creekside Elementary School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.89880371,35.99380112),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Dps Hospital School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.90616608,36.00245667),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Durham Sch Of Arts",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.92248900,36.01294700),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("E K Powe Elementary School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.89556900,35.97040800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Early College High School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.92792511,36.07632065),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Easley Elementary School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.88594818,35.99062347),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Eastway Elementary School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.91130829,36.08592606),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Eno Valley Elementary School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.90592957,35.96493912),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Fayetteville Street Elementary School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.98878479,35.98933792),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Forest View Elementary School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.91254425,36.08662796),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("George L Carrington Middle School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.91092682,36.00783539),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("George Watts Elementary School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.83988953,36.02703476),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Glenn Elementary School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.91300201,35.99664307),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Healthy Start Academy",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.93560028,36.04547119),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hillandale Elementary School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.90484619,35.95217896),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hillside High School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.90537262,36.05467606),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Holt Elementary School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.93972778,35.96781921),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hope Valley Elementary School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.90016174,35.96630859),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("James E Shepard Middle School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.92542267,35.98764801),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Kestrel Heights School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.87788391,36.03823471),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lakeview School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.93390656,35.98292160),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lakewood Elementary School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.86575317,36.09876251),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Little River Elementary School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-83.97538400,40.60419900),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Lowe's Grove Middle School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.89002991,36.03533936),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Maureen Joy Charter",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.85434723,36.00471497),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Merrick-moore Elementary School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.88068800,35.97538100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Middle College High School @ Dtcc",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.91334534,35.98906326),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Morehead Montessori",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.89880371,35.99380112),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Nc School Of Science And Math",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.78089142,35.97776413),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Neal Middle School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.91183472,36.09486389),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Northern High School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.82067871,35.98117828),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Oak Grove Elementary School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.89880371,35.99380112),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Omuteko Gwamaziima Elementary School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.90796661,35.89152908),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Parkwood Elementary School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.90875244,35.93308258),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pearsontown Elementary School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.88262939,35.97225189),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("R N Harris Elementary School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.85128784,35.93829727),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Research Triangle Charter",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.94445801,36.06231689),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Riverside High School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.93354034,35.97329712),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Rogers-herr Middle School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.92182159,35.99283981),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Sherwood Githens Middle School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.83232880,36.00178909),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Southern High School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.92173767,35.92935944),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Southwest Elementary School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.85216522,35.98873138),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Success Academy",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.85216522,35.98873138),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Turning Point Academy",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.89733124,35.98266220),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("W G Pearson Elementary School",'Durham=' + Durham.length);
Durham[Durham.length] = createMarker(new GPoint(-78.87351990,35.98596191),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Y E Smith Elementary School",'Durham=' + Durham.length);
maxLng = -78.78089142;
maxLat = 40.60419900;
minLng = -83.97538400;
minLat = 35.89152908;
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,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)
{
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(Durham);
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(Durham);map.removeOverlays(Durham);
map.addOverlays(Durham);
centerByArray(Durham, false, false);
cntMarker += Durham.length;
centerByArray(Durham,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////all');
}
}