function addMarkers(){ mySelect = document.getElementById('selection'); Wauwatosa = [];Dousman = [];Milwaukee = [];Edgerton = [];Delafield = [];Mount_Calvary = [];New_London = [];Amberg = [];Neillsville = [];mySelect.options[mySelect.options.length] = new Option("Amberg schools",'all=Amberg'); mySelect.options[mySelect.options.length] = new Option("Delafield schools",'all=Delafield'); mySelect.options[mySelect.options.length] = new Option("Dousman schools",'all=Dousman'); mySelect.options[mySelect.options.length] = new Option("Edgerton schools",'all=Edgerton'); mySelect.options[mySelect.options.length] = new Option("Milwaukee schools",'all=Milwaukee'); mySelect.options[mySelect.options.length] = new Option("Mount Calvary schools",'all=Mount_Calvary'); mySelect.options[mySelect.options.length] = new Option("Neillsville schools",'all=Neillsville'); mySelect.options[mySelect.options.length] = new Option("New London schools",'all=New_London'); mySelect.options[mySelect.options.length] = new Option("Wauwatosa schools",'all=Wauwatosa'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Wauwatosa[Wauwatosa.length] = createMarker(new GPoint(-88.01101100,43.04637000),"
Carmelite Home For Boys - School
1214 Kavanaugh Place
Wauwatosa, WI 53213
All-boys school, 6-10
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Carmelite Home For Boys - School",'Wauwatosa=' + Wauwatosa.length); Dousman[Dousman.length] = createMarker(new GPoint(-88.46320000,42.98010000),"
Lakewood School
Po Box 158
Dousman, WI 53118
All-boys school, 6-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Lakewood School",'Dousman=' + Dousman.length); Milwaukee[Milwaukee.length] = createMarker(new GPoint(-87.95631000,43.03860200),"
Marquette University High School
3401 W Wisconsin Ave
Milwaukee, WI 53208
All-boys school, 9-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Marquette University High School",'Milwaukee=' + Milwaukee.length); Milwaukee[Milwaukee.length] = createMarker(new GPoint(-87.95047000,43.01555700),"
Nativity Jesuit Middle School
1515 S. 29th St.
Milwaukee, WI 53215
All-boys school, 5-8
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Nativity Jesuit Middle School",'Milwaukee=' + Milwaukee.length); Edgerton[Edgerton.length] = createMarker(new GPoint(-89.02309000,42.86986900),"
Oaklawn Academy
432 Liguori Road
Edgerton, WI 53534
All-boys school, 6-8
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Oaklawn Academy",'Edgerton=' + Edgerton.length); Milwaukee[Milwaukee.length] = createMarker(new GPoint(-88.02408800,43.08946300),"
St. Aemilian-lakeside, Inc
8901 W. Capitol Drive
Milwaukee, WI 53222
All-boys school, 1-11
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("St. Aemilian-lakeside, Inc",'Milwaukee=' + Milwaukee.length); Delafield[Delafield.length] = createMarker(new GPoint(-88.40415900,43.06427600),"
St. John's Northwestern Military Academy
1101 Genesee Street
Delafield, WI 53018
All-boys school, 7-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("St. John's Northwestern Military Academy",'Delafield=' + Delafield.length); Mount_Calvary[Mount_Calvary.length] = createMarker(new GPoint(-88.25046400,43.82317200),"
St. Lawrence Seminary High School
301 Church Street
Mount Calvary, WI 53057
All-boys school, 9-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("St. Lawrence Seminary High School",'Mount_Calvary=' + Mount_Calvary.length); New_London[New_London.length] = createMarker(new GPoint(-88.84828400,44.31190000),"
Starr Academy
E7475 Rawhide Road
New London, WI 54961
All-boys school, 7-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Starr Academy",'New_London=' + New_London.length); Amberg[Amberg.length] = createMarker(new GPoint(-87.82612300,45.52879700),"
Victory Homes For Boys
W4705 Wallace Rd
Amberg, WI 54102
All-boys school, 6-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Victory Homes For Boys",'Amberg=' + Amberg.length); Neillsville[Neillsville.length] = createMarker(new GPoint(-90.61892300,44.55598000),"
Visions Ii
16 Boon Blvd
Neillsville, WI 54456
All-boys school, 4-11
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Visions Ii",'Neillsville=' + Neillsville.length); Milwaukee[Milwaukee.length] = createMarker(new GPoint(-87.87206000,43.07728700),"
Wisconsin Institute For Torah Study
3288 North Lake Drive
Milwaukee, WI 53211
All-boys school, 9-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Wisconsin Institute For Torah Study",'Milwaukee=' + Milwaukee.length); map.removeOverlays(Amberg); map.removeOverlays(Delafield); map.removeOverlays(Dousman); map.removeOverlays(Edgerton); map.removeOverlays(Milwaukee); map.removeOverlays(Mount_Calvary); map.removeOverlays(Neillsville); map.removeOverlays(New_London); map.removeOverlays(Wauwatosa); setTimeout(function(){map.addOverlays(Amberg)},1000); setTimeout(function(){map.addOverlays(Delafield)},1000); setTimeout(function(){map.addOverlays(Dousman)},1000); setTimeout(function(){map.addOverlays(Edgerton)},1000); setTimeout(function(){map.addOverlays(Milwaukee)},1000); setTimeout(function(){map.addOverlays(Mount_Calvary)},1000); setTimeout(function(){map.addOverlays(Neillsville)},1000); setTimeout(function(){map.addOverlays(New_London)},1000); setTimeout(function(){map.addOverlays(Wauwatosa)},1000); maxLng = -87.82612300; maxLat = 45.52879700; minLng = -90.61892300; minLat = 42.86986900; 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(Amberg); map.removeOverlays(Delafield); map.removeOverlays(Dousman); map.removeOverlays(Edgerton); map.removeOverlays(Milwaukee); map.removeOverlays(Mount_Calvary); map.removeOverlays(Neillsville); map.removeOverlays(New_London); map.removeOverlays(Wauwatosa); 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(Wauwatosa);map.removeOverlays(Amberg); map.removeOverlays(Delafield); map.removeOverlays(Dousman); map.removeOverlays(Edgerton); map.removeOverlays(Milwaukee); map.removeOverlays(Mount_Calvary); map.removeOverlays(Neillsville); map.removeOverlays(New_London); map.removeOverlays(Wauwatosa); map.addOverlays(Amberg); centerByArray(Amberg, false, false); cntMarker += Amberg.length; map.addOverlays(Delafield); centerByArray(Delafield, false, false); cntMarker += Delafield.length; map.addOverlays(Dousman); centerByArray(Dousman, false, false); cntMarker += Dousman.length; map.addOverlays(Edgerton); centerByArray(Edgerton, false, false); cntMarker += Edgerton.length; map.addOverlays(Milwaukee); centerByArray(Milwaukee, false, false); cntMarker += Milwaukee.length; map.addOverlays(Mount_Calvary); centerByArray(Mount_Calvary, false, false); cntMarker += Mount_Calvary.length; map.addOverlays(Neillsville); centerByArray(Neillsville, false, false); cntMarker += Neillsville.length; map.addOverlays(New_London); centerByArray(New_London, false, false); cntMarker += New_London.length; map.addOverlays(Wauwatosa); centerByArray(Wauwatosa, false, false); cntMarker += Wauwatosa.length; centerByArray(Wauwatosa,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///30283,30005,29659,29685,29734,29894,30301,30045,33047,30225,29447,30283,29659,29758,29734,29894,33047,29447,/all'); //window.open('/map.php?type=2&schools=30283,30005,29659,29685,29734,29894,30301,30045,33047,30225,29447,30283,29659,29758,29734,29894,33047,29447,&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; }