function addMarkers(){
mySelect = document.getElementById('selection');
Hudson = [];Akron = [];Cuyahoga_Falls = [];Stow = [];Tallmadge = [];Copley = [];Uniontown = [];Northfield = [];Bath = [];Barberton = [];Fairlawn = [];mySelect.options[mySelect.options.length] = new Option("Akron schools",'all=Akron');
mySelect.options[mySelect.options.length] = new Option("Barberton schools",'all=Barberton');
mySelect.options[mySelect.options.length] = new Option("Bath schools",'all=Bath');
mySelect.options[mySelect.options.length] = new Option("Copley schools",'all=Copley');
mySelect.options[mySelect.options.length] = new Option("Cuyahoga Falls schools",'all=Cuyahoga_Falls');
mySelect.options[mySelect.options.length] = new Option("Fairlawn schools",'all=Fairlawn');
mySelect.options[mySelect.options.length] = new Option("Hudson schools",'all=Hudson');
mySelect.options[mySelect.options.length] = new Option("Northfield schools",'all=Northfield');
mySelect.options[mySelect.options.length] = new Option("Stow schools",'all=Stow');
mySelect.options[mySelect.options.length] = new Option("Tallmadge schools",'all=Tallmadge');
mySelect.options[mySelect.options.length] = new Option("Uniontown schools",'all=Uniontown');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Hudson[Hudson.length] = createMarker(new GPoint(-81.43598600,41.23695900),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Academy For Young Children Tlc",'Hudson=' + Hudson.length);
Akron[Akron.length] = createMarker(new GPoint(-81.62880000,41.14840000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Akron Montessori School",'Akron=' + Akron.length);
Akron[Akron.length] = createMarker(new GPoint(-81.48804300,41.07283700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Annunciation St John School",'Akron=' + Akron.length);
Akron[Akron.length] = createMarker(new GPoint(-81.49071700,41.05757600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Arlington Christian Academy",'Akron=' + Akron.length);
Cuyahoga_Falls[Cuyahoga_Falls.length] = createMarker(new GPoint(-81.46824300,41.11882100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Chapel Hill Christian School",'Cuyahoga_Falls=' + Cuyahoga_Falls.length);
Akron[Akron.length] = createMarker(new GPoint(-81.48955500,40.97449300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Chapel Hill Christian School-Green Campus",'Akron=' + Akron.length);
Akron[Akron.length] = createMarker(new GPoint(-81.47226700,41.07020400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Color Our Rainbow Academy",'Akron=' + Akron.length);
Stow[Stow.length] = createMarker(new GPoint(-81.42521700,41.18401900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cornerstone Community School",'Stow=' + Stow.length);
Akron[Akron.length] = createMarker(new GPoint(-93.57805300,45.31167500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Discovery Montessori School",'Akron=' + Akron.length);
Akron[Akron.length] = createMarker(new GPoint(-81.47981900,41.06676300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("East Akron Ymca Phoenix Program",'Akron=' + Akron.length);
Akron[Akron.length] = createMarker(new GPoint(-81.56978100,41.06803600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Emmanuel Christian Academy",'Akron=' + Akron.length);
Tallmadge[Tallmadge.length] = createMarker(new GPoint(-81.44094900,41.09540000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Fact Academy",'Tallmadge=' + Tallmadge.length);
Cuyahoga_Falls[Cuyahoga_Falls.length] = createMarker(new GPoint(-81.50247500,41.18086400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Faith Islamic Academy",'Cuyahoga_Falls=' + Cuyahoga_Falls.length);
Akron[Akron.length] = createMarker(new GPoint(-81.55342600,41.10202800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("First Assembly Preschool",'Akron=' + Akron.length);
Copley[Copley.length] = createMarker(new GPoint(-81.65188000,41.09943700),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("The Ghent Academy For Boys",'Copley=' + Copley.length);
Stow[Stow.length] = createMarker(new GPoint(-81.44689200,41.15694500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Holy Family School-stow",'Stow=' + Stow.length);
Hudson[Hudson.length] = createMarker(new GPoint(-81.44030900,41.27088600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hudson Montessori School",'Hudson=' + Hudson.length);
Cuyahoga_Falls[Cuyahoga_Falls.length] = createMarker(new GPoint(-81.50587200,41.14996500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Immaculate Heart Of Mary School",'Cuyahoga_Falls=' + Cuyahoga_Falls.length);
Uniontown[Uniontown.length] = createMarker(new GPoint(-81.46824800,40.95070300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Kids Country",'Uniontown=' + Uniontown.length);
Stow[Stow.length] = createMarker(new GPoint(-81.45623700,41.19922900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Kids Country Stow",'Stow=' + Stow.length);
Akron[Akron.length] = createMarker(new GPoint(-81.61523600,41.14041200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Kids Couontry School",'Akron=' + Akron.length);
Akron[Akron.length] = createMarker(new GPoint(-81.58903200,41.09651800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lippman Jewish Community Day School",'Akron=' + Akron.length);
Uniontown[Uniontown.length] = createMarker(new GPoint(-81.44822000,40.95594700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mayfair Junior Academy",'Uniontown=' + Uniontown.length);
Akron[Akron.length] = createMarker(new GPoint(-81.39647700,41.03848900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mogadore Christian Academy",'Akron=' + Akron.length);
Akron[Akron.length] = createMarker(new GPoint(-81.47688100,41.10667300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("North Akron Catholic School",'Akron=' + Akron.length);
Northfield[Northfield.length] = createMarker(new GPoint(-81.54965400,41.31442600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Northfield Baptist Christian School",'Northfield=' + Northfield.length);
Bath[Bath.length] = createMarker(new GPoint(-81.63630000,41.18880000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Old Trail School",'Bath=' + Bath.length);
Akron[Akron.length] = createMarker(new GPoint(-81.55771300,41.10397200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Our Lady Of The Elms Elementary School",'Akron=' + Akron.length);
Akron[Akron.length] = createMarker(new GPoint(-81.55590800,41.09962300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Our Lady Of The Elms Preschool",'Akron=' + Akron.length);
Cuyahoga_Falls[Cuyahoga_Falls.length] = createMarker(new GPoint(-81.48871400,41.13659200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Redeemer Lutheran School",'Cuyahoga_Falls=' + Cuyahoga_Falls.length);
Akron[Akron.length] = createMarker(new GPoint(-81.51266800,41.09958300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Anthony Of Padua Elementary School",'Akron=' + Akron.length);
Barberton[Barberton.length] = createMarker(new GPoint(-81.61336000,41.01599600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Augustine Elementary School",'Barberton=' + Barberton.length);
Fairlawn[Fairlawn.length] = createMarker(new GPoint(-81.60440000,41.12407400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Hilary Elementary School",'Fairlawn=' + Fairlawn.length);
Cuyahoga_Falls[Cuyahoga_Falls.length] = createMarker(new GPoint(-81.48608000,41.13273200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Joseph Elementary School",'Cuyahoga_Falls=' + Cuyahoga_Falls.length);
Akron[Akron.length] = createMarker(new GPoint(-81.50433100,41.10206300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Martha Elementary School",'Akron=' + Akron.length);
Akron[Akron.length] = createMarker(new GPoint(-81.52640200,41.06588100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Mary Elementary School",'Akron=' + Akron.length);
Akron[Akron.length] = createMarker(new GPoint(-81.43797800,41.05356300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Matthew Parish School",'Akron=' + Akron.length);
Akron[Akron.length] = createMarker(new GPoint(-81.51058100,41.03871000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Paul School",'Akron=' + Akron.length);
Hudson[Hudson.length] = createMarker(new GPoint(-81.41091600,41.24624300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Seton Catholic Elementary School",'Hudson=' + Hudson.length);
Copley[Copley.length] = createMarker(new GPoint(-81.61921900,41.08378700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Spring Garden Waldorf School",'Copley=' + Copley.length);
Northfield[Northfield.length] = createMarker(new GPoint(-81.53629000,41.31081800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Barnabas School",'Northfield=' + Northfield.length);
Akron[Akron.length] = createMarker(new GPoint(-81.55805200,40.99212300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Francis De Sales School",'Akron=' + Akron.length);
Cuyahoga_Falls[Cuyahoga_Falls.length] = createMarker(new GPoint(-81.45345400,41.13780100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Nicholas Orthodox School",'Cuyahoga_Falls=' + Cuyahoga_Falls.length);
Akron[Akron.length] = createMarker(new GPoint(-81.56844400,41.09944400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Sebastian School",'Akron=' + Akron.length);
Akron[Akron.length] = createMarker(new GPoint(-81.52346900,41.08768900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Vincent Depaul Elementary School",'Akron=' + Akron.length);
Cuyahoga_Falls[Cuyahoga_Falls.length] = createMarker(new GPoint(-81.51398200,41.10223700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Summit Christian School",'Cuyahoga_Falls=' + Cuyahoga_Falls.length);
Tallmadge[Tallmadge.length] = createMarker(new GPoint(-81.42343300,41.07234900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Tallmadge Christian Academy",'Tallmadge=' + Tallmadge.length);
Akron[Akron.length] = createMarker(new GPoint(-81.51700600,41.08138700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Zion Christian School",'Akron=' + Akron.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,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/////1/' + showArray);
map.removeOverlays(Akron);
map.removeOverlays(Barberton);
map.removeOverlays(Bath);
map.removeOverlays(Copley);
map.removeOverlays(Cuyahoga_Falls);
map.removeOverlays(Fairlawn);
map.removeOverlays(Hudson);
map.removeOverlays(Northfield);
map.removeOverlays(Stow);
map.removeOverlays(Tallmadge);
map.removeOverlays(Uniontown);
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(Hudson);map.removeOverlays(Akron);
map.removeOverlays(Barberton);
map.removeOverlays(Bath);
map.removeOverlays(Copley);
map.removeOverlays(Cuyahoga_Falls);
map.removeOverlays(Fairlawn);
map.removeOverlays(Hudson);
map.removeOverlays(Northfield);
map.removeOverlays(Stow);
map.removeOverlays(Tallmadge);
map.removeOverlays(Uniontown);
map.addOverlays(Akron);
centerByArray(Akron, false, false);
cntMarker += Akron.length;
map.addOverlays(Barberton);
centerByArray(Barberton, false, false);
cntMarker += Barberton.length;
map.addOverlays(Bath);
centerByArray(Bath, false, false);
cntMarker += Bath.length;
map.addOverlays(Copley);
centerByArray(Copley, false, false);
cntMarker += Copley.length;
map.addOverlays(Cuyahoga_Falls);
centerByArray(Cuyahoga_Falls, false, false);
cntMarker += Cuyahoga_Falls.length;
map.addOverlays(Fairlawn);
centerByArray(Fairlawn, false, false);
cntMarker += Fairlawn.length;
map.addOverlays(Hudson);
centerByArray(Hudson, false, false);
cntMarker += Hudson.length;
map.addOverlays(Northfield);
centerByArray(Northfield, false, false);
cntMarker += Northfield.length;
map.addOverlays(Stow);
centerByArray(Stow, false, false);
cntMarker += Stow.length;
map.addOverlays(Tallmadge);
centerByArray(Tallmadge, false, false);
cntMarker += Tallmadge.length;
map.addOverlays(Uniontown);
centerByArray(Uniontown, false, false);
cntMarker += Uniontown.length;
centerByArray(Hudson,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');
//window.open('/map.php?type=1&schools=&school_level=1&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;
}