function addMarkers(){ mySelect = document.getElementById('selection'); Bangor = [];Bethlehem = [];Easton = [];Roseto = [];Nazareth = [];Pen_Argyl = [];Northampton = [];Bath = [];Hellertown = [];mySelect.options[mySelect.options.length] = new Option("Bangor schools",'all=Bangor'); mySelect.options[mySelect.options.length] = new Option("Bath schools",'all=Bath'); mySelect.options[mySelect.options.length] = new Option("Bethlehem schools",'all=Bethlehem'); mySelect.options[mySelect.options.length] = new Option("Easton schools",'all=Easton'); mySelect.options[mySelect.options.length] = new Option("Hellertown schools",'all=Hellertown'); mySelect.options[mySelect.options.length] = new Option("Nazareth schools",'all=Nazareth'); mySelect.options[mySelect.options.length] = new Option("Northampton schools",'all=Northampton'); mySelect.options[mySelect.options.length] = new Option("Pen Argyl schools",'all=Pen_Argyl'); mySelect.options[mySelect.options.length] = new Option("Roseto schools",'all=Roseto'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Bangor[Bangor.length] = createMarker(new GPoint(-75.20967000,40.86472200),"
Bangor Preschool
221 S 4th Street
Bangor, PA 18013
Co-ed school, NS-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bangor Preschool",'Bangor=' + Bangor.length); Bethlehem[Bethlehem.length] = createMarker(new GPoint(-75.33211000,40.65989700),"
Bethlehem Christian School
3100 Hecktown Road
Bethlehem, PA 18020
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bethlehem Christian School",'Bethlehem=' + Bethlehem.length); Easton[Easton.length] = createMarker(new GPoint(-75.25354200,40.68572800),"
Children's Garden Early Education Center
61 Kunkle Drive
Easton, PA 18045
Co-ed school, K-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Children's Garden Early Education Center",'Easton=' + Easton.length); Bethlehem[Bethlehem.length] = createMarker(new GPoint(-75.35793700,40.61120700),"
Concordia Lutheran Church & School
1240 E 4th Street
Bethlehem, PA 18015
Co-ed school, K-7
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Concordia Lutheran Church & School",'Bethlehem=' + Bethlehem.length); Bethlehem[Bethlehem.length] = createMarker(new GPoint(-75.38218000,40.67354000),"
Creative Kids Club
90 S Commerce Way
Bethlehem, PA 18017
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Creative Kids Club",'Bethlehem=' + Bethlehem.length); Easton[Easton.length] = createMarker(new GPoint(-75.26254100,40.68839700),"
Easton Baptist Academy
177 N Greenwood Avenue
Easton, PA 18045
Co-ed school, K-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Easton Baptist Academy",'Easton=' + Easton.length); Easton[Easton.length] = createMarker(new GPoint(-75.22053700,40.68703700),"
Easton Catholic School
841 Washington Street
Easton, PA 18042
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Easton Catholic School",'Easton=' + Easton.length); Roseto[Roseto.length] = createMarker(new GPoint(-75.21807300,40.87516700),"
Faith Christian School
122 Dante Street
Roseto, PA 18013
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Faith Christian School",'Roseto=' + Roseto.length); Nazareth[Nazareth.length] = createMarker(new GPoint(-75.32071400,40.74277300),"
Holy Family Elementary School
17 N Convent Avenue
Nazareth, PA 18064
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Holy Family Elementary School",'Nazareth=' + Nazareth.length); Bethlehem[Bethlehem.length] = createMarker(new GPoint(-75.37666200,40.61063700),"
Holy Infancy School
127 E 4th Street
Bethlehem, PA 18015
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Holy Infancy School",'Bethlehem=' + Bethlehem.length); Pen_Argyl[Pen_Argyl.length] = createMarker(new GPoint(-75.25690000,40.86955000),"
Immaculate Conception School
Babbitt And Heller Aves
Pen Argyl, PA 18072
Co-ed school, NS-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Immaculate Conception School",'Pen_Argyl=' + Pen_Argyl.length); Bethlehem[Bethlehem.length] = createMarker(new GPoint(-75.37907000,40.62054800),"
Moravian Academy Middle School
11 W Market Street
Bethlehem, PA 18018
Co-ed school, 6-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Moravian Academy Middle School",'Bethlehem=' + Bethlehem.length); Bethlehem[Bethlehem.length] = createMarker(new GPoint(-75.41293400,40.64040400),"
Notre Dame Of Bethlehem School
1835 Catasauqua Road
Bethlehem, PA 18018
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Notre Dame Of Bethlehem School",'Bethlehem=' + Bethlehem.length); Northampton[Northampton.length] = createMarker(new GPoint(-75.49265400,40.67973000),"
Our Lady Of Hungary Regional School
1300 Newport Avenue
Northampton, PA 18067
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Our Lady Of Hungary Regional School",'Northampton=' + Northampton.length); Roseto[Roseto.length] = createMarker(new GPoint(-75.21629800,40.87455900),"
Our Lady Of Mt Carmel School
80 Ridge Street
Roseto, PA 18013
Co-ed school, K-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Our Lady Of Mt Carmel School",'Roseto=' + Roseto.length); Bethlehem[Bethlehem.length] = createMarker(new GPoint(-75.33773500,40.66098800),"
Our Lady Of Perpetual Help School
3221 Santee Road
Bethlehem, PA 18020
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Our Lady Of Perpetual Help School",'Bethlehem=' + Bethlehem.length); Bath[Bath.length] = createMarker(new GPoint(-75.39061800,40.72576200),"
Sacred Heart School
115 Washington St.
Bath, PA 18014
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sacred Heart School",'Bath=' + Bath.length); Bethlehem[Bethlehem.length] = createMarker(new GPoint(-75.33079300,40.64112900),"
Sacred Heart School
1814 2nd Street
Bethlehem, PA 18020
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sacred Heart School",'Bethlehem=' + Bethlehem.length); Bethlehem[Bethlehem.length] = createMarker(new GPoint(-75.36755500,40.63449400),"
St. Anne School
375 Hickory Street
Bethlehem, PA 18017
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Anne School",'Bethlehem=' + Bethlehem.length); Northampton[Northampton.length] = createMarker(new GPoint(-75.49369600,40.68119400),"
St. John The Baptist
1357 Newport Ave
Northampton, PA 18067
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. John The Baptist",'Northampton=' + Northampton.length); Hellertown[Hellertown.length] = createMarker(new GPoint(-75.33580000,40.58936300),"
St. Theresa School
300 Leonard Street
Hellertown, PA 18055
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Theresa School",'Hellertown=' + Hellertown.length); Bethlehem[Bethlehem.length] = createMarker(new GPoint(-75.36958600,40.60834000),"
Ss Cyril - Methodius School
551 Thomas Street
Bethlehem, PA 18015
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ss Cyril - Methodius School",'Bethlehem=' + Bethlehem.length); Easton[Easton.length] = createMarker(new GPoint(-75.23876900,40.68575300),"
St Jane Frances De Chantal School
1900 Washington Blvd
Easton, PA 18042
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Jane Frances De Chantal School",'Easton=' + Easton.length); Bethlehem[Bethlehem.length] = createMarker(new GPoint(-75.38252300,40.66889900),"
Tot Time Child Development Center
3895 Adler Place
Bethlehem, PA 18017
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tot Time Child Development Center",'Bethlehem=' + Bethlehem.length); Northampton[Northampton.length] = createMarker(new GPoint(-75.42395500,40.73833800),"
Valley View Baptist Academy
2870 Pheasant Drive
Northampton, PA 18067
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Valley View Baptist Academy",'Northampton=' + Northampton.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(Bangor); map.removeOverlays(Bath); map.removeOverlays(Bethlehem); map.removeOverlays(Easton); map.removeOverlays(Hellertown); map.removeOverlays(Nazareth); map.removeOverlays(Northampton); map.removeOverlays(Pen_Argyl); map.removeOverlays(Roseto); 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(Bangor);map.removeOverlays(Bangor); map.removeOverlays(Bath); map.removeOverlays(Bethlehem); map.removeOverlays(Easton); map.removeOverlays(Hellertown); map.removeOverlays(Nazareth); map.removeOverlays(Northampton); map.removeOverlays(Pen_Argyl); map.removeOverlays(Roseto); map.addOverlays(Bangor); centerByArray(Bangor, false, false); cntMarker += Bangor.length; map.addOverlays(Bath); centerByArray(Bath, false, false); cntMarker += Bath.length; map.addOverlays(Bethlehem); centerByArray(Bethlehem, false, false); cntMarker += Bethlehem.length; map.addOverlays(Easton); centerByArray(Easton, false, false); cntMarker += Easton.length; map.addOverlays(Hellertown); centerByArray(Hellertown, false, false); cntMarker += Hellertown.length; map.addOverlays(Nazareth); centerByArray(Nazareth, false, false); cntMarker += Nazareth.length; map.addOverlays(Northampton); centerByArray(Northampton, false, false); cntMarker += Northampton.length; map.addOverlays(Pen_Argyl); centerByArray(Pen_Argyl, false, false); cntMarker += Pen_Argyl.length; map.addOverlays(Roseto); centerByArray(Roseto, false, false); cntMarker += Roseto.length; centerByArray(Bangor,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; }