function addMarkers() { mySelect = document.getElementById('selection'); Idaho_Falls = [];Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-111.96938800,43.51137700),"
Behavior Health Alternative
3175 East Lincoln Road
Idaho Falls, ID 83401

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Behavior Health Alternative",'Idaho_Falls=' + Idaho_Falls.length); Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-111.97121429,43.52566528),"
Bonneville High School
3165 East Iona Road
Idaho Falls, ID 83401

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bonneville High School",'Idaho_Falls=' + Idaho_Falls.length); Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-112.01226044,43.50060654),"
Clair E. Gale Junior High School
955 Garfield Street
Idaho Falls, ID 83401

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Clair E. Gale Junior High School",'Idaho_Falls=' + Idaho_Falls.length); Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-111.95363617,43.50344849),"
Cloverdale Elementary School
3999 Greenwillow Ln
Idaho Falls, ID 83401

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cloverdale Elementary School",'Idaho_Falls=' + Idaho_Falls.length); Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-112.01573944,43.49946213),"
Dora Erickson Elementary School
850 Cleveland Street
Idaho Falls, ID 83401

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Dora Erickson Elementary School",'Idaho_Falls=' + Idaho_Falls.length); Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-112.01912689,43.49362183),"
Eastern Idaho Professional-technical High School
690 John Adams Parkway
Idaho Falls, ID 83401

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Eastern Idaho Professional-technical High School",'Idaho_Falls=' + Idaho_Falls.length); Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-112.02769470,43.49353790),"
Emerson Elementary School
335 5th Street
Idaho Falls, ID 83401

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Emerson Elementary School",'Idaho_Falls=' + Idaho_Falls.length); Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-112.01450348,43.58252335),"
Fairview Elementary School
979 East 97th North
Idaho Falls, ID 83401

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fairview Elementary School",'Idaho_Falls=' + Idaho_Falls.length); Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-111.98481750,43.49734879),"
Falls Valley Elementary School
2455 Virlow Street
Idaho Falls, ID 83401

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Falls Valley Elementary School",'Idaho_Falls=' + Idaho_Falls.length); Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-112.02371216,43.49235535),"
Idaho Falls Senior High School
601 S Holmes Avenue
Idaho Falls, ID 83401

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Idaho Falls Senior High School",'Idaho_Falls=' + Idaho_Falls.length); Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-111.96823883,43.51124954),"
Lincoln High School (alt)
3175 East Lincoln Road
Idaho Falls, ID 83401

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lincoln High School (alt)",'Idaho_Falls=' + Idaho_Falls.length); Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-111.96379089,43.52684784),"
Rocky Mountain Middle School
3443 North Ammon Road
Idaho Falls, ID 83401

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Rocky Mountain Middle School",'Idaho_Falls=' + Idaho_Falls.length); Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-111.99349213,43.53934479),"
Telford Academy (alt)
2017 East 49th North
Idaho Falls, ID 83401

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Telford Academy (alt)",'Idaho_Falls=' + Idaho_Falls.length); Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-111.97427368,43.49637222),"
Tiebreaker Elementary School
3100 First Street
Idaho Falls, ID 83401

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Tiebreaker Elementary School",'Idaho_Falls=' + Idaho_Falls.length); Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-111.93456268,43.53238678),"
Ucon Elementary School
10841 North 41 East
Idaho Falls, ID 83401

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ucon Elementary School",'Idaho_Falls=' + Idaho_Falls.length); Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-112.06891632,43.48596191),"
Westview Alternative Evening High School
335 5th Street
Idaho Falls, ID 83401

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Westview Alternative Evening High School",'Idaho_Falls=' + Idaho_Falls.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(Idaho_Falls); 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(Idaho_Falls);map.removeOverlays(Idaho_Falls); map.addOverlays(Idaho_Falls); centerByArray(Idaho_Falls, false, false); cntMarker += Idaho_Falls.length; centerByArray(Idaho_Falls,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'); } }