function addMarkers(){
mySelect = document.getElementById('selection');
Manitowoc = [];Mount_Horeb = [];Two_Rivers = [];De_Pere = [];Milwaukee = [];Green_Bay = [];River_Falls = [];Boscobel = [];Kenosha = [];Waukesha = [];Madison = [];Mequon = [];Appleton = [];West_Bend = [];Sheboygan = [];Wausau = [];River_Hills = [];Racine = [];Janesville = [];La_Crosse = [];mySelect.options[mySelect.options.length] = new Option("Appleton schools",'all=Appleton');
mySelect.options[mySelect.options.length] = new Option("Boscobel schools",'all=Boscobel');
mySelect.options[mySelect.options.length] = new Option("De Pere schools",'all=De_Pere');
mySelect.options[mySelect.options.length] = new Option("Green Bay schools",'all=Green_Bay');
mySelect.options[mySelect.options.length] = new Option("Janesville schools",'all=Janesville');
mySelect.options[mySelect.options.length] = new Option("Kenosha schools",'all=Kenosha');
mySelect.options[mySelect.options.length] = new Option("La Crosse schools",'all=La_Crosse');
mySelect.options[mySelect.options.length] = new Option("Madison schools",'all=Madison');
mySelect.options[mySelect.options.length] = new Option("Manitowoc schools",'all=Manitowoc');
mySelect.options[mySelect.options.length] = new Option("Mequon schools",'all=Mequon');
mySelect.options[mySelect.options.length] = new Option("Milwaukee schools",'all=Milwaukee');
mySelect.options[mySelect.options.length] = new Option("Mount Horeb schools",'all=Mount_Horeb');
mySelect.options[mySelect.options.length] = new Option("Racine schools",'all=Racine');
mySelect.options[mySelect.options.length] = new Option("River Falls schools",'all=River_Falls');
mySelect.options[mySelect.options.length] = new Option("River Hills schools",'all=River_Hills');
mySelect.options[mySelect.options.length] = new Option("Sheboygan schools",'all=Sheboygan');
mySelect.options[mySelect.options.length] = new Option("Two Rivers schools",'all=Two_Rivers');
mySelect.options[mySelect.options.length] = new Option("Waukesha schools",'all=Waukesha');
mySelect.options[mySelect.options.length] = new Option("Wausau schools",'all=Wausau');
mySelect.options[mySelect.options.length] = new Option("West Bend schools",'all=West_Bend');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Manitowoc[Manitowoc.length] = createMarker(new GPoint(-87.65500800,44.11585700),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ashling Montessori School Inc",'Manitowoc=' + Manitowoc.length);
Mount_Horeb[Mount_Horeb.length] = createMarker(new GPoint(-89.74290100,43.00382000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Children's Community School",'Mount_Horeb=' + Mount_Horeb.length);
Two_Rivers[Two_Rivers.length] = createMarker(new GPoint(-87.60923800,44.12858100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Childrens House Of Manitowoc",'Two_Rivers=' + Two_Rivers.length);
De_Pere[De_Pere.length] = createMarker(new GPoint(-88.05660700,44.44848800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Creekside Christian Montessori",'De_Pere=' + De_Pere.length);
Milwaukee[Milwaukee.length] = createMarker(new GPoint(-87.98533000,43.07543700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Family Montessori School",'Milwaukee=' + Milwaukee.length);
Green_Bay[Green_Bay.length] = createMarker(new GPoint(-88.01015900,44.51279500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Green Bay Montessori",'Green_Bay=' + Green_Bay.length);
Green_Bay[Green_Bay.length] = createMarker(new GPoint(-88.01612400,44.50872000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Green Bay Montessori Children'",'Green_Bay=' + Green_Bay.length);
River_Falls[River_Falls.length] = createMarker(new GPoint(-92.60492000,44.83806000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Heartland Montessori School",'River_Falls=' + River_Falls.length);
Boscobel[Boscobel.length] = createMarker(new GPoint(-90.70050000,43.13853700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Holy Innocents Day Care Center Inc",'Boscobel=' + Boscobel.length);
Kenosha[Kenosha.length] = createMarker(new GPoint(-87.83809400,42.57086300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Kenosha Montessori School",'Kenosha=' + Kenosha.length);
Waukesha[Waukesha.length] = createMarker(new GPoint(-88.28058500,43.02051100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lake Country Montessori",'Waukesha=' + Waukesha.length);
Madison[Madison.length] = createMarker(new GPoint(-89.45052400,43.03534800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Madison Central Montessori",'Madison=' + Madison.length);
Green_Bay[Green_Bay.length] = createMarker(new GPoint(-88.01063500,44.49785100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Marian Montessori Center",'Green_Bay=' + Green_Bay.length);
Mequon[Mequon.length] = createMarker(new GPoint(-87.94168100,43.22140900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mequon Montessori School",'Mequon=' + Mequon.length);
Milwaukee[Milwaukee.length] = createMarker(new GPoint(-88.03136700,43.03373200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Milwaukee Montessori School",'Milwaukee=' + Milwaukee.length);
Appleton[Appleton.length] = createMarker(new GPoint(-88.40976000,44.29477800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Montessori Adventure Schools",'Appleton=' + Appleton.length);
West_Bend[West_Bend.length] = createMarker(new GPoint(-88.19771100,43.39941600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Montessori Children House West Bend",'West_Bend=' + West_Bend.length);
Madison[Madison.length] = createMarker(new GPoint(-89.47457700,43.04845900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Montessori Childrens House",'Madison=' + Madison.length);
Kenosha[Kenosha.length] = createMarker(new GPoint(-87.82177900,42.57966900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Montessori Childrens House",'Kenosha=' + Kenosha.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);
Wausau[Wausau.length] = createMarker(new GPoint(-89.63881600,44.95213700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Montessori Childrens Village",'Wausau=' + Wausau.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);
Wausau[Wausau.length] = createMarker(new GPoint(-89.65978700,44.95716300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Montessori School Of Wausau",'Wausau=' + Wausau.length);
River_Hills[River_Hills.length] = createMarker(new GPoint(-87.92304200,43.17668700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("New World Montessori School",'River_Hills=' + River_Hills.length);
Sheboygan[Sheboygan.length] = createMarker(new GPoint(-87.72104600,43.70203700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("New World Montessori School",'Sheboygan=' + Sheboygan.length);
Racine[Racine.length] = createMarker(new GPoint(-87.79112800,42.70106400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Racine Montessori School",'Racine=' + Racine.length);
Wausau[Wausau.length] = createMarker(new GPoint(-89.64863000,44.90984000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Rib Mountain Montessori",'Wausau=' + Wausau.length);
Janesville[Janesville.length] = createMarker(new GPoint(-88.94288900,42.72846300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Rock Prairie Montessori",'Janesville=' + Janesville.length);
La_Crosse[La_Crosse.length] = createMarker(new GPoint(-91.24644400,43.83896300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St. James Elementary School",'La_Crosse=' + La_Crosse.length);
Racine[Racine.length] = createMarker(new GPoint(-87.79207100,42.74243700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Small World Montessori",'Racine=' + Racine.length);
Madison[Madison.length] = createMarker(new GPoint(-89.38418700,43.05497400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Woodland Montessori School",'Madison=' + Madison.length);
map.removeOverlays(Appleton);
map.removeOverlays(Boscobel);
map.removeOverlays(De_Pere);
map.removeOverlays(Green_Bay);
map.removeOverlays(Janesville);
map.removeOverlays(Kenosha);
map.removeOverlays(La_Crosse);
map.removeOverlays(Madison);
map.removeOverlays(Manitowoc);
map.removeOverlays(Mequon);
map.removeOverlays(Milwaukee);
map.removeOverlays(Mount_Horeb);
map.removeOverlays(Racine);
map.removeOverlays(River_Falls);
map.removeOverlays(River_Hills);
map.removeOverlays(Sheboygan);
map.removeOverlays(Two_Rivers);
map.removeOverlays(Waukesha);
map.removeOverlays(Wausau);
map.removeOverlays(West_Bend);
setTimeout(function(){map.addOverlays(Appleton)},1000);
setTimeout(function(){map.addOverlays(Boscobel)},1000);
setTimeout(function(){map.addOverlays(De_Pere)},1000);
setTimeout(function(){map.addOverlays(Green_Bay)},1000);
setTimeout(function(){map.addOverlays(Janesville)},1000);
setTimeout(function(){map.addOverlays(Kenosha)},1000);
setTimeout(function(){map.addOverlays(La_Crosse)},1000);
setTimeout(function(){map.addOverlays(Madison)},1000);
setTimeout(function(){map.addOverlays(Manitowoc)},1000);
setTimeout(function(){map.addOverlays(Mequon)},1000);
setTimeout(function(){map.addOverlays(Milwaukee)},1000);
setTimeout(function(){map.addOverlays(Mount_Horeb)},1000);
setTimeout(function(){map.addOverlays(Racine)},1000);
setTimeout(function(){map.addOverlays(River_Falls)},1000);
setTimeout(function(){map.addOverlays(River_Hills)},1000);
setTimeout(function(){map.addOverlays(Sheboygan)},1000);
setTimeout(function(){map.addOverlays(Two_Rivers)},1000);
setTimeout(function(){map.addOverlays(Waukesha)},1000);
setTimeout(function(){map.addOverlays(Wausau)},1000);
setTimeout(function(){map.addOverlays(West_Bend)},1000);
maxLng = -87.60923800;
maxLat = 44.95716300;
minLng = -92.60492000;
minLat = 42.57086300;
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(Appleton);
map.removeOverlays(Boscobel);
map.removeOverlays(De_Pere);
map.removeOverlays(Green_Bay);
map.removeOverlays(Janesville);
map.removeOverlays(Kenosha);
map.removeOverlays(La_Crosse);
map.removeOverlays(Madison);
map.removeOverlays(Manitowoc);
map.removeOverlays(Mequon);
map.removeOverlays(Milwaukee);
map.removeOverlays(Mount_Horeb);
map.removeOverlays(Racine);
map.removeOverlays(River_Falls);
map.removeOverlays(River_Hills);
map.removeOverlays(Sheboygan);
map.removeOverlays(Two_Rivers);
map.removeOverlays(Waukesha);
map.removeOverlays(Wausau);
map.removeOverlays(West_Bend);
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(Manitowoc);map.removeOverlays(Appleton);
map.removeOverlays(Boscobel);
map.removeOverlays(De_Pere);
map.removeOverlays(Green_Bay);
map.removeOverlays(Janesville);
map.removeOverlays(Kenosha);
map.removeOverlays(La_Crosse);
map.removeOverlays(Madison);
map.removeOverlays(Manitowoc);
map.removeOverlays(Mequon);
map.removeOverlays(Milwaukee);
map.removeOverlays(Mount_Horeb);
map.removeOverlays(Racine);
map.removeOverlays(River_Falls);
map.removeOverlays(River_Hills);
map.removeOverlays(Sheboygan);
map.removeOverlays(Two_Rivers);
map.removeOverlays(Waukesha);
map.removeOverlays(Wausau);
map.removeOverlays(West_Bend);
map.addOverlays(Appleton);
centerByArray(Appleton, false, false);
cntMarker += Appleton.length;
map.addOverlays(Boscobel);
centerByArray(Boscobel, false, false);
cntMarker += Boscobel.length;
map.addOverlays(De_Pere);
centerByArray(De_Pere, false, false);
cntMarker += De_Pere.length;
map.addOverlays(Green_Bay);
centerByArray(Green_Bay, false, false);
cntMarker += Green_Bay.length;
map.addOverlays(Janesville);
centerByArray(Janesville, false, false);
cntMarker += Janesville.length;
map.addOverlays(Kenosha);
centerByArray(Kenosha, false, false);
cntMarker += Kenosha.length;
map.addOverlays(La_Crosse);
centerByArray(La_Crosse, false, false);
cntMarker += La_Crosse.length;
map.addOverlays(Madison);
centerByArray(Madison, false, false);
cntMarker += Madison.length;
map.addOverlays(Manitowoc);
centerByArray(Manitowoc, false, false);
cntMarker += Manitowoc.length;
map.addOverlays(Mequon);
centerByArray(Mequon, false, false);
cntMarker += Mequon.length;
map.addOverlays(Milwaukee);
centerByArray(Milwaukee, false, false);
cntMarker += Milwaukee.length;
map.addOverlays(Mount_Horeb);
centerByArray(Mount_Horeb, false, false);
cntMarker += Mount_Horeb.length;
map.addOverlays(Racine);
centerByArray(Racine, false, false);
cntMarker += Racine.length;
map.addOverlays(River_Falls);
centerByArray(River_Falls, false, false);
cntMarker += River_Falls.length;
map.addOverlays(River_Hills);
centerByArray(River_Hills, false, false);
cntMarker += River_Hills.length;
map.addOverlays(Sheboygan);
centerByArray(Sheboygan, false, false);
cntMarker += Sheboygan.length;
map.addOverlays(Two_Rivers);
centerByArray(Two_Rivers, false, false);
cntMarker += Two_Rivers.length;
map.addOverlays(Waukesha);
centerByArray(Waukesha, false, false);
cntMarker += Waukesha.length;
map.addOverlays(Wausau);
centerByArray(Wausau, false, false);
cntMarker += Wausau.length;
map.addOverlays(West_Bend);
centerByArray(West_Bend, false, false);
cntMarker += West_Bend.length;
centerByArray(Manitowoc,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///29709,29612,29491,34640,29568,30332,30337,29650,29712,29965,29677,29713,30306,29398,30333,29542,29706,34639,32004,29881,29584,29741,35535,30334,29457,32000,29716,29714,29715,30336,29710,/all');
//window.open('/map.php?type=2&schools=29709,29612,29491,34640,29568,30332,30337,29650,29712,29965,29677,29713,30306,29398,30333,29542,29706,34639,32004,29881,29584,29741,35535,30334,29457,32000,29716,29714,29715,30336,29710,&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;
}