function addMarkers() { mySelect = document.getElementById('selection'); Firth = [];Aberdeen = [];Blackfoot = [];Shelley = [];Pocatello = [];Pingree = [];Moreland = [];Fort_Hall = [];mySelect.options[mySelect.options.length] = new Option("Aberdeen schools",'all=Aberdeen'); mySelect.options[mySelect.options.length] = new Option("Blackfoot schools",'all=Blackfoot'); mySelect.options[mySelect.options.length] = new Option("Firth schools",'all=Firth'); mySelect.options[mySelect.options.length] = new Option("Fort Hall schools",'all=Fort_Hall'); mySelect.options[mySelect.options.length] = new Option("Moreland schools",'all=Moreland'); mySelect.options[mySelect.options.length] = new Option("Pingree schools",'all=Pingree'); mySelect.options[mySelect.options.length] = new Option("Pocatello schools",'all=Pocatello'); mySelect.options[mySelect.options.length] = new Option("Shelley schools",'all=Shelley'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Firth[Firth.length] = createMarker(new GPoint(-112.17823029,43.30138779),"
A W Johnson Elementary School
735 N 600 E
Firth, ID 83236

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("A W Johnson Elementary School",'Firth=' + Firth.length); Aberdeen[Aberdeen.length] = createMarker(new GPoint(-112.83200073,42.97449875),"
Aberdeen Elementary Middle School
P O Box 610
Aberdeen, ID 83210

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Aberdeen Elementary Middle School",'Aberdeen=' + Aberdeen.length); Aberdeen[Aberdeen.length] = createMarker(new GPoint(-112.83200073,42.97449875),"
Aberdeen High School
Po Box 610
Aberdeen, ID 83210

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Aberdeen High School",'Aberdeen=' + Aberdeen.length); Aberdeen[Aberdeen.length] = createMarker(new GPoint(-112.83874200,42.94414800),"
Aberdeen Middle School
P O Box 610
Aberdeen, ID 83210

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Aberdeen Middle School",'Aberdeen=' + Aberdeen.length); Blackfoot[Blackfoot.length] = createMarker(new GPoint(-112.34177399,43.18701172),"
Blackfoot Community Learning
1350 Parkway Dr Ste 15
Blackfoot, ID 83221

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Blackfoot Community Learning",'Blackfoot=' + Blackfoot.length); Blackfoot[Blackfoot.length] = createMarker(new GPoint(-112.34740448,43.17905426),"
Blackfoot High School
870 S Fisher Avenue
Blackfoot, ID 83221

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Blackfoot High School",'Blackfoot=' + Blackfoot.length); Blackfoot[Blackfoot.length] = createMarker(new GPoint(-112.34337616,43.18721008),"
Blackfoot Sixth Grade Elementary School
50 S Shilling Avenue
Blackfoot, ID 83221

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Blackfoot Sixth Grade Elementary School",'Blackfoot=' + Blackfoot.length); Shelley[Shelley.length] = createMarker(new GPoint(-112.12533569,43.38153839),"
Dean Goodsell Primary School
200 E First
Shelley, ID 83274

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Dean Goodsell Primary School",'Shelley=' + Shelley.length); Blackfoot[Blackfoot.length] = createMarker(new GPoint(-112.36354828,43.18778992),"
Donald D. Stalker Elementary School
991 W Center Street
Blackfoot, ID 83221

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Donald D. Stalker Elementary School",'Blackfoot=' + Blackfoot.length); Shelley[Shelley.length] = createMarker(new GPoint(-112.11819458,43.37956238),"
Donald J Hobbs Middle School
350 East Pine Street
Shelley, ID 83274

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Donald J Hobbs Middle School",'Shelley=' + Shelley.length); Firth[Firth.length] = createMarker(new GPoint(-112.07289886,43.25839996),"
Firth High School
Po Box 247
Firth, ID 83236

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Firth High School",'Firth=' + Firth.length); Firth[Firth.length] = createMarker(new GPoint(-112.18795776,43.30635071),"
Firth Middle School
410 Roosevelt
Firth, ID 83236

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Firth Middle School",'Firth=' + Firth.length); Pocatello[Pocatello.length] = createMarker(new GPoint(-112.41809845,43.02769852),"
Fort Hall Elementary School
Rt 6 Box 430
Pocatello, ID 83202

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fort Hall Elementary School",'Pocatello=' + Pocatello.length); Blackfoot[Blackfoot.length] = createMarker(new GPoint(-112.46326447,43.25325012),"
Groveland Elementary School
170 N 375 W
Blackfoot, ID 83221

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Groveland Elementary School",'Blackfoot=' + Blackfoot.length); Shelley[Shelley.length] = createMarker(new GPoint(-112.13262939,43.38153839),"
Hazel Stuart Elementary School
475 West Center Street
Shelley, ID 83274

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Hazel Stuart Elementary School",'Shelley=' + Shelley.length); Blackfoot[Blackfoot.length] = createMarker(new GPoint(-112.34518433,43.18070221),"
I T Stoddard Elementary School
460 York Drive
Blackfoot, ID 83221

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("I T Stoddard Elementary School",'Blackfoot=' + Blackfoot.length); Pingree[Pingree.length] = createMarker(new GPoint(-112.47498322,43.21212769),"
Idaho Leadership Academy
P O Box 59
Pingree, ID 83262

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Idaho Leadership Academy",'Pingree=' + Pingree.length); Blackfoot[Blackfoot.length] = createMarker(new GPoint(-112.33925629,43.19004059),"
Independence Alternate High School
155 E Francis St
Blackfoot, ID 83221

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Independence Alternate High School",'Blackfoot=' + Blackfoot.length); Blackfoot[Blackfoot.length] = createMarker(new GPoint(-112.35011292,43.19063950),"
Irving Kindergarten Center
440 W Judicial Street
Blackfoot, ID 83221

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Irving Kindergarten Center",'Blackfoot=' + Blackfoot.length); Moreland[Moreland.length] = createMarker(new GPoint(-112.44309998,43.22150040),"
Moreland Elementary School
Po Box B
Moreland, ID 83256

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Moreland Elementary School",'Moreland=' + Moreland.length); Blackfoot[Blackfoot.length] = createMarker(new GPoint(-112.28718567,43.18262100),"
Mountain View Middle School
645 Mitchell Road
Blackfoot, ID 83221

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Mountain View Middle School",'Blackfoot=' + Blackfoot.length); Blackfoot[Blackfoot.length] = createMarker(new GPoint(-112.28718567,43.18262100),"
Mountain View Middle School (alt)
645 Mitchell Rd
Blackfoot, ID 83221

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Mountain View Middle School (alt)",'Blackfoot=' + Blackfoot.length); Pingree[Pingree.length] = createMarker(new GPoint(-112.64080048,43.13219833),"
Pingree Elementary School
Post Office Box 39
Pingree, ID 83262

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pingree Elementary School",'Pingree=' + Pingree.length); Blackfoot[Blackfoot.length] = createMarker(new GPoint(-112.33872223,43.20724869),"
Ridge Crest Elementary School
800 Airport Rd
Blackfoot, ID 83221

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ridge Crest Elementary School",'Blackfoot=' + Blackfoot.length); Blackfoot[Blackfoot.length] = createMarker(new GPoint(-112.43548584,43.19411087),"
Riverside Elementary School
16 S 700 W
Blackfoot, ID 83221

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Riverside Elementary School",'Blackfoot=' + Blackfoot.length); Blackfoot[Blackfoot.length] = createMarker(new GPoint(-112.52622223,43.19732666),"
Rockford Elementary School
1152 W Hwy 39
Blackfoot, ID 83221

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rockford Elementary School",'Blackfoot=' + Blackfoot.length); Shelley[Shelley.length] = createMarker(new GPoint(-112.12091064,43.37416458),"
Shelley Junior High School
200 East Fir Street
Shelley, ID 83274

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Shelley Junior High School",'Shelley=' + Shelley.length); Shelley[Shelley.length] = createMarker(new GPoint(-112.13414001,43.37416458),"
Shelley Senior High School
570 West Fir Street
Shelley, ID 83274

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Shelley Senior High School",'Shelley=' + Shelley.length); Fort_Hall[Fort_Hall.length] = createMarker(new GPoint(-112.41010284,42.99829865),"
Sho-ban School District No. 512
Po Box 790
Fort Hall, ID 83203

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sho-ban School District No. 512",'Fort_Hall=' + Fort_Hall.length); Blackfoot[Blackfoot.length] = createMarker(new GPoint(-112.47973633,43.19710541),"
Snake River High School
922 West Highway 39
Blackfoot, ID 83221

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Snake River High School",'Blackfoot=' + Blackfoot.length); Blackfoot[Blackfoot.length] = createMarker(new GPoint(-112.47886658,43.19709396),"
Snake River Junior High School
918 W Highway 39
Blackfoot, ID 83221

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Snake River Junior High School",'Blackfoot=' + Blackfoot.length); Blackfoot[Blackfoot.length] = createMarker(new GPoint(-112.50782776,43.18103790),"
Snake River Middle School
1060 W 110 S
Blackfoot, ID 83221

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Snake River Middle School",'Blackfoot=' + Blackfoot.length); Blackfoot[Blackfoot.length] = createMarker(new GPoint(-112.39520264,43.20539856),"
State Hospital South
Po Box 400
Blackfoot, ID 83221

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("State Hospital South",'Blackfoot=' + Blackfoot.length); Blackfoot[Blackfoot.length] = createMarker(new GPoint(-112.35346985,43.19614029),"
Vaughn Hugie Family Ed Center
420 Cedar
Blackfoot, ID 83221

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Vaughn Hugie Family Ed Center",'Blackfoot=' + Blackfoot.length); Blackfoot[Blackfoot.length] = createMarker(new GPoint(-112.34514618,43.19013977),"
Wapello Elementary School
195 E 350 N
Blackfoot, ID 83221

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Wapello Elementary School",'Blackfoot=' + Blackfoot.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(Aberdeen); map.removeOverlays(Blackfoot); map.removeOverlays(Firth); map.removeOverlays(Fort_Hall); map.removeOverlays(Moreland); map.removeOverlays(Pingree); map.removeOverlays(Pocatello); map.removeOverlays(Shelley); 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(Firth);map.removeOverlays(Aberdeen); map.removeOverlays(Blackfoot); map.removeOverlays(Firth); map.removeOverlays(Fort_Hall); map.removeOverlays(Moreland); map.removeOverlays(Pingree); map.removeOverlays(Pocatello); map.removeOverlays(Shelley); map.addOverlays(Aberdeen); centerByArray(Aberdeen, false, false); cntMarker += Aberdeen.length; map.addOverlays(Blackfoot); centerByArray(Blackfoot, false, false); cntMarker += Blackfoot.length; map.addOverlays(Firth); centerByArray(Firth, false, false); cntMarker += Firth.length; map.addOverlays(Fort_Hall); centerByArray(Fort_Hall, false, false); cntMarker += Fort_Hall.length; map.addOverlays(Moreland); centerByArray(Moreland, false, false); cntMarker += Moreland.length; map.addOverlays(Pingree); centerByArray(Pingree, false, false); cntMarker += Pingree.length; map.addOverlays(Pocatello); centerByArray(Pocatello, false, false); cntMarker += Pocatello.length; map.addOverlays(Shelley); centerByArray(Shelley, false, false); cntMarker += Shelley.length; centerByArray(Firth,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'); } }