function addMarkers() { mySelect = document.getElementById('selection'); Grants_Pass = [];Cave_Junction = [];Williams = [];Wolf_Creek = [];mySelect.options[mySelect.options.length] = new Option("Cave Junction schools",'all=Cave_Junction'); mySelect.options[mySelect.options.length] = new Option("Grants Pass schools",'all=Grants_Pass'); mySelect.options[mySelect.options.length] = new Option("Williams schools",'all=Williams'); mySelect.options[mySelect.options.length] = new Option("Wolf Creek schools",'all=Wolf_Creek'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Grants_Pass[Grants_Pass.length] = createMarker(new GPoint(-123.34503174,42.41081238),"
Allen Dale Elementary School
2320 Williams Hwy
Grants Pass, OR 97527

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Allen Dale Elementary School",'Grants_Pass=' + Grants_Pass.length); Cave_Junction[Cave_Junction.length] = createMarker(new GPoint(-123.65219879,42.16953659),"
Evergreen Elementary School
520 W River St
Cave Junction, OR 97523

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Evergreen Elementary School",'Cave_Junction=' + Cave_Junction.length); Grants_Pass[Grants_Pass.length] = createMarker(new GPoint(-123.32466400,42.44316500),"
Family Friends Day Treatment Center
322 Nw ''f'' St
Grants Pass, OR 97526

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Family Friends Day Treatment Center",'Grants_Pass=' + Grants_Pass.length); Grants_Pass[Grants_Pass.length] = createMarker(new GPoint(-123.37512207,42.50599670),"
Fleming Middle School
6001 Monument Dr
Grants Pass, OR 97526

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Fleming Middle School",'Grants_Pass=' + Grants_Pass.length); Grants_Pass[Grants_Pass.length] = createMarker(new GPoint(-123.30908203,42.42156601),"
Fruitdale Elementary School
1560 Bill Baker Way
Grants Pass, OR 97527

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fruitdale Elementary School",'Grants_Pass=' + Grants_Pass.length); Grants_Pass[Grants_Pass.length] = createMarker(new GPoint(-123.41567993,42.44662857),"
Ft Vannoy Elementary School
5250 Upper River Rd
Grants Pass, OR 97526

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ft Vannoy Elementary School",'Grants_Pass=' + Grants_Pass.length); Grants_Pass[Grants_Pass.length] = createMarker(new GPoint(-123.31778717,42.44393921),"
Grants Pass High School
830 Ne 9th St
Grants Pass, OR 97526

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Grants Pass High School",'Grants_Pass=' + Grants_Pass.length); Grants_Pass[Grants_Pass.length] = createMarker(new GPoint(-123.34172058,42.32642746),"
Hidden Valley High School
651 Murphy Creek Rd
Grants Pass, OR 97527

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hidden Valley High School",'Grants_Pass=' + Grants_Pass.length); Grants_Pass[Grants_Pass.length] = createMarker(new GPoint(-123.33231354,42.45980072),"
Highland Elementary School
1845 Nw Highland Ave
Grants Pass, OR 97526

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Highland Elementary School",'Grants_Pass=' + Grants_Pass.length); Cave_Junction[Cave_Junction.length] = createMarker(new GPoint(-123.65280151,42.16939926),"
Illinois Valley High School
River St Laurel Rd
Cave Junction, OR 97523

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Illinois Valley High School",'Cave_Junction=' + Cave_Junction.length); Grants_Pass[Grants_Pass.length] = createMarker(new GPoint(-123.43273163,42.40663528),"
Jerome Prairie Elementary School
2555 Walnut Ave
Grants Pass, OR 97527

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jerome Prairie Elementary School",'Grants_Pass=' + Grants_Pass.length); Grants_Pass[Grants_Pass.length] = createMarker(new GPoint(-123.31278229,42.45066833),"
Lincoln Elementary School
1132 Ne 10th St
Grants Pass, OR 97526

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Grants_Pass=' + Grants_Pass.length); Grants_Pass[Grants_Pass.length] = createMarker(new GPoint(-123.33444977,42.34753799),"
Lincoln Savage Middle School
8551 New Hope Rd
Grants Pass, OR 97527

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Lincoln Savage Middle School",'Grants_Pass=' + Grants_Pass.length); Cave_Junction[Cave_Junction.length] = createMarker(new GPoint(-123.64351654,42.16946030),"
Lorna Byrne Middle School
101 S Junction Ave
Cave Junction, OR 97523

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Lorna Byrne Middle School",'Cave_Junction=' + Cave_Junction.length); Grants_Pass[Grants_Pass.length] = createMarker(new GPoint(-123.36228180,42.36222076),"
Madrona Elementary School
520 Detrick Dr
Grants Pass, OR 97527

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Madrona Elementary School",'Grants_Pass=' + Grants_Pass.length); Grants_Pass[Grants_Pass.length] = createMarker(new GPoint(-123.37451172,42.50593567),"
Manzanita Elementary School
310 San Francisco St
Grants Pass, OR 97526

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Manzanita Elementary School",'Grants_Pass=' + Grants_Pass.length); Grants_Pass[Grants_Pass.length] = createMarker(new GPoint(-123.29794312,42.43251038),"
Newbridge High School
2001 Ne Spaulding
Grants Pass, OR 97526

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Newbridge High School",'Grants_Pass=' + Grants_Pass.length); Grants_Pass[Grants_Pass.length] = createMarker(new GPoint(-123.33231354,42.45765305),"
North Middle School
1725 Nw Highland Ave
Grants Pass, OR 97526

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("North Middle School",'Grants_Pass=' + Grants_Pass.length); Grants_Pass[Grants_Pass.length] = createMarker(new GPoint(-123.38002777,42.51810074),"
North Valley High School
6741 Monument Dr
Grants Pass, OR 97526

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("North Valley High School",'Grants_Pass=' + Grants_Pass.length); Grants_Pass[Grants_Pass.length] = createMarker(new GPoint(-123.34951019,42.43386459),"
Parkside Elementary School
735 Sw Wagner Meadows Dr
Grants Pass, OR 97526

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Parkside Elementary School",'Grants_Pass=' + Grants_Pass.length); Grants_Pass[Grants_Pass.length] = createMarker(new GPoint(-123.38964844,42.42963791),"
Redwood Elementary School
3163 Leonard Rd
Grants Pass, OR 97527

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Redwood Elementary School",'Grants_Pass=' + Grants_Pass.length); Grants_Pass[Grants_Pass.length] = createMarker(new GPoint(-123.29868317,42.42639542),"
Riverside Elementary School
1200 Se Harvey Dr
Grants Pass, OR 97526

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Riverside Elementary School",'Grants_Pass=' + Grants_Pass.length); Grants_Pass[Grants_Pass.length] = createMarker(new GPoint(-123.33421326,42.41523743),"
South Middle School
350 W Harbeck Rd
Grants Pass, OR 97527

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("South Middle School",'Grants_Pass=' + Grants_Pass.length); Grants_Pass[Grants_Pass.length] = createMarker(new GPoint(-123.40458679,42.51612854),"
Southern Oregon Astc
210 Tacoma St
Grants Pass, OR 97526

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Southern Oregon Astc",'Grants_Pass=' + Grants_Pass.length); Grants_Pass[Grants_Pass.length] = createMarker(new GPoint(-123.34725189,42.41883087),"
Southern Oregon Astc A&e
711 Sw Ramsey Ave
Grants Pass, OR 97257

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Southern Oregon Astc A&e",'Grants_Pass=' + Grants_Pass.length); Williams[Williams.length] = createMarker(new GPoint(-123.28469849,42.20790100),"
Williams Elementary School
Po Box 88
Williams, OR 97544

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Williams Elementary School",'Williams=' + Williams.length); Wolf_Creek[Wolf_Creek.length] = createMarker(new GPoint(-123.35399628,42.66759872),"
Wolf Creek Elementary School
Po Box 325
Wolf Creek, OR 97497

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wolf Creek Elementary School",'Wolf_Creek=' + Wolf_Creek.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(Cave_Junction); map.removeOverlays(Grants_Pass); map.removeOverlays(Williams); map.removeOverlays(Wolf_Creek); 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(Grants_Pass);map.removeOverlays(Cave_Junction); map.removeOverlays(Grants_Pass); map.removeOverlays(Williams); map.removeOverlays(Wolf_Creek); map.addOverlays(Cave_Junction); centerByArray(Cave_Junction, false, false); cntMarker += Cave_Junction.length; map.addOverlays(Grants_Pass); centerByArray(Grants_Pass, false, false); cntMarker += Grants_Pass.length; map.addOverlays(Williams); centerByArray(Williams, false, false); cntMarker += Williams.length; map.addOverlays(Wolf_Creek); centerByArray(Wolf_Creek, false, false); cntMarker += Wolf_Creek.length; centerByArray(Grants_Pass,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'); } }