function addMarkers() { mySelect = document.getElementById('selection'); Ebensburg = [];Nanty_Glo = [];Carrolltown = [];Patton = [];Johnstown = [];Cresson = [];Sidman = [];Flinton = [];Northern_Cambria = [];Lilly = [];Gallitzin = [];Portage = [];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("Flinton schools",'all=Flinton'); 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("Lilly schools",'all=Lilly'); mySelect.options[mySelect.options.length] = new Option("Nanty Glo schools",'all=Nanty_Glo'); mySelect.options[mySelect.options.length] = new Option("Northern Cambria schools",'all=Northern_Cambria'); mySelect.options[mySelect.options.length] = new Option("Patton schools",'all=Patton'); mySelect.options[mySelect.options.length] = new Option("Portage schools",'all=Portage'); mySelect.options[mySelect.options.length] = new Option("Sidman schools",'all=Sidman'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Ebensburg[Ebensburg.length] = createMarker(new GPoint(-78.76075745,40.49428558),"
Admiral Peary Avts
948 Ben Franklin Hwy
Ebensburg, PA 15931

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Admiral Peary Avts",'Ebensburg=' + Ebensburg.length); Nanty_Glo[Nanty_Glo.length] = createMarker(new GPoint(-78.83255005,40.48436356),"
Blacklick Valley El Center
1000 W Railroad St
Nanty Glo, PA 15943

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Blacklick Valley El Center",'Nanty_Glo=' + Nanty_Glo.length); Nanty_Glo[Nanty_Glo.length] = createMarker(new GPoint(-78.83625031,40.47753525),"
Blacklick Valley Junior Senior High School
555 Birch St
Nanty Glo, PA 15943

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Blacklick Valley Junior Senior High School",'Nanty_Glo=' + Nanty_Glo.length); Ebensburg[Ebensburg.length] = createMarker(new GPoint(-78.73999023,40.48952866),"
Cambria Elementary School
212 Schoolhouse Rd
Ebensburg, PA 15931

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cambria Elementary School",'Ebensburg=' + Ebensburg.length); Carrolltown[Carrolltown.length] = createMarker(new GPoint(-78.71369934,40.59949875),"
Cambria Heights Elementary School
Po Box 510
Carrolltown, PA 15722

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cambria Heights Elementary School",'Carrolltown=' + Carrolltown.length); Patton[Patton.length] = createMarker(new GPoint(-78.62876129,40.63214874),"
Cambria Heights Middle School
Po Box 216
Patton, PA 16668

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Cambria Heights Middle School",'Patton=' + Patton.length); Patton[Patton.length] = createMarker(new GPoint(-78.62814331,40.63259125),"
Cambria Heights Senior High School
426 Glendale Lake Rd Po Box 6
Patton, PA 16668

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cambria Heights Senior High School",'Patton=' + Patton.length); Ebensburg[Ebensburg.length] = createMarker(new GPoint(-78.74045563,40.48947906),"
Central Cambria High School
204 Schoolhouse Rd
Ebensburg, PA 15931

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Central Cambria High School",'Ebensburg=' + Ebensburg.length); Ebensburg[Ebensburg.length] = createMarker(new GPoint(-78.72641754,40.48993683),"
Central Cambria Middle School
205 W Highland Ave
Ebensburg, PA 15931

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Central Cambria Middle School",'Ebensburg=' + Ebensburg.length); Johnstown[Johnstown.length] = createMarker(new GPoint(-78.87330627,40.32619095),"
Conemaugh Valley Elementary School
1451 Frankstown Rd
Johnstown, PA 15902

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Conemaugh Valley Elementary School",'Johnstown=' + Johnstown.length); Johnstown[Johnstown.length] = createMarker(new GPoint(-78.88927460,40.35905838),"
Conemaugh Valley Junior Senior High School
1342 William Penn Ave
Johnstown, PA 15906

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Conemaugh Valley Junior Senior High School",'Johnstown=' + Johnstown.length); Cresson[Cresson.length] = createMarker(new GPoint(-78.58589935,40.46289825),"
Cresson Secure Treatment Unit High School
Po Box 269
Cresson, PA 16630

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cresson Secure Treatment Unit High School",'Cresson=' + Cresson.length); Johnstown[Johnstown.length] = createMarker(new GPoint(-78.91057587,40.30930328),"
East Side Elementary School
220 Messenger St
Johnstown, PA 15902

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("East Side Elementary School",'Johnstown=' + Johnstown.length); Johnstown[Johnstown.length] = createMarker(new GPoint(-78.88935089,40.35903168),"
East Taylor Elementary School
1340 William Penn Ave
Johnstown, PA 15906

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("East Taylor Elementary School",'Johnstown=' + Johnstown.length); Johnstown[Johnstown.length] = createMarker(new GPoint(-78.91657257,40.28750610),"
Ferndale Area Junior Senior High School
600 Harlan Ave
Johnstown, PA 15905

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ferndale Area Junior Senior High School",'Johnstown=' + Johnstown.length); Johnstown[Johnstown.length] = createMarker(new GPoint(-78.93052673,40.31764221),"
Ferndale Elementary School
100 Dartmouth Ave
Johnstown, PA 15905

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ferndale Elementary School",'Johnstown=' + Johnstown.length); Sidman[Sidman.length] = createMarker(new GPoint(-78.75488281,40.33308029),"
Forest Hills Elementary School
547 Locust St Po Box 290
Sidman, PA 15955

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Forest Hills Elementary School",'Sidman=' + Sidman.length); Sidman[Sidman.length] = createMarker(new GPoint(-78.75662994,40.33334351),"
Forest Hills High School
489 Locust St Po Box 325
Sidman, PA 15955

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Forest Hills High School",'Sidman=' + Sidman.length); Sidman[Sidman.length] = createMarker(new GPoint(-78.71936798,40.36106491),"
Forest Hills Middle School
1427 Frankstown Rd
Sidman, PA 15955

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Forest Hills Middle School",'Sidman=' + Sidman.length); Flinton[Flinton.length] = createMarker(new GPoint(-78.53768158,40.70613861),"
Glendale Elementary School
1500 Beaver Valley Rd
Flinton, PA 16640

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Glendale Elementary School",'Flinton=' + Flinton.length); Flinton[Flinton.length] = createMarker(new GPoint(-78.56179810,40.68181992),"
Glendale Junior Senior High School
1466 Beaver Valley Rd
Flinton, PA 16640

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Glendale Junior Senior High School",'Flinton=' + Flinton.length); Johnstown[Johnstown.length] = createMarker(new GPoint(-78.82905579,40.27153015),"
Greater Johnstown Avts
445 Schoolhouse Rd
Johnstown, PA 15904

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Greater Johnstown Avts",'Johnstown=' + Johnstown.length); Johnstown[Johnstown.length] = createMarker(new GPoint(-78.94621277,40.35188675),"
Greater Johnstown Middle School
280 Decker Ave
Johnstown, PA 15906

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Greater Johnstown Middle School",'Johnstown=' + Johnstown.length); Johnstown[Johnstown.length] = createMarker(new GPoint(-78.91089630,40.30315781),"
Greater Johnstown Senior High School
222 Central Ave
Johnstown, PA 15902

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Greater Johnstown Senior High School",'Johnstown=' + Johnstown.length); Johnstown[Johnstown.length] = createMarker(new GPoint(-78.84410095,40.44105148),"
Jackson Elementary School
3704 William Penn Ave
Johnstown, PA 15909

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jackson Elementary School",'Johnstown=' + Johnstown.length); Northern_Cambria[Northern_Cambria.length] = createMarker(new GPoint(-78.78787994,40.65743256),"
Northern Cambria Elementary School
601 Joseph St
Northern Cambria, PA 15714

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Northern Cambria Elementary School",'Northern_Cambria=' + Northern_Cambria.length); Northern_Cambria[Northern_Cambria.length] = createMarker(new GPoint(-78.78022766,40.65554047),"
Northern Cambria High School
813 35th St
Northern Cambria, PA 15714

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Northern Cambria High School",'Northern_Cambria=' + Northern_Cambria.length); Northern_Cambria[Northern_Cambria.length] = createMarker(new GPoint(-78.78787994,40.65743256),"
Northern Cambria Middle School
601 Joseph St
Northern Cambria, PA 15714

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Northern Cambria Middle School",'Northern_Cambria=' + Northern_Cambria.length); Cresson[Cresson.length] = createMarker(new GPoint(-78.58413696,40.46440506),"
Penn Cambria High School
401 Linden Ave
Cresson, PA 16630

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Penn Cambria High School",'Cresson=' + Cresson.length); Lilly[Lilly.length] = createMarker(new GPoint(-78.63092041,40.41958618),"
Penn Cambria Intrmd School
376 Wood St
Lilly, PA 15938

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Penn Cambria Intrmd School",'Lilly=' + Lilly.length); Gallitzin[Gallitzin.length] = createMarker(new GPoint(-78.55368042,40.47923279),"
Penn Cambria Middle School
401 Division St
Gallitzin, PA 16641

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Penn Cambria Middle School",'Gallitzin=' + Gallitzin.length); Cresson[Cresson.length] = createMarker(new GPoint(-78.58091736,40.46384811),"
Penn Cambria Pre-primary Elementary School
205 6th St
Cresson, PA 16630

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Penn Cambria Pre-primary Elementary School",'Cresson=' + Cresson.length); Lilly[Lilly.length] = createMarker(new GPoint(-78.62062073,40.42444992),"
Penn Cambria Primary School
400 Main St
Lilly, PA 15938

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Penn Cambria Primary School",'Lilly=' + Lilly.length); Portage[Portage.length] = createMarker(new GPoint(-78.66510010,40.38414001),"
Portage Area Elementary School
84 Mountain Ave
Portage, PA 15946

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Portage Area Elementary School",'Portage=' + Portage.length); Portage[Portage.length] = createMarker(new GPoint(-78.66510773,40.38386536),"
Portage Area High School
85 Mountain Ave
Portage, PA 15946

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Portage Area High School",'Portage=' + Portage.length); Portage[Portage.length] = createMarker(new GPoint(-78.66510010,40.38414001),"
Portage Area Middle School
84 Mountain Avenue
Portage, PA 15946

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Portage Area Middle School",'Portage=' + Portage.length); Johnstown[Johnstown.length] = createMarker(new GPoint(-78.83987427,40.26926041),"
Richland Elementary School
321 Schoolhouse Rd
Johnstown, PA 15904

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Richland Elementary School",'Johnstown=' + Johnstown.length); Johnstown[Johnstown.length] = createMarker(new GPoint(-78.84219360,40.26684189),"
Richland Middle School
340 Theatre Dr
Johnstown, PA 15904

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Richland Middle School",'Johnstown=' + Johnstown.length); Johnstown[Johnstown.length] = createMarker(new GPoint(-78.83716583,40.26790619),"
Richland Senior High School
220 Highfield Avenue
Johnstown, PA 15904

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Richland Senior High School",'Johnstown=' + Johnstown.length); Johnstown[Johnstown.length] = createMarker(new GPoint(-78.95220947,40.32754135),"
West Side Elementary School
196 Westgate Dr
Johnstown, PA 15905

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("West Side Elementary School",'Johnstown=' + Johnstown.length); Johnstown[Johnstown.length] = createMarker(new GPoint(-78.94406891,40.30041885),"
Westmont Hilltop Elementary School
675 Goucher St
Johnstown, PA 15905

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Westmont Hilltop Elementary School",'Johnstown=' + Johnstown.length); Johnstown[Johnstown.length] = createMarker(new GPoint(-78.97756958,40.31738663),"
Westmont Hilltop High School
200 Fair Oaks Dr
Johnstown, PA 15905

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Westmont Hilltop High School",'Johnstown=' + Johnstown.length); Johnstown[Johnstown.length] = createMarker(new GPoint(-78.94029999,40.31580353),"
Westmont Hilltop Middle School
827 Diamond Blvd
Johnstown, PA 15905

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Westmont Hilltop Middle 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,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(Carrolltown); map.removeOverlays(Cresson); map.removeOverlays(Ebensburg); map.removeOverlays(Flinton); map.removeOverlays(Gallitzin); map.removeOverlays(Johnstown); map.removeOverlays(Lilly); map.removeOverlays(Nanty_Glo); map.removeOverlays(Northern_Cambria); map.removeOverlays(Patton); map.removeOverlays(Portage); map.removeOverlays(Sidman); 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(Ebensburg);map.removeOverlays(Carrolltown); map.removeOverlays(Cresson); map.removeOverlays(Ebensburg); map.removeOverlays(Flinton); map.removeOverlays(Gallitzin); map.removeOverlays(Johnstown); map.removeOverlays(Lilly); map.removeOverlays(Nanty_Glo); map.removeOverlays(Northern_Cambria); map.removeOverlays(Patton); map.removeOverlays(Portage); map.removeOverlays(Sidman); 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(Flinton); centerByArray(Flinton, false, false); cntMarker += Flinton.length; map.addOverlays(Gallitzin); centerByArray(Gallitzin, false, false); cntMarker += Gallitzin.length; map.addOverlays(Johnstown); centerByArray(Johnstown, false, false); cntMarker += Johnstown.length; map.addOverlays(Lilly); centerByArray(Lilly, false, false); cntMarker += Lilly.length; map.addOverlays(Nanty_Glo); centerByArray(Nanty_Glo, false, false); cntMarker += Nanty_Glo.length; map.addOverlays(Northern_Cambria); centerByArray(Northern_Cambria, false, false); cntMarker += Northern_Cambria.length; map.addOverlays(Patton); centerByArray(Patton, false, false); cntMarker += Patton.length; map.addOverlays(Portage); centerByArray(Portage, false, false); cntMarker += Portage.length; map.addOverlays(Sidman); centerByArray(Sidman, false, false); cntMarker += Sidman.length; centerByArray(Ebensburg,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'); } }