function addMarkers() { mySelect = document.getElementById('selection'); Bandon = [];North_Bend = [];Coos_Bay = [];Coquille = [];Myrtle_Point = [];Powers = [];mySelect.options[mySelect.options.length] = new Option("Bandon schools",'all=Bandon'); mySelect.options[mySelect.options.length] = new Option("Coos Bay schools",'all=Coos_Bay'); mySelect.options[mySelect.options.length] = new Option("Coquille schools",'all=Coquille'); mySelect.options[mySelect.options.length] = new Option("Myrtle Point schools",'all=Myrtle_Point'); mySelect.options[mySelect.options.length] = new Option("North Bend schools",'all=North_Bend'); mySelect.options[mySelect.options.length] = new Option("Powers schools",'all=Powers'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Bandon[Bandon.length] = createMarker(new GPoint(-124.42001343,43.11531067),"
Bandon Senior High School
550 9th St Sw
Bandon, OR 97411

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bandon Senior High School",'Bandon=' + Bandon.length); North_Bend[North_Bend.length] = createMarker(new GPoint(-124.24140930,43.40519714),"
Bangor Elementary School
2121 Madrona St
North Bend, OR 97459

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bangor Elementary School",'North_Bend=' + North_Bend.length); Coos_Bay[Coos_Bay.length] = createMarker(new GPoint(-124.23040009,43.35039902),"
Blossom Gulch Elementary School
Po Box 509
Coos Bay, OR 97420

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Blossom Gulch Elementary School",'Coos_Bay=' + Coos_Bay.length); Coos_Bay[Coos_Bay.length] = createMarker(new GPoint(-124.23040009,43.35039902),"
Bunker Hill Elementary School
Po Box 509
Coos Bay, OR 97420

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bunker Hill Elementary School",'Coos_Bay=' + Coos_Bay.length); Coos_Bay[Coos_Bay.length] = createMarker(new GPoint(-124.23040009,43.35039902),"
Charleston Elementary School
Po Box 509
Coos Bay, OR 97420

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Charleston Elementary School",'Coos_Bay=' + Coos_Bay.length); Coquille[Coquille.length] = createMarker(new GPoint(-124.19351959,43.18601227),"
Coquille High School
499 W Central Blvd
Coquille, OR 97423

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Coquille High School",'Coquille=' + Coquille.length); Coquille[Coquille.length] = createMarker(new GPoint(-124.18933400,43.17560100),"
Coquille Valley Intermediate School
1115 N Baxter St
Coquille, OR 97423

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Coquille Valley Intermediate School",'Coquille=' + Coquille.length); Coquille[Coquille.length] = createMarker(new GPoint(-124.18748474,43.18485260),"
Coquille Valley Middle School
1115 N Baxter St
Coquille, OR 97423

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Coquille Valley Middle School",'Coquille=' + Coquille.length); Coos_Bay[Coos_Bay.length] = createMarker(new GPoint(-124.23040009,43.35039902),"
Destinations Public Charter School
Po Box 509
Coos Bay, OR 97420

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Destinations Public Charter School",'Coos_Bay=' + Coos_Bay.length); Coos_Bay[Coos_Bay.length] = createMarker(new GPoint(-124.23040009,43.35039902),"
Eastside Elementary School
Po Box 509
Coos Bay, OR 97420

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Eastside Elementary School",'Coos_Bay=' + Coos_Bay.length); Bandon[Bandon.length] = createMarker(new GPoint(-124.41915894,43.11533737),"
Harbor Lights Middle School
390 9th St Sw
Bandon, OR 97411

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Harbor Lights Middle School",'Bandon=' + Bandon.length); North_Bend[North_Bend.length] = createMarker(new GPoint(-124.22898865,43.40243530),"
Hillcrest Elementary School
1100 Main St
North Bend, OR 97459

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hillcrest Elementary School",'North_Bend=' + North_Bend.length); Coquille[Coquille.length] = createMarker(new GPoint(-124.19681549,43.18953705),"
Jefferson Elementary School
790 W 17th
Coquille, OR 97423

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jefferson Elementary School",'Coquille=' + Coquille.length); North_Bend[North_Bend.length] = createMarker(new GPoint(-124.21047211,43.50252151),"
Lighthouse School
93670 Viking Ln, Suite 1
North Bend, OR 97459

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lighthouse School",'North_Bend=' + North_Bend.length); Coquille[Coquille.length] = createMarker(new GPoint(-124.18211365,43.18693924),"
Lincoln Elementary School
1366 N Gould St
Coquille, OR 97423

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Coquille=' + Coquille.length); Coos_Bay[Coos_Bay.length] = createMarker(new GPoint(-124.23040009,43.35039902),"
Madison Elementary School
Po Box 509
Coos Bay, OR 97420

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Madison Elementary School",'Coos_Bay=' + Coos_Bay.length); Coos_Bay[Coos_Bay.length] = createMarker(new GPoint(-124.23040009,43.35039902),"
Marshfield Senior High School
Po Box 509
Coos Bay, OR 97420

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Marshfield Senior High School",'Coos_Bay=' + Coos_Bay.length); Coos_Bay[Coos_Bay.length] = createMarker(new GPoint(-124.23040009,43.35039902),"
Millicoma Intermediate School
Po Box 509
Coos Bay, OR 97420

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Millicoma Intermediate School",'Coos_Bay=' + Coos_Bay.length); Myrtle_Point[Myrtle_Point.length] = createMarker(new GPoint(-124.13741302,43.06370544),"
Myrtle Crest School
903 Myrtle Crest Ln
Myrtle Point, OR 97458

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Myrtle Crest School",'Myrtle_Point=' + Myrtle_Point.length); Myrtle_Point[Myrtle_Point.length] = createMarker(new GPoint(-124.14323425,43.06116104),"
Myrtle Point High School
717 4th St
Myrtle Point, OR 97458

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Myrtle Point High School",'Myrtle_Point=' + Myrtle_Point.length); North_Bend[North_Bend.length] = createMarker(new GPoint(-124.21047211,43.50252151),"
North Bay Elementary School
93670 Viking Ln
North Bend, OR 97459

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("North Bay Elementary School",'North_Bend=' + North_Bend.length); North_Bend[North_Bend.length] = createMarker(new GPoint(-124.23458862,43.39893723),"
North Bend Middle School
1500 16th St
North Bend, OR 97459

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("North Bend Middle School",'North_Bend=' + North_Bend.length); North_Bend[North_Bend.length] = createMarker(new GPoint(-124.23480988,43.40233612),"
North Bend Senior High School
2323 Pacific Ave
North Bend, OR 97459

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("North Bend Senior High School",'North_Bend=' + North_Bend.length); Bandon[Bandon.length] = createMarker(new GPoint(-124.41618347,43.11381149),"
Ocean Crest Elementary School
1040 Allegany
Bandon, OR 97411

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ocean Crest Elementary School",'Bandon=' + Bandon.length); North_Bend[North_Bend.length] = createMarker(new GPoint(-124.22927856,43.40090179),"
Oregon Coast Technology School
1913 Meade St
North Bend, OR 97459

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oregon Coast Technology School",'North_Bend=' + North_Bend.length); North_Bend[North_Bend.length] = createMarker(new GPoint(-124.15950012,43.43920135),"
Pacific Child Care Center
Po Box 987
North Bend, OR 97459

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pacific Child Care Center",'North_Bend=' + North_Bend.length); Powers[Powers.length] = createMarker(new GPoint(-124.04270172,42.84859848),"
Powers Elementary School
Po Box 479
Powers, OR 97466

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Powers Elementary School",'Powers=' + Powers.length); Powers[Powers.length] = createMarker(new GPoint(-124.04270172,42.84859848),"
Powers High School
Po Box 479
Powers, OR 97466

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Powers High School",'Powers=' + Powers.length); Coos_Bay[Coos_Bay.length] = createMarker(new GPoint(-124.23696500,43.37790100),"
Resource Link Charter School
Po Box 509
Coos Bay, OR 97420

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Resource Link Charter School",'Coos_Bay=' + Coos_Bay.length); Coos_Bay[Coos_Bay.length] = createMarker(new GPoint(-124.23040009,43.35039902),"
Sunset Middle School
Po Box 509
Coos Bay, OR 97420

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Sunset Middle School",'Coos_Bay=' + Coos_Bay.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(Bandon); map.removeOverlays(Coos_Bay); map.removeOverlays(Coquille); map.removeOverlays(Myrtle_Point); map.removeOverlays(North_Bend); map.removeOverlays(Powers); 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(Bandon);map.removeOverlays(Bandon); map.removeOverlays(Coos_Bay); map.removeOverlays(Coquille); map.removeOverlays(Myrtle_Point); map.removeOverlays(North_Bend); map.removeOverlays(Powers); map.addOverlays(Bandon); centerByArray(Bandon, false, false); cntMarker += Bandon.length; map.addOverlays(Coos_Bay); centerByArray(Coos_Bay, false, false); cntMarker += Coos_Bay.length; map.addOverlays(Coquille); centerByArray(Coquille, false, false); cntMarker += Coquille.length; map.addOverlays(Myrtle_Point); centerByArray(Myrtle_Point, false, false); cntMarker += Myrtle_Point.length; map.addOverlays(North_Bend); centerByArray(North_Bend, false, false); cntMarker += North_Bend.length; map.addOverlays(Powers); centerByArray(Powers, false, false); cntMarker += Powers.length; centerByArray(Bandon,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'); } }