function addMarkers(){
mySelect = document.getElementById('selection');
Wisconsin_Rapids = [];Beloit = [];Pewaukee = [];Milwaukee = [];Pembine = [];Cedarburg = [];Wauwatosa = [];Jackson = [];Sheboygan = [];Waukesha = [];Crandon = [];Neenah = [];Green_Bay = [];Delavan = [];Mayville = [];Menasha = [];Mosinee = [];Greenleaf = [];mySelect.options[mySelect.options.length] = new Option("Beloit schools",'all=Beloit');
mySelect.options[mySelect.options.length] = new Option("Cedarburg schools",'all=Cedarburg');
mySelect.options[mySelect.options.length] = new Option("Crandon schools",'all=Crandon');
mySelect.options[mySelect.options.length] = new Option("Delavan schools",'all=Delavan');
mySelect.options[mySelect.options.length] = new Option("Green Bay schools",'all=Green_Bay');
mySelect.options[mySelect.options.length] = new Option("Greenleaf schools",'all=Greenleaf');
mySelect.options[mySelect.options.length] = new Option("Jackson schools",'all=Jackson');
mySelect.options[mySelect.options.length] = new Option("Mayville schools",'all=Mayville');
mySelect.options[mySelect.options.length] = new Option("Menasha schools",'all=Menasha');
mySelect.options[mySelect.options.length] = new Option("Milwaukee schools",'all=Milwaukee');
mySelect.options[mySelect.options.length] = new Option("Mosinee schools",'all=Mosinee');
mySelect.options[mySelect.options.length] = new Option("Neenah schools",'all=Neenah');
mySelect.options[mySelect.options.length] = new Option("Pembine schools",'all=Pembine');
mySelect.options[mySelect.options.length] = new Option("Pewaukee schools",'all=Pewaukee');
mySelect.options[mySelect.options.length] = new Option("Sheboygan schools",'all=Sheboygan');
mySelect.options[mySelect.options.length] = new Option("Waukesha schools",'all=Waukesha');
mySelect.options[mySelect.options.length] = new Option("Wauwatosa schools",'all=Wauwatosa');
mySelect.options[mySelect.options.length] = new Option("Wisconsin Rapids schools",'all=Wisconsin_Rapids');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Wisconsin_Rapids[Wisconsin_Rapids.length] = createMarker(new GPoint(-89.82544400,44.38469200),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Assumption Middle School",'Wisconsin_Rapids=' + Wisconsin_Rapids.length);
Beloit[Beloit.length] = createMarker(new GPoint(-89.05128800,42.50389500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Brother Dutton School",'Beloit=' + Beloit.length);
Pewaukee[Pewaukee.length] = createMarker(new GPoint(-88.17235000,43.08588100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Children's Learning Center, Inc.",'Pewaukee=' + Pewaukee.length);
Milwaukee[Milwaukee.length] = createMarker(new GPoint(-87.97006600,43.09624000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Christian Faith Academy",'Milwaukee=' + Milwaukee.length);
Pembine[Pembine.length] = createMarker(new GPoint(-87.99689300,45.58014000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Faith Baptist School",'Pembine=' + Pembine.length);
Cedarburg[Cedarburg.length] = createMarker(new GPoint(-88.00140000,43.30290000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("First Immanuel Lutheran School",'Cedarburg=' + Cedarburg.length);
Milwaukee[Milwaukee.length] = createMarker(new GPoint(-87.95657400,43.11280200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Imani Academy",'Milwaukee=' + Milwaukee.length);
Wauwatosa[Wauwatosa.length] = createMarker(new GPoint(-88.00932400,43.04671000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Kradwell School",'Wauwatosa=' + Wauwatosa.length);
Jackson[Jackson.length] = createMarker(new GPoint(-88.16626900,43.32266600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Living Word Lutheran High School",'Jackson=' + Jackson.length);
Sheboygan[Sheboygan.length] = createMarker(new GPoint(-87.73245500,43.76591800),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Montessori Childrens House",'Sheboygan=' + Sheboygan.length);
Waukesha[Waukesha.length] = createMarker(new GPoint(-88.26768000,43.02153600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Montessori School Of Waukesha",'Waukesha=' + Waukesha.length);
Crandon[Crandon.length] = createMarker(new GPoint(-88.88729900,45.57448900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("New Hope Christian School",'Crandon=' + Crandon.length);
Neenah[Neenah.length] = createMarker(new GPoint(-88.47029700,44.22578500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("New Hope Christian School",'Neenah=' + Neenah.length);
Green_Bay[Green_Bay.length] = createMarker(new GPoint(-87.95353600,44.47720200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Northeastern Wisconsin Lutheran High School",'Green_Bay=' + Green_Bay.length);
Delavan[Delavan.length] = createMarker(new GPoint(-88.65708100,42.62761700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Our Redeemer Lutheran School",'Delavan=' + Delavan.length);
Green_Bay[Green_Bay.length] = createMarker(new GPoint(-88.06893400,44.50908600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pilgrim Lutheran School",'Green_Bay=' + Green_Bay.length);
Milwaukee[Milwaukee.length] = createMarker(new GPoint(-87.94481100,43.01991700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Prince Of Peace School",'Milwaukee=' + Milwaukee.length);
Sheboygan[Sheboygan.length] = createMarker(new GPoint(-87.73408900,43.76732000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Dominic Elementary School",'Sheboygan=' + Sheboygan.length);
Mayville[Mayville.length] = createMarker(new GPoint(-88.54013400,43.49393700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. Mary Elementary School",'Mayville=' + Mayville.length);
Milwaukee[Milwaukee.length] = createMarker(new GPoint(-88.02274400,43.08588300),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("St. Rose Youth & Family Center School",'Milwaukee=' + Milwaukee.length);
Menasha[Menasha.length] = createMarker(new GPoint(-88.45395400,44.19377900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Seton Catholic Middle School",'Menasha=' + Menasha.length);
Neenah[Neenah.length] = createMarker(new GPoint(-88.48144500,44.18638100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Gabriel Elementary School",'Neenah=' + Neenah.length);
Milwaukee[Milwaukee.length] = createMarker(new GPoint(-87.90978700,43.05936200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St Marcus Lutheran School",'Milwaukee=' + Milwaukee.length);
Milwaukee[Milwaukee.length] = createMarker(new GPoint(-87.91115100,43.15799200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Wisconsin Center For Gifted Learners",'Milwaukee=' + Milwaukee.length);
Milwaukee[Milwaukee.length] = createMarker(new GPoint(-87.87206000,43.07728700),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Wisconsin Institute For Torah Study",'Milwaukee=' + Milwaukee.length);
Mosinee[Mosinee.length] = createMarker(new GPoint(-89.68328300,44.81126500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Wisconsin Valley Lutheran High School",'Mosinee=' + Mosinee.length);
Greenleaf[Greenleaf.length] = createMarker(new GPoint(-88.03880000,44.28830000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Zion Lutheran School Of Wayside",'Greenleaf=' + Greenleaf.length);
map.removeOverlays(Beloit);
map.removeOverlays(Cedarburg);
map.removeOverlays(Crandon);
map.removeOverlays(Delavan);
map.removeOverlays(Green_Bay);
map.removeOverlays(Greenleaf);
map.removeOverlays(Jackson);
map.removeOverlays(Mayville);
map.removeOverlays(Menasha);
map.removeOverlays(Milwaukee);
map.removeOverlays(Mosinee);
map.removeOverlays(Neenah);
map.removeOverlays(Pembine);
map.removeOverlays(Pewaukee);
map.removeOverlays(Sheboygan);
map.removeOverlays(Waukesha);
map.removeOverlays(Wauwatosa);
map.removeOverlays(Wisconsin_Rapids);
setTimeout(function(){map.addOverlays(Beloit)},1000);
setTimeout(function(){map.addOverlays(Cedarburg)},1000);
setTimeout(function(){map.addOverlays(Crandon)},1000);
setTimeout(function(){map.addOverlays(Delavan)},1000);
setTimeout(function(){map.addOverlays(Green_Bay)},1000);
setTimeout(function(){map.addOverlays(Greenleaf)},1000);
setTimeout(function(){map.addOverlays(Jackson)},1000);
setTimeout(function(){map.addOverlays(Mayville)},1000);
setTimeout(function(){map.addOverlays(Menasha)},1000);
setTimeout(function(){map.addOverlays(Milwaukee)},1000);
setTimeout(function(){map.addOverlays(Mosinee)},1000);
setTimeout(function(){map.addOverlays(Neenah)},1000);
setTimeout(function(){map.addOverlays(Pembine)},1000);
setTimeout(function(){map.addOverlays(Pewaukee)},1000);
setTimeout(function(){map.addOverlays(Sheboygan)},1000);
setTimeout(function(){map.addOverlays(Waukesha)},1000);
setTimeout(function(){map.addOverlays(Wauwatosa)},1000);
setTimeout(function(){map.addOverlays(Wisconsin_Rapids)},1000);
maxLng = -87.73245500;
maxLat = 45.58014000;
minLng = -89.82544400;
minLat = 42.50389500;
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,11);
/*
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(Beloit);
map.removeOverlays(Cedarburg);
map.removeOverlays(Crandon);
map.removeOverlays(Delavan);
map.removeOverlays(Green_Bay);
map.removeOverlays(Greenleaf);
map.removeOverlays(Jackson);
map.removeOverlays(Mayville);
map.removeOverlays(Menasha);
map.removeOverlays(Milwaukee);
map.removeOverlays(Mosinee);
map.removeOverlays(Neenah);
map.removeOverlays(Pembine);
map.removeOverlays(Pewaukee);
map.removeOverlays(Sheboygan);
map.removeOverlays(Waukesha);
map.removeOverlays(Wauwatosa);
map.removeOverlays(Wisconsin_Rapids);
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(Wisconsin_Rapids);map.removeOverlays(Beloit);
map.removeOverlays(Cedarburg);
map.removeOverlays(Crandon);
map.removeOverlays(Delavan);
map.removeOverlays(Green_Bay);
map.removeOverlays(Greenleaf);
map.removeOverlays(Jackson);
map.removeOverlays(Mayville);
map.removeOverlays(Menasha);
map.removeOverlays(Milwaukee);
map.removeOverlays(Mosinee);
map.removeOverlays(Neenah);
map.removeOverlays(Pembine);
map.removeOverlays(Pewaukee);
map.removeOverlays(Sheboygan);
map.removeOverlays(Waukesha);
map.removeOverlays(Wauwatosa);
map.removeOverlays(Wisconsin_Rapids);
map.addOverlays(Beloit);
centerByArray(Beloit, false, false);
cntMarker += Beloit.length;
map.addOverlays(Cedarburg);
centerByArray(Cedarburg, false, false);
cntMarker += Cedarburg.length;
map.addOverlays(Crandon);
centerByArray(Crandon, false, false);
cntMarker += Crandon.length;
map.addOverlays(Delavan);
centerByArray(Delavan, false, false);
cntMarker += Delavan.length;
map.addOverlays(Green_Bay);
centerByArray(Green_Bay, false, false);
cntMarker += Green_Bay.length;
map.addOverlays(Greenleaf);
centerByArray(Greenleaf, false, false);
cntMarker += Greenleaf.length;
map.addOverlays(Jackson);
centerByArray(Jackson, false, false);
cntMarker += Jackson.length;
map.addOverlays(Mayville);
centerByArray(Mayville, false, false);
cntMarker += Mayville.length;
map.addOverlays(Menasha);
centerByArray(Menasha, false, false);
cntMarker += Menasha.length;
map.addOverlays(Milwaukee);
centerByArray(Milwaukee, false, false);
cntMarker += Milwaukee.length;
map.addOverlays(Mosinee);
centerByArray(Mosinee, false, false);
cntMarker += Mosinee.length;
map.addOverlays(Neenah);
centerByArray(Neenah, false, false);
cntMarker += Neenah.length;
map.addOverlays(Pembine);
centerByArray(Pembine, false, false);
cntMarker += Pembine.length;
map.addOverlays(Pewaukee);
centerByArray(Pewaukee, false, false);
cntMarker += Pewaukee.length;
map.addOverlays(Sheboygan);
centerByArray(Sheboygan, false, false);
cntMarker += Sheboygan.length;
map.addOverlays(Waukesha);
centerByArray(Waukesha, false, false);
cntMarker += Waukesha.length;
map.addOverlays(Wauwatosa);
centerByArray(Wauwatosa, false, false);
cntMarker += Wauwatosa.length;
map.addOverlays(Wisconsin_Rapids);
centerByArray(Wisconsin_Rapids, false, false);
cntMarker += Wisconsin_Rapids.length;
centerByArray(Wisconsin_Rapids,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///29737,29732,35745,30222,30301,35536,29528,29655,29401,29434,29548,29737,29779,29799,30321,30070,29871,35533,35781,29813,30058,30295,29739,29957,29528,30327,35535,29935,29716,29655,/all');
//window.open('/map.php?type=2&schools=29737,29732,35745,30222,30301,35536,29528,29655,29401,29434,29548,29737,29779,29799,30321,30070,29871,35533,35781,29813,30058,30295,29739,29957,29528,30327,35535,29935,29716,29655,&school_level=&radius=&zipcode=&school_type_search=&school_type_code=');
}
}
function createMarker(point, label, icon)
{
var marker = new GMarker(point, icon);
var html = label;
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(html);
});
return marker;
}