function addMarkers() { mySelect = document.getElementById('selection'); Jim_Thorpe = [];Lehighton = [];Palmerton = [];Nesquehoning = [];Lansford = [];Albrightsville = [];Weatherly = [];mySelect.options[mySelect.options.length] = new Option("Albrightsville schools",'all=Albrightsville'); mySelect.options[mySelect.options.length] = new Option("Jim Thorpe schools",'all=Jim_Thorpe'); mySelect.options[mySelect.options.length] = new Option("Lansford schools",'all=Lansford'); mySelect.options[mySelect.options.length] = new Option("Lehighton schools",'all=Lehighton'); mySelect.options[mySelect.options.length] = new Option("Nesquehoning schools",'all=Nesquehoning'); mySelect.options[mySelect.options.length] = new Option("Palmerton schools",'all=Palmerton'); mySelect.options[mySelect.options.length] = new Option("Weatherly schools",'all=Weatherly'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Jim_Thorpe[Jim_Thorpe.length] = createMarker(new GPoint(-75.72630310,40.88336182),"
Carbon County Avts High School
150 W 13th St
Jim Thorpe, PA 18229

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Carbon County Avts High School",'Jim_Thorpe=' + Jim_Thorpe.length); Lehighton[Lehighton.length] = createMarker(new GPoint(-75.72370911,40.78074265),"
East Penn Elementary School
496 W Lizard Creek Rd
Lehighton, PA 18235

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("East Penn Elementary School",'Lehighton=' + Lehighton.length); Lehighton[Lehighton.length] = createMarker(new GPoint(-75.68346405,40.84452820),"
Franklin Elementary School
1122 Fairyland Rd
Lehighton, PA 18235

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Franklin Elementary School",'Lehighton=' + Lehighton.length); Jim_Thorpe[Jim_Thorpe.length] = createMarker(new GPoint(-75.74425507,40.86725235),"
Jim Thorpe Area Junior High School
410 Center Ave
Jim Thorpe, PA 18229

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Jim Thorpe Area Junior High School",'Jim_Thorpe=' + Jim_Thorpe.length); Jim_Thorpe[Jim_Thorpe.length] = createMarker(new GPoint(-75.72644043,40.88021851),"
Jim Thorpe Area Senior High School
1 Olympian Way
Jim Thorpe, PA 18229

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Jim Thorpe Area Senior High School",'Jim_Thorpe=' + Jim_Thorpe.length); Jim_Thorpe[Jim_Thorpe.length] = createMarker(new GPoint(-75.72846222,40.87994385),"
L B Morris Elementary School
150 W 10th St
Jim Thorpe, PA 18229

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("L B Morris Elementary School",'Jim_Thorpe=' + Jim_Thorpe.length); Lehighton[Lehighton.length] = createMarker(new GPoint(-75.69165039,40.84339905),"
Lehighton Area High School
1 Indian Lane
Lehighton, PA 18235

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lehighton Area High School",'Lehighton=' + Lehighton.length); Lehighton[Lehighton.length] = createMarker(new GPoint(-75.72370911,40.83190536),"
Lehighton Area Middle School
301 Beaver Run Rd
Lehighton, PA 18235

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Lehighton Area Middle School",'Lehighton=' + Lehighton.length); Lehighton[Lehighton.length] = createMarker(new GPoint(-75.76471710,40.81615448),"
Mahoning Elementary School
2466 Mahoning Dr E
Lehighton, PA 18235

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Mahoning Elementary School",'Lehighton=' + Lehighton.length); Palmerton[Palmerton.length] = createMarker(new GPoint(-75.61179352,40.80340576),"
Palmer Elementary School
298 Lafayette Ave
Palmerton, PA 18071

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Palmer Elementary School",'Palmerton=' + Palmerton.length); Palmerton[Palmerton.length] = createMarker(new GPoint(-75.60600281,40.81266403),"
Palmerton Area High School
3525 Fireline Rd
Palmerton, PA 18071

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Palmerton Area High School",'Palmerton=' + Palmerton.length); Palmerton[Palmerton.length] = createMarker(new GPoint(-75.60593414,40.81266403),"
Palmerton Area Middle School
3529 Fireline Rd
Palmerton, PA 18071

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Palmerton Area Middle School",'Palmerton=' + Palmerton.length); Nesquehoning[Nesquehoning.length] = createMarker(new GPoint(-75.81215668,40.86563873),"
Panther Valley Elementary School
1 North Mermon Avenue
Nesquehoning, PA 18240

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Panther Valley Elementary School",'Nesquehoning=' + Nesquehoning.length); Lansford[Lansford.length] = createMarker(new GPoint(-75.87844086,40.83242035),"
Panther Valley Middle School
11 East Bertsch Street
Lansford, PA 18232

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Panther Valley Middle School",'Lansford=' + Lansford.length); Lansford[Lansford.length] = createMarker(new GPoint(-75.88289642,40.83160019),"
Panther Valley Senior High School
Po Box 40
Lansford, PA 18232

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Panther Valley Senior High School",'Lansford=' + Lansford.length); Albrightsville[Albrightsville.length] = createMarker(new GPoint(-75.51381683,40.98730087),"
Penn/kidder Campus
2937 Route 903
Albrightsville, PA 18210

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Penn/kidder Campus",'Albrightsville=' + Albrightsville.length); Lehighton[Lehighton.length] = createMarker(new GPoint(-75.72364044,40.83106232),"
Shull-david Elementary School
200 Beaver Run Rd
Lehighton, PA 18235

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Shull-david Elementary School",'Lehighton=' + Lehighton.length); Lehighton[Lehighton.length] = createMarker(new GPoint(-75.56670380,40.87183380),"
Towamensing Elementary School
7920 Interchange Rd
Lehighton, PA 18235

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Towamensing Elementary School",'Lehighton=' + Lehighton.length); Weatherly[Weatherly.length] = createMarker(new GPoint(-75.81914520,40.93779755),"
Weatherly Area Elementary School
602 6th St
Weatherly, PA 18255

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Weatherly Area Elementary School",'Weatherly=' + Weatherly.length); Weatherly[Weatherly.length] = createMarker(new GPoint(-75.81914520,40.93779755),"
Weatherly Area Middle School
602 6th St
Weatherly, PA 18255

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Weatherly Area Middle School",'Weatherly=' + Weatherly.length); Weatherly[Weatherly.length] = createMarker(new GPoint(-75.81851196,40.93838120),"
Weatherly Area Senior High School
601 6th St
Weatherly, PA 18255

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Weatherly Area Senior High School",'Weatherly=' + Weatherly.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(Albrightsville); map.removeOverlays(Jim_Thorpe); map.removeOverlays(Lansford); map.removeOverlays(Lehighton); map.removeOverlays(Nesquehoning); map.removeOverlays(Palmerton); map.removeOverlays(Weatherly); 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(Jim_Thorpe);map.removeOverlays(Albrightsville); map.removeOverlays(Jim_Thorpe); map.removeOverlays(Lansford); map.removeOverlays(Lehighton); map.removeOverlays(Nesquehoning); map.removeOverlays(Palmerton); map.removeOverlays(Weatherly); map.addOverlays(Albrightsville); centerByArray(Albrightsville, false, false); cntMarker += Albrightsville.length; map.addOverlays(Jim_Thorpe); centerByArray(Jim_Thorpe, false, false); cntMarker += Jim_Thorpe.length; map.addOverlays(Lansford); centerByArray(Lansford, false, false); cntMarker += Lansford.length; map.addOverlays(Lehighton); centerByArray(Lehighton, false, false); cntMarker += Lehighton.length; map.addOverlays(Nesquehoning); centerByArray(Nesquehoning, false, false); cntMarker += Nesquehoning.length; map.addOverlays(Palmerton); centerByArray(Palmerton, false, false); cntMarker += Palmerton.length; map.addOverlays(Weatherly); centerByArray(Weatherly, false, false); cntMarker += Weatherly.length; centerByArray(Jim_Thorpe,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'); } }