function addMarkers()
{
mySelect = document.getElementById('selection');
Bloomington = [];Bloomington[Bloomington.length] = createMarker(new GPoint(-93.33931500,44.81920400),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("271 - District Extended Year",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.31099701,44.83319855),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("271 Hillcrest Elementary Ts",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.25050354,45.05139923),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("271 Indian Mounds El. Ts.",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.25050354,45.05139923),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("271 Kennedy Alc High School",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.42810059,45.00659943),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("271 Kennedy High School. Reentry Is",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.31202200,44.84440700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("271 Mindquest Oll",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.34480286,44.82770157),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("271 Normandale Hills El. Ts.",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.27970123,44.83919907),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("271 Oak Grove El. Ts.",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.31099701,44.83319855),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("271 Oak Grove Int. Ts.",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.34480286,44.82770157),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("271 Olson El. Ts.",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.34480286,44.82770157),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("271 Olson Middle Ts",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.27970123,44.83919907),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("271 Pond El Ts",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.34480286,44.82770157),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("271 Poplar Bridge El Ts.",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.31099701,44.83319855),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("271 Ridgeview El Ts",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.25050354,45.05139923),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("271 Shape Alc High School",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.27970123,44.83919907),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("271 Valley View El Ts.",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.26822662,44.84241486),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("271 Valley View Middle Ts",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.31099701,44.83319855),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("271 Washburn El Ts",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.31099701,44.83319855),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("271 Westwood El. Ts.",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.27847300,44.82803500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Beacon - (287)",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.31572723,44.83556366),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hillcrest Elementary School",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.25932312,44.82626343),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Indian Mounds Elementary School",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.33142853,44.81916428),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Jefferson Senior High School",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.27841949,44.82636261),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Kennedy Senior High School",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.34912872,45.04056549),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Metropolitan Learning Alliance",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.34742737,44.83156586),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Normandale Hills Elementary School",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.29616547,44.81505203),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Oak Grove Elementary School",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.29592896,44.81186295),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Oak Grove Middle School",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.33576965,44.81924820),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Olson Elementary School",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.33623505,44.81922150),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Olson Middle School",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.29665375,44.81203842),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Olson Middle School Alc 271",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.34282684,44.84856415),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Poplar Bridge Elementary School",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.35892487,44.83466339),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Ridgeview Elementary School",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.34437561,44.80096436),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Southwood Early Childhood",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.27152252,44.84436417),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Valley View Elementary School",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.26827200,44.84227800),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Valley View Middle School",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.31892395,44.85166550),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Washburn Elementary School",'Bloomington=' + Bloomington.length);
Bloomington[Bloomington.length] = createMarker(new GPoint(-93.32548523,44.80836487),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Westwood Elementary School",'Bloomington=' + Bloomington.length);
map.removeOverlays(Bloomington);
setTimeout(function(){map.addOverlays(Bloomington)},1000);
maxLng = -93.25050354;
maxLat = 45.05139923;
minLng = -93.42810059;
minLat = 44.80096436;
reCenterMap();
} // 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(Bloomington);
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(Bloomington);map.removeOverlays(Bloomington);
map.addOverlays(Bloomington);
centerByArray(Bloomington, false, false);
cntMarker += Bloomington.length;
centerByArray(Bloomington,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');
}
}