function addMarkers(){ mySelect = document.getElementById('selection'); Cresson = [];Ebensburg = [];Johnstown = [];Nicktown = [];Portage = [];Elton = [];Gallitzin = [];Carrolltown = [];Nanty_Glo = [];Loretto = [];mySelect.options[mySelect.options.length] = new Option("Carrolltown schools",'all=Carrolltown'); mySelect.options[mySelect.options.length] = new Option("Cresson schools",'all=Cresson'); mySelect.options[mySelect.options.length] = new Option("Ebensburg schools",'all=Ebensburg'); mySelect.options[mySelect.options.length] = new Option("Elton schools",'all=Elton'); mySelect.options[mySelect.options.length] = new Option("Gallitzin schools",'all=Gallitzin'); mySelect.options[mySelect.options.length] = new Option("Johnstown schools",'all=Johnstown'); mySelect.options[mySelect.options.length] = new Option("Loretto schools",'all=Loretto'); mySelect.options[mySelect.options.length] = new Option("Nanty Glo schools",'all=Nanty_Glo'); mySelect.options[mySelect.options.length] = new Option("Nicktown schools",'all=Nicktown'); mySelect.options[mySelect.options.length] = new Option("Portage schools",'all=Portage'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Cresson[Cresson.length] = createMarker(new GPoint(-78.58752900,40.46487800),"
All Saints Catholic School
220 Powell Avenue
Cresson, PA 16630
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("All Saints Catholic School",'Cresson=' + Cresson.length); Ebensburg[Ebensburg.length] = createMarker(new GPoint(-78.73325500,40.48508800),"
Bishop Carroll High School
728 Ben Franklin Highway
Ebensburg, PA 15931
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bishop Carroll High School",'Ebensburg=' + Ebensburg.length); Johnstown[Johnstown.length] = createMarker(new GPoint(-78.91680600,40.30508400),"
Bishop Mc Cort High School
25 Osborne Street
Johnstown, PA 15905
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bishop Mc Cort High School",'Johnstown=' + Johnstown.length); Johnstown[Johnstown.length] = createMarker(new GPoint(-78.83724800,40.44422200),"
Cambria County Christian School
561 Pike Road
Johnstown, PA 15909
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cambria County Christian School",'Johnstown=' + Johnstown.length); Johnstown[Johnstown.length] = createMarker(new GPoint(-78.94215600,40.29906600),"
Cathedral Catholic Academy
110 Lindberg Avenue
Johnstown, PA 15905
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cathedral Catholic Academy",'Johnstown=' + Johnstown.length); Johnstown[Johnstown.length] = createMarker(new GPoint(-78.91182700,40.32578800),"
Central Catholic Elementary School
751 Railroad Street
Johnstown, PA 15901
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Central Catholic Elementary School",'Johnstown=' + Johnstown.length); Johnstown[Johnstown.length] = createMarker(new GPoint(-78.86220000,40.28890000),"
Greater Johnstown Christian Academy
3429 Elton Road Johnstown Pa 15904
Johnstown, PA 15904
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Greater Johnstown Christian Academy",'Johnstown=' + Johnstown.length); Ebensburg[Ebensburg.length] = createMarker(new GPoint(-78.72614800,40.48793700),"
Holy Name Elementary School
215 W Horner Street
Ebensburg, PA 15931
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Holy Name Elementary School",'Ebensburg=' + Ebensburg.length); Nicktown[Nicktown.length] = createMarker(new GPoint(-78.81480000,40.59810000),"
Northern Cambria Catholic School
Po Box 249 3278 Blue Goose Road
Nicktown, PA 15762
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Northern Cambria Catholic School",'Nicktown=' + Nicktown.length); Portage[Portage.length] = createMarker(new GPoint(-78.67071700,40.38449200),"
Our Lady Of The Sacred Heart School
812 Orchard Street
Portage, PA 15946
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Our Lady Of The Sacred Heart School",'Portage=' + Portage.length); Johnstown[Johnstown.length] = createMarker(new GPoint(-78.93269000,40.32065200),"
Our Mother Of Sorrows School
430 Tioga Street
Johnstown, PA 15905
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Our Mother Of Sorrows School",'Johnstown=' + Johnstown.length); Elton[Elton.length] = createMarker(new GPoint(-78.80370000,40.27940000),"
Richland Academy
Po Box 608
Elton, PA 15934
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Richland Academy",'Elton=' + Elton.length); Gallitzin[Gallitzin.length] = createMarker(new GPoint(-78.54457800,40.48052000),"
St. Demetrius School
825 Church Street
Gallitzin, PA 16641
Co-ed school, KG-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Demetrius School",'Gallitzin=' + Gallitzin.length); Johnstown[Johnstown.length] = createMarker(new GPoint(-78.92846200,40.28677500),"
St Andrews School
1621 Ferndale Avenue
Johnstown, PA 15905
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Andrews School",'Johnstown=' + Johnstown.length); Johnstown[Johnstown.length] = createMarker(new GPoint(-78.87612900,40.29661300),"
St Benedict Elementary School
2306 Bedford Street
Johnstown, PA 15904
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Benedict Elementary School",'Johnstown=' + Johnstown.length); Carrolltown[Carrolltown.length] = createMarker(new GPoint(-78.71510000,40.60050000),"
St Benedict Elementary School
Po Box 596 119 S Church Street
Carrolltown, PA 15722
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Benedict Elementary School",'Carrolltown=' + Carrolltown.length); Nanty_Glo[Nanty_Glo.length] = createMarker(new GPoint(-78.83815900,40.47081000),"
St Mary Elementary School
1005 Caroline Street
Nanty Glo, PA 15943
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Mary Elementary School",'Nanty_Glo=' + Nanty_Glo.length); Loretto[Loretto.length] = createMarker(new GPoint(-78.62840000,40.50670000),"
St Michael Elementary School
Po Box 67 301 St Elizabeth Street
Loretto, PA 15940
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Michael Elementary School",'Loretto=' + Loretto.length); Johnstown[Johnstown.length] = createMarker(new GPoint(-78.91152900,40.29632300),"
St Patrick Elementary School
625 Park Avenue
Johnstown, PA 15902
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Patrick Elementary School",'Johnstown=' + Johnstown.length); Johnstown[Johnstown.length] = createMarker(new GPoint(-78.94144400,40.29822800),"
St Sophia Orthodox Christian Academy
111 Alberta Avenue
Johnstown, PA 15905
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Sophia Orthodox Christian Academy",'Johnstown=' + Johnstown.length); Portage[Portage.length] = createMarker(new GPoint(-78.66485900,40.36737500),"
Wesleyan Holiness Academy
115 Poorman Drive
Portage, PA 15946
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wesleyan Holiness Academy",'Portage=' + Portage.length); Johnstown[Johnstown.length] = createMarker(new GPoint(-78.92608300,40.34031600),"
West End Catholic School
317 Power Street
Johnstown, PA 15906
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("West End Catholic School",'Johnstown=' + Johnstown.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/////3/' + showArray); map.removeOverlays(Carrolltown); map.removeOverlays(Cresson); map.removeOverlays(Ebensburg); map.removeOverlays(Elton); map.removeOverlays(Gallitzin); map.removeOverlays(Johnstown); map.removeOverlays(Loretto); map.removeOverlays(Nanty_Glo); map.removeOverlays(Nicktown); map.removeOverlays(Portage); 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(Cresson);map.removeOverlays(Carrolltown); map.removeOverlays(Cresson); map.removeOverlays(Ebensburg); map.removeOverlays(Elton); map.removeOverlays(Gallitzin); map.removeOverlays(Johnstown); map.removeOverlays(Loretto); map.removeOverlays(Nanty_Glo); map.removeOverlays(Nicktown); map.removeOverlays(Portage); map.addOverlays(Carrolltown); centerByArray(Carrolltown, false, false); cntMarker += Carrolltown.length; map.addOverlays(Cresson); centerByArray(Cresson, false, false); cntMarker += Cresson.length; map.addOverlays(Ebensburg); centerByArray(Ebensburg, false, false); cntMarker += Ebensburg.length; map.addOverlays(Elton); centerByArray(Elton, false, false); cntMarker += Elton.length; map.addOverlays(Gallitzin); centerByArray(Gallitzin, false, false); cntMarker += Gallitzin.length; map.addOverlays(Johnstown); centerByArray(Johnstown, false, false); cntMarker += Johnstown.length; map.addOverlays(Loretto); centerByArray(Loretto, false, false); cntMarker += Loretto.length; map.addOverlays(Nanty_Glo); centerByArray(Nanty_Glo, false, false); cntMarker += Nanty_Glo.length; map.addOverlays(Nicktown); centerByArray(Nicktown, false, false); cntMarker += Nicktown.length; map.addOverlays(Portage); centerByArray(Portage, false, false); cntMarker += Portage.length; centerByArray(Cresson,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=3&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; }