function addMarkers()
{
mySelect = document.getElementById('selection');
Idaho_Falls = [];Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-112.03565979,43.50038147),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("3-b Dentention Center",'Idaho_Falls=' + Idaho_Falls.length);
Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-112.03694916,43.51123810),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("A H Bush Elementary School",'Idaho_Falls=' + Idaho_Falls.length);
Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-111.96701050,43.47145844),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Ammon Elementary School",'Idaho_Falls=' + Idaho_Falls.length);
Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-111.96938800,43.51137700),"",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),"",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),"",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),"",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),"",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.07492065,43.48949051),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Eagle Rock Junior High School",'Idaho_Falls=' + Idaho_Falls.length);
Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-112.01912689,43.49362183),"",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.01030731,43.48030853),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Edgemont Gardens Elementary School",'Idaho_Falls=' + Idaho_Falls.length);
Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-112.02769470,43.49353790),"",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.06924438,43.49266434),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Ethel Boyes Elementary School",'Idaho_Falls=' + Idaho_Falls.length);
Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-112.01450348,43.58252335),"",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),"",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.07769012,43.47956085),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Foxhollow Elementary School",'Idaho_Falls=' + Idaho_Falls.length);
Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-112.03398895,43.48393631),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hawthorne Elementary School",'Idaho_Falls=' + Idaho_Falls.length);
Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-111.92704773,43.52533722),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hillcrest High School",'Idaho_Falls=' + Idaho_Falls.length);
Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-111.97393036,43.47524261),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hillview Elementary School",'Idaho_Falls=' + Idaho_Falls.length);
Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-112.02371216,43.49235535),"",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),"",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(-112.00811768,43.48983765),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Linden Park Elementary School",'Idaho_Falls=' + Idaho_Falls.length);
Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-112.02629089,43.47526169),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Longfellow Elementary School",'Idaho_Falls=' + Idaho_Falls.length);
Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-112.10263824,43.56796265),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Osgood Elementary School",'Idaho_Falls=' + Idaho_Falls.length);
Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-111.96379089,43.52684784),"",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.97492981,43.47188568),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Sandcreek Middle School",'Idaho_Falls=' + Idaho_Falls.length);
Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-112.06891632,43.48596191),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Skyline Senior High School",'Idaho_Falls=' + Idaho_Falls.length);
Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-112.03634644,43.46406174),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sunnyside Elementary School",'Idaho_Falls=' + Idaho_Falls.length);
Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-112.02870178,43.46067429),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Taylorview Junior High School",'Idaho_Falls=' + Idaho_Falls.length);
Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-111.99349213,43.53934479),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Telford Academy (alt)",'Idaho_Falls=' + Idaho_Falls.length);
Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-112.05675507,43.50140762),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Temple View Elementary School",'Idaho_Falls=' + Idaho_Falls.length);
Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-112.00711060,43.48343658),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Theresa Bunker Elementary School",'Idaho_Falls=' + Idaho_Falls.length);
Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-111.97427368,43.49637222),"",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),"",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.08542633,43.48425674),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Westside Elementary School",'Idaho_Falls=' + Idaho_Falls.length);
Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-112.06891632,43.48596191),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Westview Alternative Evening High School",'Idaho_Falls=' + Idaho_Falls.length);
Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-112.03565979,43.50038147),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("White Pine Charter 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');
}
}