function addMarkers()
{
mySelect = document.getElementById('selection');
Adamsville = [];Zanesville = [];Duncan_Falls = [];New_Concord = [];Frazeysburg = [];Hopewell = [];Dresden = [];New = [];Nashport = [];Philo = [];South_Zanesville = [];mySelect.options[mySelect.options.length] = new Option("Adamsville schools",'all=Adamsville');
mySelect.options[mySelect.options.length] = new Option("Dresden schools",'all=Dresden');
mySelect.options[mySelect.options.length] = new Option("Duncan Falls schools",'all=Duncan_Falls');
mySelect.options[mySelect.options.length] = new Option("Frazeysburg schools",'all=Frazeysburg');
mySelect.options[mySelect.options.length] = new Option("Hopewell schools",'all=Hopewell');
mySelect.options[mySelect.options.length] = new Option("Nashport schools",'all=Nashport');
mySelect.options[mySelect.options.length] = new Option("New schools",'all=New');
mySelect.options[mySelect.options.length] = new Option("New Concord schools",'all=New_Concord');
mySelect.options[mySelect.options.length] = new Option("Philo schools",'all=Philo');
mySelect.options[mySelect.options.length] = new Option("South Zanesville schools",'all=South_Zanesville');
mySelect.options[mySelect.options.length] = new Option("Zanesville schools",'all=Zanesville');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Adamsville[Adamsville.length] = createMarker(new GPoint(-81.88240051,40.06699371),"
",iconRd);
mySelect.options[mySelect.options.length] = new Option("Adamsville Elementary School",'Adamsville=' + Adamsville.length);
Zanesville[Zanesville.length] = createMarker(new GPoint(-81.97753906,39.93588257),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Adult Basic & Literacy Ed-able",'Zanesville=' + Zanesville.length);
Zanesville[Zanesville.length] = createMarker(new GPoint(-81.97753906,39.93588257),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Adult Center For Education",'Zanesville=' + Zanesville.length);
Zanesville[Zanesville.length] = createMarker(new GPoint(-82.01560211,39.92499161),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Cleveland Middle School",'Zanesville=' + Zanesville.length);
Zanesville[Zanesville.length] = createMarker(new GPoint(-82.05499268,39.97224808),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Dillon Elementary School",'Zanesville=' + Zanesville.length);
Duncan_Falls[Duncan_Falls.length] = createMarker(new GPoint(-81.91159821,39.87699890),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Duncan Falls Elementary School",'Duncan_Falls=' + Duncan_Falls.length);
New_Concord[New_Concord.length] = createMarker(new GPoint(-81.74018860,40.00785446),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("East Muskingum Middle School",'New_Concord=' + New_Concord.length);
Zanesville[Zanesville.length] = createMarker(new GPoint(-82.05149078,39.89693832),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Foxfire Alternative High School",'Zanesville=' + Zanesville.length);
Duncan_Falls[Duncan_Falls.length] = createMarker(new GPoint(-81.90829468,39.87554932),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Franklin Local Digital Academy",'Duncan_Falls=' + Duncan_Falls.length);
Frazeysburg[Frazeysburg.length] = createMarker(new GPoint(-82.14749908,40.15029907),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Frazeyburg Intermediate Elementary School",'Frazeysburg=' + Frazeysburg.length);
Frazeysburg[Frazeysburg.length] = createMarker(new GPoint(-82.14749908,40.15029907),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Frazeysburg Elementary School",'Frazeysburg=' + Frazeysburg.length);
Zanesville[Zanesville.length] = createMarker(new GPoint(-82.00511932,39.92457581),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("General Rufus Putnam Community Elementary School",'Zanesville=' + Zanesville.length);
Hopewell[Hopewell.length] = createMarker(new GPoint(-82.19068146,39.95606232),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hopewell Elementary School",'Hopewell=' + Hopewell.length);
Zanesville[Zanesville.length] = createMarker(new GPoint(-82.00578308,39.93013763),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("James Madison Family Center",'Zanesville=' + Zanesville.length);
Dresden[Dresden.length] = createMarker(new GPoint(-82.00460052,40.12689972),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Jefferson Elementary School",'Dresden=' + Dresden.length);
New[New.length] = createMarker(new GPoint(-81.74055481,40.00791550),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("John Glenn High School",'New=' + New.length);
New_Concord[New_Concord.length] = createMarker(new GPoint(-81.73429871,40.01190186),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Larry Miller Intermediate Elementary School",'New_Concord=' + New_Concord.length);
Zanesville[Zanesville.length] = createMarker(new GPoint(-82.05133057,39.88205719),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Maysville Elementary School",'Zanesville=' + Zanesville.length);
Zanesville[Zanesville.length] = createMarker(new GPoint(-82.05520630,39.88378525),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Maysville High School",'Zanesville=' + Zanesville.length);
Zanesville[Zanesville.length] = createMarker(new GPoint(-82.05520630,39.88378525),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Maysville Middle School",'Zanesville=' + Zanesville.length);
Zanesville[Zanesville.length] = createMarker(new GPoint(-82.01766205,39.95120621),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mcintire Elementary School",'Zanesville=' + Zanesville.length);
Zanesville[Zanesville.length] = createMarker(new GPoint(-81.98825073,39.93500137),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mckinley Elementary School",'Zanesville=' + Zanesville.length);
Zanesville[Zanesville.length] = createMarker(new GPoint(-82.02331543,39.93885040),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Munson Elementary School",'Zanesville=' + Zanesville.length);
Nashport[Nashport.length] = createMarker(new GPoint(-82.10256958,40.02865982),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Nashport Elementary School",'Nashport=' + Nashport.length);
Zanesville[Zanesville.length] = createMarker(new GPoint(-81.93805900,39.95397900),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("National Road",'Zanesville=' + Zanesville.length);
New_Concord[New_Concord.length] = createMarker(new GPoint(-81.73807526,39.99604034),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("New Concord Elementary School",'New_Concord=' + New_Concord.length);
Zanesville[Zanesville.length] = createMarker(new GPoint(-82.12231445,39.85467148),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Newton Elementary School",'Zanesville=' + Zanesville.length);
Zanesville[Zanesville.length] = createMarker(new GPoint(-81.85847473,39.97103500),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Perry Elementary School",'Zanesville=' + Zanesville.length);
Philo[Philo.length] = createMarker(new GPoint(-81.92350006,39.84960175),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Philo High School",'Philo=' + Philo.length);
Philo[Philo.length] = createMarker(new GPoint(-81.92350006,39.84960175),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Philo Junior High School",'Philo=' + Philo.length);
Zanesville[Zanesville.length] = createMarker(new GPoint(-82.00180817,39.93946838),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pioneer Elementary School",'Zanesville=' + Zanesville.length);
Zanesville[Zanesville.length] = createMarker(new GPoint(-81.96057129,39.94982910),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pleasant Grove Elementary School",'Zanesville=' + Zanesville.length);
Zanesville[Zanesville.length] = createMarker(new GPoint(-82.00753784,39.99549866),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Richey Elementary School",'Zanesville=' + Zanesville.length);
Zanesville[Zanesville.length] = createMarker(new GPoint(-82.02162170,39.95130539),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Roosevelt Middle School",'Zanesville=' + Zanesville.length);
South_Zanesville[South_Zanesville.length] = createMarker(new GPoint(-82.01103973,39.90280151),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("South Zanesville Elementary S",'South_Zanesville=' + South_Zanesville.length);
Zanesville[Zanesville.length] = createMarker(new GPoint(-82.03601837,39.92142105),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Springfield-bell Elementary S",'Zanesville=' + Zanesville.length);
Zanesville[Zanesville.length] = createMarker(new GPoint(-82.00736237,39.94305038),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Squire Elementary School",'Zanesville=' + Zanesville.length);
Dresden[Dresden.length] = createMarker(new GPoint(-82.00460052,40.12689972),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Tri Valley Middle School",'Dresden=' + Dresden.length);
Dresden[Dresden.length] = createMarker(new GPoint(-82.00460052,40.12689972),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Tri-valley High School",'Dresden=' + Dresden.length);
Zanesville[Zanesville.length] = createMarker(new GPoint(-82.08907318,39.95536423),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("West Muskingum High School",'Zanesville=' + Zanesville.length);
Zanesville[Zanesville.length] = createMarker(new GPoint(-82.08921051,39.95392609),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("West Muskingum Middle School",'Zanesville=' + Zanesville.length);
Zanesville[Zanesville.length] = createMarker(new GPoint(-82.00627899,39.96485138),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Westview Elementary School",'Zanesville=' + Zanesville.length);
Zanesville[Zanesville.length] = createMarker(new GPoint(-82.01557922,39.92218399),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Wilson Elementary School",'Zanesville=' + Zanesville.length);
Zanesville[Zanesville.length] = createMarker(new GPoint(-81.97753906,39.93588257),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Zanesville Campus",'Zanesville=' + Zanesville.length);
Zanesville[Zanesville.length] = createMarker(new GPoint(-82.01677704,39.96203995),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Zanesville High School",'Zanesville=' + Zanesville.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(Adamsville);
map.removeOverlays(Dresden);
map.removeOverlays(Duncan_Falls);
map.removeOverlays(Frazeysburg);
map.removeOverlays(Hopewell);
map.removeOverlays(Nashport);
map.removeOverlays(New);
map.removeOverlays(New_Concord);
map.removeOverlays(Philo);
map.removeOverlays(South_Zanesville);
map.removeOverlays(Zanesville);
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(Adamsville);map.removeOverlays(Adamsville);
map.removeOverlays(Dresden);
map.removeOverlays(Duncan_Falls);
map.removeOverlays(Frazeysburg);
map.removeOverlays(Hopewell);
map.removeOverlays(Nashport);
map.removeOverlays(New);
map.removeOverlays(New_Concord);
map.removeOverlays(Philo);
map.removeOverlays(South_Zanesville);
map.removeOverlays(Zanesville);
map.addOverlays(Adamsville);
centerByArray(Adamsville, false, false);
cntMarker += Adamsville.length;
map.addOverlays(Dresden);
centerByArray(Dresden, false, false);
cntMarker += Dresden.length;
map.addOverlays(Duncan_Falls);
centerByArray(Duncan_Falls, false, false);
cntMarker += Duncan_Falls.length;
map.addOverlays(Frazeysburg);
centerByArray(Frazeysburg, false, false);
cntMarker += Frazeysburg.length;
map.addOverlays(Hopewell);
centerByArray(Hopewell, false, false);
cntMarker += Hopewell.length;
map.addOverlays(Nashport);
centerByArray(Nashport, false, false);
cntMarker += Nashport.length;
map.addOverlays(New);
centerByArray(New, false, false);
cntMarker += New.length;
map.addOverlays(New_Concord);
centerByArray(New_Concord, false, false);
cntMarker += New_Concord.length;
map.addOverlays(Philo);
centerByArray(Philo, false, false);
cntMarker += Philo.length;
map.addOverlays(South_Zanesville);
centerByArray(South_Zanesville, false, false);
cntMarker += South_Zanesville.length;
map.addOverlays(Zanesville);
centerByArray(Zanesville, false, false);
cntMarker += Zanesville.length;
centerByArray(Adamsville,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');
}
}