function addMarkers(){ mySelect = document.getElementById('selection'); Fort_Wayne = [];Lafayette = [];Bicknell = [];Indianapolis = [];Granger = [];South_Bend = [];Jasper = [];Kokomo = [];Gary = [];Richmond = [];Oolitic = [];Seymour = [];Sheridan = [];Springville = [];mySelect.options[mySelect.options.length] = new Option("Bicknell schools",'all=Bicknell'); mySelect.options[mySelect.options.length] = new Option("Fort Wayne schools",'all=Fort_Wayne'); mySelect.options[mySelect.options.length] = new Option("Gary schools",'all=Gary'); mySelect.options[mySelect.options.length] = new Option("Granger schools",'all=Granger'); mySelect.options[mySelect.options.length] = new Option("Indianapolis schools",'all=Indianapolis'); mySelect.options[mySelect.options.length] = new Option("Jasper schools",'all=Jasper'); mySelect.options[mySelect.options.length] = new Option("Kokomo schools",'all=Kokomo'); mySelect.options[mySelect.options.length] = new Option("Lafayette schools",'all=Lafayette'); mySelect.options[mySelect.options.length] = new Option("Oolitic schools",'all=Oolitic'); mySelect.options[mySelect.options.length] = new Option("Richmond schools",'all=Richmond'); mySelect.options[mySelect.options.length] = new Option("Seymour schools",'all=Seymour'); mySelect.options[mySelect.options.length] = new Option("Sheridan schools",'all=Sheridan'); mySelect.options[mySelect.options.length] = new Option("South Bend schools",'all=South_Bend'); mySelect.options[mySelect.options.length] = new Option("Springville schools",'all=Springville'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Fort_Wayne[Fort_Wayne.length] = createMarker(new GPoint(-85.09708500,41.10902300),"
Abundant Life Christian Academy
3301 E. Coliseum Blvd.
Fort Wayne, IN 46805
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Abundant Life Christian Academy",'Fort_Wayne=' + Fort_Wayne.length); Lafayette[Lafayette.length] = createMarker(new GPoint(-86.89623600,40.40351300),"
Apostolic Christian Academy
100 Murphy Street
Lafayette, IN 47905
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Apostolic Christian Academy",'Lafayette=' + Lafayette.length); Bicknell[Bicknell.length] = createMarker(new GPoint(-87.27594400,38.78921000),"
Bicknell Apostolic Academy
Highway 67 N
Bicknell, IN 47512
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bicknell Apostolic Academy",'Bicknell=' + Bicknell.length); Indianapolis[Indianapolis.length] = createMarker(new GPoint(-86.12039500,39.71303200),"
Calvary Christian School
3639 South Keystone Avenue
Indianapolis, IN 46227
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Calvary Christian School",'Indianapolis=' + Indianapolis.length); Granger[Granger.length] = createMarker(new GPoint(-86.16319700,41.71651300),"
Calvary Christian School
53494 Fir Road
Granger, IN 46530
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Calvary Christian School",'Granger=' + Granger.length); South_Bend[South_Bend.length] = createMarker(new GPoint(-86.21578300,41.62776100),"
Ironwood Christian School
4609 South Ironwood Road
South Bend, IN 46614
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ironwood Christian School",'South_Bend=' + South_Bend.length); Jasper[Jasper.length] = createMarker(new GPoint(-86.92633700,38.38631500),"
Jasper Christian Academy
231 Hillside Drive
Jasper, IN 47546
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Jasper Christian Academy",'Jasper=' + Jasper.length); Kokomo[Kokomo.length] = createMarker(new GPoint(-86.10291900,40.49161200),"
Lighthouse Christian School
616 Tooby Pike
Kokomo, IN 46901
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Lighthouse Christian School",'Kokomo=' + Kokomo.length); Gary[Gary.length] = createMarker(new GPoint(-87.36346800,41.60203700),"
M C Bennett Holiness School
2134 W 5th Avenue
Gary, IN 46404
Co-ed school, -
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("M C Bennett Holiness School",'Gary=' + Gary.length); Richmond[Richmond.length] = createMarker(new GPoint(-84.82090500,39.83331100),"
New Creations Christian School
6412 National Road E
Richmond, IN 47374
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Creations Christian School",'Richmond=' + Richmond.length); Richmond[Richmond.length] = createMarker(new GPoint(-84.88887800,39.85843700),"
Oak Park Academy
1920 Chester Blvd
Richmond, IN 47374
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oak Park Academy",'Richmond=' + Richmond.length); Oolitic[Oolitic.length] = createMarker(new GPoint(-86.52550700,38.90021900),"
Odlitic Christian School
227 Lafayette Avenue
Oolitic, IN 47451
Co-ed school, K-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Odlitic Christian School",'Oolitic=' + Oolitic.length); Seymour[Seymour.length] = createMarker(new GPoint(-85.88993000,38.96037400),"
Seymour Christian Academy
301 Indianapolis Avenue Box 863
Seymour, IN 47274
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Seymour Christian Academy",'Seymour=' + Seymour.length); Sheridan[Sheridan.length] = createMarker(new GPoint(-86.22290000,40.13630000),"
Sheridan Christian Academy
1478 W State Road 38
Sheridan, IN 46069
Co-ed school, PK-11
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sheridan Christian Academy",'Sheridan=' + Sheridan.length); Springville[Springville.length] = createMarker(new GPoint(-86.60890000,38.95280000),"
Springville Christian School
Po Box 78
Springville, IN 47462
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Springville Christian School",'Springville=' + Springville.length); Indianapolis[Indianapolis.length] = createMarker(new GPoint(-86.11384300,39.93086300),"
Tabernacle Christian Academy
2599 E 98th Street
Indianapolis, IN 46280
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tabernacle Christian Academy",'Indianapolis=' + Indianapolis.length); map.removeOverlays(Bicknell); map.removeOverlays(Fort_Wayne); map.removeOverlays(Gary); map.removeOverlays(Granger); map.removeOverlays(Indianapolis); map.removeOverlays(Jasper); map.removeOverlays(Kokomo); map.removeOverlays(Lafayette); map.removeOverlays(Oolitic); map.removeOverlays(Richmond); map.removeOverlays(Seymour); map.removeOverlays(Sheridan); map.removeOverlays(South_Bend); map.removeOverlays(Springville); setTimeout(function(){map.addOverlays(Bicknell)},1000); setTimeout(function(){map.addOverlays(Fort_Wayne)},1000); setTimeout(function(){map.addOverlays(Gary)},1000); setTimeout(function(){map.addOverlays(Granger)},1000); setTimeout(function(){map.addOverlays(Indianapolis)},1000); setTimeout(function(){map.addOverlays(Jasper)},1000); setTimeout(function(){map.addOverlays(Kokomo)},1000); setTimeout(function(){map.addOverlays(Lafayette)},1000); setTimeout(function(){map.addOverlays(Oolitic)},1000); setTimeout(function(){map.addOverlays(Richmond)},1000); setTimeout(function(){map.addOverlays(Seymour)},1000); setTimeout(function(){map.addOverlays(Sheridan)},1000); setTimeout(function(){map.addOverlays(South_Bend)},1000); setTimeout(function(){map.addOverlays(Springville)},1000); maxLng = -84.82090500; maxLat = 41.71651300; minLng = -87.36346800; minLat = 38.38631500; 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(Bicknell); map.removeOverlays(Fort_Wayne); map.removeOverlays(Gary); map.removeOverlays(Granger); map.removeOverlays(Indianapolis); map.removeOverlays(Jasper); map.removeOverlays(Kokomo); map.removeOverlays(Lafayette); map.removeOverlays(Oolitic); map.removeOverlays(Richmond); map.removeOverlays(Seymour); map.removeOverlays(Sheridan); map.removeOverlays(South_Bend); map.removeOverlays(Springville); 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(Fort_Wayne);map.removeOverlays(Bicknell); map.removeOverlays(Fort_Wayne); map.removeOverlays(Gary); map.removeOverlays(Granger); map.removeOverlays(Indianapolis); map.removeOverlays(Jasper); map.removeOverlays(Kokomo); map.removeOverlays(Lafayette); map.removeOverlays(Oolitic); map.removeOverlays(Richmond); map.removeOverlays(Seymour); map.removeOverlays(Sheridan); map.removeOverlays(South_Bend); map.removeOverlays(Springville); map.addOverlays(Bicknell); centerByArray(Bicknell, false, false); cntMarker += Bicknell.length; map.addOverlays(Fort_Wayne); centerByArray(Fort_Wayne, false, false); cntMarker += Fort_Wayne.length; map.addOverlays(Gary); centerByArray(Gary, false, false); cntMarker += Gary.length; map.addOverlays(Granger); centerByArray(Granger, false, false); cntMarker += Granger.length; map.addOverlays(Indianapolis); centerByArray(Indianapolis, false, false); cntMarker += Indianapolis.length; map.addOverlays(Jasper); centerByArray(Jasper, false, false); cntMarker += Jasper.length; map.addOverlays(Kokomo); centerByArray(Kokomo, false, false); cntMarker += Kokomo.length; map.addOverlays(Lafayette); centerByArray(Lafayette, false, false); cntMarker += Lafayette.length; map.addOverlays(Oolitic); centerByArray(Oolitic, false, false); cntMarker += Oolitic.length; map.addOverlays(Richmond); centerByArray(Richmond, false, false); cntMarker += Richmond.length; map.addOverlays(Seymour); centerByArray(Seymour, false, false); cntMarker += Seymour.length; map.addOverlays(Sheridan); centerByArray(Sheridan, false, false); cntMarker += Sheridan.length; map.addOverlays(South_Bend); centerByArray(South_Bend, false, false); cntMarker += South_Bend.length; map.addOverlays(Springville); centerByArray(Springville, false, false); cntMarker += Springville.length; centerByArray(Fort_Wayne,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///34341,32398,34342,9923,10140,31282,31294,10189,9987,10281,10286,10107,10307,34341,32398,10147,34342,9923,10465,10110,10140,31294,10189,9987,10281,10286,10107,10307,/all'); //window.open('/map.php?type=2&schools=34341,32398,34342,9923,10140,31282,31294,10189,9987,10281,10286,10107,10307,34341,32398,10147,34342,9923,10465,10110,10140,31294,10189,9987,10281,10286,10107,10307,&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; }