function addMarkers()
{
mySelect = document.getElementById('selection');
Arcadia = [];Arlington = [];Findlay = [];Rawson = [];Mccomb = [];Mt_Blanchard = [];Van_Buren = [];Vanlue = [];mySelect.options[mySelect.options.length] = new Option("Arcadia schools",'all=Arcadia');
mySelect.options[mySelect.options.length] = new Option("Arlington schools",'all=Arlington');
mySelect.options[mySelect.options.length] = new Option("Findlay schools",'all=Findlay');
mySelect.options[mySelect.options.length] = new Option("Mccomb schools",'all=Mccomb');
mySelect.options[mySelect.options.length] = new Option("Mt Blanchard schools",'all=Mt_Blanchard');
mySelect.options[mySelect.options.length] = new Option("Rawson schools",'all=Rawson');
mySelect.options[mySelect.options.length] = new Option("Van Buren schools",'all=Van_Buren');
mySelect.options[mySelect.options.length] = new Option("Vanlue schools",'all=Vanlue');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Arcadia[Arcadia.length] = createMarker(new GPoint(-83.51535034,41.10781097),"
",iconRd);
mySelect.options[mySelect.options.length] = new Option("Arcadia Elementary School",'Arcadia=' + Arcadia.length);
Arcadia[Arcadia.length] = createMarker(new GPoint(-83.51535034,41.10781097),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Arcadia High School",'Arcadia=' + Arcadia.length);
Arcadia[Arcadia.length] = createMarker(new GPoint(-83.51531800,41.10792200),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Arcadia Middle School",'Arcadia=' + Arcadia.length);
Arlington[Arlington.length] = createMarker(new GPoint(-83.63710022,40.89300156),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Arlington Local Elementary School",'Arlington=' + Arlington.length);
Arlington[Arlington.length] = createMarker(new GPoint(-83.63710022,40.89300156),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Arlington Local High School",'Arlington=' + Arlington.length);
Findlay[Findlay.length] = createMarker(new GPoint(-83.65562439,41.07618713),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bigelow Hill Elementary School",'Findlay=' + Findlay.length);
Findlay[Findlay.length] = createMarker(new GPoint(-83.65228271,41.03923798),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Central Middle School",'Findlay=' + Findlay.length);
Findlay[Findlay.length] = createMarker(new GPoint(-83.65947723,41.01233673),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Chamberlin Hill Elementary School",'Findlay=' + Findlay.length);
Rawson[Rawson.length] = createMarker(new GPoint(-83.78534698,40.95267105),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Cory-rawson Elementary School",'Rawson=' + Rawson.length);
Rawson[Rawson.length] = createMarker(new GPoint(-83.80728149,40.93679428),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cory-rawson High School",'Rawson=' + Rawson.length);
Rawson[Rawson.length] = createMarker(new GPoint(-83.80728149,40.93679428),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Cory-rawson Middle School",'Rawson=' + Rawson.length);
Findlay[Findlay.length] = createMarker(new GPoint(-83.65389252,41.02696228),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Donnell Middle School",'Findlay=' + Findlay.length);
Findlay[Findlay.length] = createMarker(new GPoint(-83.66457800,41.05535000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Findlay Digital Academy",'Findlay=' + Findlay.length);
Findlay[Findlay.length] = createMarker(new GPoint(-83.66468048,41.05553818),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Findlay High School",'Findlay=' + Findlay.length);
Findlay[Findlay.length] = createMarker(new GPoint(-83.64989471,41.06087112),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Glenwood Middle School",'Findlay=' + Findlay.length);
Findlay[Findlay.length] = createMarker(new GPoint(-83.90048800,41.18223800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hancock Co Alternative Opp Ctr High School",'Findlay=' + Findlay.length);
Findlay[Findlay.length] = createMarker(new GPoint(-83.64025116,41.05899811),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Jacobs Elementary School",'Findlay=' + Findlay.length);
Findlay[Findlay.length] = createMarker(new GPoint(-83.64926147,41.01993561),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Jefferson Elementary School",'Findlay=' + Findlay.length);
Findlay[Findlay.length] = createMarker(new GPoint(-83.69875336,41.03385925),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Liberty-benton Elementary School",'Findlay=' + Findlay.length);
Findlay[Findlay.length] = createMarker(new GPoint(-83.69875336,41.03385925),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Liberty-benton High School",'Findlay=' + Findlay.length);
Findlay[Findlay.length] = createMarker(new GPoint(-83.69875336,41.03385925),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Liberty-benton Middle School",'Findlay=' + Findlay.length);
Findlay[Findlay.length] = createMarker(new GPoint(-83.65228271,41.03453827),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Findlay=' + Findlay.length);
Mccomb[Mccomb.length] = createMarker(new GPoint(-83.79174805,41.10516739),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mccomb Local Elementary School",'Mccomb=' + Mccomb.length);
Mccomb[Mccomb.length] = createMarker(new GPoint(-83.79156200,41.10525400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mccomb Local High School",'Mccomb=' + Mccomb.length);
Findlay[Findlay.length] = createMarker(new GPoint(-83.65028800,41.03740000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Millstream, East Campus",'Findlay=' + Findlay.length);
Findlay[Findlay.length] = createMarker(new GPoint(-83.66476440,41.05424500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Millstream, South",'Findlay=' + Findlay.length);
Findlay[Findlay.length] = createMarker(new GPoint(-83.65055847,41.06776428),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Northview Elementary School",'Findlay=' + Findlay.length);
Findlay[Findlay.length] = createMarker(new GPoint(-83.65055847,41.06776428),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Northview Hearing Impaired",'Findlay=' + Findlay.length);
Mt_Blanchard[Mt_Blanchard.length] = createMarker(new GPoint(-83.51506805,40.80058670),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Riverdale Elementary School",'Mt_Blanchard=' + Mt_Blanchard.length);
Mt_Blanchard[Mt_Blanchard.length] = createMarker(new GPoint(-83.55671900,40.89857500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Riverdale High School",'Mt_Blanchard=' + Mt_Blanchard.length);
Mt_Blanchard[Mt_Blanchard.length] = createMarker(new GPoint(-83.51506805,40.80058670),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Riverdale Middle School",'Mt_Blanchard=' + Mt_Blanchard.length);
Van_Buren[Van_Buren.length] = createMarker(new GPoint(-83.64931488,41.13615417),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Van Buren Elementary School",'Van_Buren=' + Van_Buren.length);
Van_Buren[Van_Buren.length] = createMarker(new GPoint(-83.64931488,41.13615417),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Van Buren High School",'Van_Buren=' + Van_Buren.length);
Van_Buren[Van_Buren.length] = createMarker(new GPoint(-83.64931488,41.13615417),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Van Buren Middle School",'Van_Buren=' + Van_Buren.length);
Vanlue[Vanlue.length] = createMarker(new GPoint(-83.48519897,40.97259903),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Vanlue Elementary School",'Vanlue=' + Vanlue.length);
Vanlue[Vanlue.length] = createMarker(new GPoint(-83.48519897,40.97259903),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Vanlue High School",'Vanlue=' + Vanlue.length);
Findlay[Findlay.length] = createMarker(new GPoint(-83.65000153,41.04882813),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Washington Elementary School",'Findlay=' + Findlay.length);
Findlay[Findlay.length] = createMarker(new GPoint(-83.63667297,41.03306198),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Whittier Elementary School",'Findlay=' + Findlay.length);
Findlay[Findlay.length] = createMarker(new GPoint(-83.61260223,41.04674911),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Wilson Vance Elementary School",'Findlay=' + Findlay.length);
} // 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(Arcadia);
map.removeOverlays(Arlington);
map.removeOverlays(Findlay);
map.removeOverlays(Mccomb);
map.removeOverlays(Mt_Blanchard);
map.removeOverlays(Rawson);
map.removeOverlays(Van_Buren);
map.removeOverlays(Vanlue);
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(Arcadia);map.removeOverlays(Arcadia);
map.removeOverlays(Arlington);
map.removeOverlays(Findlay);
map.removeOverlays(Mccomb);
map.removeOverlays(Mt_Blanchard);
map.removeOverlays(Rawson);
map.removeOverlays(Van_Buren);
map.removeOverlays(Vanlue);
map.addOverlays(Arcadia);
centerByArray(Arcadia, false, false);
cntMarker += Arcadia.length;
map.addOverlays(Arlington);
centerByArray(Arlington, false, false);
cntMarker += Arlington.length;
map.addOverlays(Findlay);
centerByArray(Findlay, false, false);
cntMarker += Findlay.length;
map.addOverlays(Mccomb);
centerByArray(Mccomb, false, false);
cntMarker += Mccomb.length;
map.addOverlays(Mt_Blanchard);
centerByArray(Mt_Blanchard, false, false);
cntMarker += Mt_Blanchard.length;
map.addOverlays(Rawson);
centerByArray(Rawson, false, false);
cntMarker += Rawson.length;
map.addOverlays(Van_Buren);
centerByArray(Van_Buren, false, false);
cntMarker += Van_Buren.length;
map.addOverlays(Vanlue);
centerByArray(Vanlue, false, false);
cntMarker += Vanlue.length;
centerByArray(Arcadia,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');
}
}