function addMarkers(){
mySelect = document.getElementById('selection');
Allentown = [];Kempton = [];Macungie = [];Bethlehem = [];Whitehall = [];Emmaus = [];Fountain_Hill = [];Orefield = [];Alburtis = [];Limeport = [];mySelect.options[mySelect.options.length] = new Option("Alburtis schools",'all=Alburtis');
mySelect.options[mySelect.options.length] = new Option("Allentown schools",'all=Allentown');
mySelect.options[mySelect.options.length] = new Option("Bethlehem schools",'all=Bethlehem');
mySelect.options[mySelect.options.length] = new Option("Emmaus schools",'all=Emmaus');
mySelect.options[mySelect.options.length] = new Option("Fountain Hill schools",'all=Fountain_Hill');
mySelect.options[mySelect.options.length] = new Option("Kempton schools",'all=Kempton');
mySelect.options[mySelect.options.length] = new Option("Limeport schools",'all=Limeport');
mySelect.options[mySelect.options.length] = new Option("Macungie schools",'all=Macungie');
mySelect.options[mySelect.options.length] = new Option("Orefield schools",'all=Orefield');
mySelect.options[mySelect.options.length] = new Option("Whitehall schools",'all=Whitehall');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Allentown[Allentown.length] = createMarker(new GPoint(-75.45746200,40.63667700),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("A Childrens Place Learning Center",'Allentown=' + Allentown.length);
Kempton[Kempton.length] = createMarker(new GPoint(-75.73430000,40.65890000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Blue Mountain Christian Day School",'Kempton=' + Kempton.length);
Macungie[Macungie.length] = createMarker(new GPoint(-75.58606000,40.54845700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cambridge Day Schools",'Macungie=' + Macungie.length);
Allentown[Allentown.length] = createMarker(new GPoint(-75.49612000,40.59930100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cathedral Of St Catherine Of Siena School",'Allentown=' + Allentown.length);
Bethlehem[Bethlehem.length] = createMarker(new GPoint(-75.42446700,40.65504600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Centennial School Lehigh Univ",'Bethlehem=' + Bethlehem.length);
Allentown[Allentown.length] = createMarker(new GPoint(-75.47651800,40.57928900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Children First Community Academy",'Allentown=' + Allentown.length);
Whitehall[Whitehall.length] = createMarker(new GPoint(-75.50268000,40.66510800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Christ The King School",'Whitehall=' + Whitehall.length);
Bethlehem[Bethlehem.length] = createMarker(new GPoint(-75.42081200,40.63331900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Covenant Christian Academy",'Bethlehem=' + Bethlehem.length);
Allentown[Allentown.length] = createMarker(new GPoint(-75.45731800,40.62722200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Cuddle Zone Learning Center",'Allentown=' + Allentown.length);
Allentown[Allentown.length] = createMarker(new GPoint(-75.52653200,40.58860700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Datzyk Montessori School",'Allentown=' + Allentown.length);
Bethlehem[Bethlehem.length] = createMarker(new GPoint(-75.37220000,40.65080000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Daycare In The Park",'Bethlehem=' + Bethlehem.length);
Allentown[Allentown.length] = createMarker(new GPoint(-75.44174600,40.64182200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Daycare In The Park",'Allentown=' + Allentown.length);
Emmaus[Emmaus.length] = createMarker(new GPoint(-75.49270100,40.53862500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Discovery Preschool",'Emmaus=' + Emmaus.length);
Emmaus[Emmaus.length] = createMarker(new GPoint(-75.52337500,40.52076500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Emmaus Baptist Academy",'Emmaus=' + Emmaus.length);
Macungie[Macungie.length] = createMarker(new GPoint(-75.55929200,40.51755800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("First Impressions Child Care Center",'Macungie=' + Macungie.length);
Allentown[Allentown.length] = createMarker(new GPoint(-75.47487300,40.60283100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Grace Montessori School",'Allentown=' + Allentown.length);
Macungie[Macungie.length] = createMarker(new GPoint(-75.55240500,40.53437800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Hillside School",'Macungie=' + Macungie.length);
Fountain_Hill[Fountain_Hill.length] = createMarker(new GPoint(-75.39788700,40.59993300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Holy Child School",'Fountain_Hill=' + Fountain_Hill.length);
Allentown[Allentown.length] = createMarker(new GPoint(-75.46149000,40.61318200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Holy Spirit Elementary School",'Allentown=' + Allentown.length);
Allentown[Allentown.length] = createMarker(new GPoint(-75.50747600,40.60340600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Jewish Community Center of Allentown Kindergarten",'Allentown=' + Allentown.length);
Allentown[Allentown.length] = createMarker(new GPoint(-75.51362900,40.61074100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Jewish Day School",'Allentown=' + Allentown.length);
Orefield[Orefield.length] = createMarker(new GPoint(-75.61205900,40.64973200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Kids Peace",'Orefield=' + Orefield.length);
Bethlehem[Bethlehem.length] = createMarker(new GPoint(-75.40647000,40.59769600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Kids Peace Broadway School",'Bethlehem=' + Bethlehem.length);
Allentown[Allentown.length] = createMarker(new GPoint(-75.46962900,40.61229500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Kids Peace National Centers W",'Allentown=' + Allentown.length);
Allentown[Allentown.length] = createMarker(new GPoint(-75.51898100,40.57056000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lehigh Christian Academy",'Allentown=' + Allentown.length);
Whitehall[Whitehall.length] = createMarker(new GPoint(-75.48143600,40.71815400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lehigh Valley Lutheran School",'Whitehall=' + Whitehall.length);
Whitehall[Whitehall.length] = createMarker(new GPoint(-75.51711300,40.64878600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lehigh Valley Sda School",'Whitehall=' + Whitehall.length);
Allentown[Allentown.length] = createMarker(new GPoint(-75.43556000,40.62316000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Life Academy",'Allentown=' + Allentown.length);
Allentown[Allentown.length] = createMarker(new GPoint(-75.53261400,40.61237200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lifespan",'Allentown=' + Allentown.length);
Allentown[Allentown.length] = createMarker(new GPoint(-75.53261400,40.61237200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lifespan Day Care Center",'Allentown=' + Allentown.length);
Allentown[Allentown.length] = createMarker(new GPoint(-75.61486800,40.56772300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Little People Country Club",'Allentown=' + Allentown.length);
Allentown[Allentown.length] = createMarker(new GPoint(-75.47288000,40.56998700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Little People Day Care School",'Allentown=' + Allentown.length);
Whitehall[Whitehall.length] = createMarker(new GPoint(-75.49363700,40.61806200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Little People Day Care School",'Whitehall=' + Whitehall.length);
Allentown[Allentown.length] = createMarker(new GPoint(-75.42921800,40.63233100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Little People East",'Allentown=' + Allentown.length);
Allentown[Allentown.length] = createMarker(new GPoint(-75.50198400,40.60673600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Lutheran Academy",'Allentown=' + Allentown.length);
Allentown[Allentown.length] = createMarker(new GPoint(-75.49404400,40.59997400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Magic Years",'Allentown=' + Allentown.length);
Alburtis[Alburtis.length] = createMarker(new GPoint(-75.59792300,40.51377300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Magic Years Cc And Learning Center",'Alburtis=' + Alburtis.length);
Allentown[Allentown.length] = createMarker(new GPoint(-75.45734400,40.59241900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mercy Special Learning Center",'Allentown=' + Allentown.length);
Allentown[Allentown.length] = createMarker(new GPoint(-75.44096500,40.61705700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Our Lady Help Of Christians School",'Allentown=' + Allentown.length);
Allentown[Allentown.length] = createMarker(new GPoint(-75.51464700,40.57527400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Perlis Montessori School",'Allentown=' + Allentown.length);
Emmaus[Emmaus.length] = createMarker(new GPoint(-75.51699700,40.52592900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Premier Child Care Center Inc",'Emmaus=' + Emmaus.length);
Allentown[Allentown.length] = createMarker(new GPoint(-75.46770200,40.60911800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sacred Heart School",'Allentown=' + Allentown.length);
Whitehall[Whitehall.length] = createMarker(new GPoint(-75.47153900,40.62949600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Saint Elizabeth Regional School",'Whitehall=' + Whitehall.length);
Allentown[Allentown.length] = createMarker(new GPoint(-75.48485700,40.61145200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Francis Of Assisi School",'Allentown=' + Allentown.length);
Orefield[Orefield.length] = createMarker(new GPoint(-75.59075600,40.60747600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Joseph The Worker School",'Orefield=' + Orefield.length);
Macungie[Macungie.length] = createMarker(new GPoint(-75.57465700,40.47524600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Salem Christian School",'Macungie=' + Macungie.length);
Bethlehem[Bethlehem.length] = createMarker(new GPoint(-75.39262700,40.62263700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ss Simon & Jude Elementary School",'Bethlehem=' + Bethlehem.length);
Emmaus[Emmaus.length] = createMarker(new GPoint(-75.49206900,40.52841800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Ann Elementary School",'Emmaus=' + Emmaus.length);
Limeport[Limeport.length] = createMarker(new GPoint(-75.44750000,40.50880000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Michael The Archangel School",'Limeport=' + Limeport.length);
Allentown[Allentown.length] = createMarker(new GPoint(-75.45605900,40.59060700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Paul School",'Allentown=' + Allentown.length);
Whitehall[Whitehall.length] = createMarker(new GPoint(-75.50899300,40.64833200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Stephens School",'Whitehall=' + Whitehall.length);
Allentown[Allentown.length] = createMarker(new GPoint(-75.51504000,40.57529800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Thomas More School",'Allentown=' + Allentown.length);
Allentown[Allentown.length] = createMarker(new GPoint(-75.50268000,40.57956300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Swain School",'Allentown=' + Allentown.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(Alburtis);
map.removeOverlays(Allentown);
map.removeOverlays(Bethlehem);
map.removeOverlays(Emmaus);
map.removeOverlays(Fountain_Hill);
map.removeOverlays(Kempton);
map.removeOverlays(Limeport);
map.removeOverlays(Macungie);
map.removeOverlays(Orefield);
map.removeOverlays(Whitehall);
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(Allentown);map.removeOverlays(Alburtis);
map.removeOverlays(Allentown);
map.removeOverlays(Bethlehem);
map.removeOverlays(Emmaus);
map.removeOverlays(Fountain_Hill);
map.removeOverlays(Kempton);
map.removeOverlays(Limeport);
map.removeOverlays(Macungie);
map.removeOverlays(Orefield);
map.removeOverlays(Whitehall);
map.addOverlays(Alburtis);
centerByArray(Alburtis, false, false);
cntMarker += Alburtis.length;
map.addOverlays(Allentown);
centerByArray(Allentown, false, false);
cntMarker += Allentown.length;
map.addOverlays(Bethlehem);
centerByArray(Bethlehem, false, false);
cntMarker += Bethlehem.length;
map.addOverlays(Emmaus);
centerByArray(Emmaus, false, false);
cntMarker += Emmaus.length;
map.addOverlays(Fountain_Hill);
centerByArray(Fountain_Hill, false, false);
cntMarker += Fountain_Hill.length;
map.addOverlays(Kempton);
centerByArray(Kempton, false, false);
cntMarker += Kempton.length;
map.addOverlays(Limeport);
centerByArray(Limeport, false, false);
cntMarker += Limeport.length;
map.addOverlays(Macungie);
centerByArray(Macungie, false, false);
cntMarker += Macungie.length;
map.addOverlays(Orefield);
centerByArray(Orefield, false, false);
cntMarker += Orefield.length;
map.addOverlays(Whitehall);
centerByArray(Whitehall, false, false);
cntMarker += Whitehall.length;
centerByArray(Allentown,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;
}