function addMarkers() { mySelect = document.getElementById('selection'); Greencastle = [];Bainbridge = [];Cloverdale = [];Fillmore = [];Roachdale = [];Reelsville = [];mySelect.options[mySelect.options.length] = new Option("Bainbridge schools",'all=Bainbridge'); mySelect.options[mySelect.options.length] = new Option("Cloverdale schools",'all=Cloverdale'); mySelect.options[mySelect.options.length] = new Option("Fillmore schools",'all=Fillmore'); mySelect.options[mySelect.options.length] = new Option("Greencastle schools",'all=Greencastle'); mySelect.options[mySelect.options.length] = new Option("Reelsville schools",'all=Reelsville'); mySelect.options[mySelect.options.length] = new Option("Roachdale schools",'all=Roachdale'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Greencastle[Greencastle.length] = createMarker(new GPoint(-86.83640289,39.64630127),"
Area 30 Career Center
1 N Calbert Way Suite A
Greencastle, IN 46135

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Area 30 Career Center",'Greencastle=' + Greencastle.length); Bainbridge[Bainbridge.length] = createMarker(new GPoint(-86.77729797,39.74570084),"
Bainbridge Elementary School
Po Box 239-412 S Washington
Bainbridge, IN 46105

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bainbridge Elementary School",'Bainbridge=' + Bainbridge.length); Greencastle[Greencastle.length] = createMarker(new GPoint(-86.81381989,39.58647537),"
Central Elementary School
1888 E Us Hwy 40
Greencastle, IN 46135

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Central Elementary School",'Greencastle=' + Greencastle.length); Cloverdale[Cloverdale.length] = createMarker(new GPoint(-86.79072571,39.51042175),"
Cloverdale Elementary School
311 E Logan
Cloverdale, IN 46120

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Cloverdale Elementary School",'Cloverdale=' + Cloverdale.length); Cloverdale[Cloverdale.length] = createMarker(new GPoint(-86.79270172,39.51146317),"
Cloverdale High School
205 E Market
Cloverdale, IN 46120

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cloverdale High School",'Cloverdale=' + Cloverdale.length); Cloverdale[Cloverdale.length] = createMarker(new GPoint(-86.79078674,39.51069260),"
Cloverdale Middle School
312 E Logan St
Cloverdale, IN 46120

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Cloverdale Middle School",'Cloverdale=' + Cloverdale.length); Greencastle[Greencastle.length] = createMarker(new GPoint(-86.86663055,39.64633560),"
Deer Meadow Primary School
1000 Deer Meadow Ln
Greencastle, IN 46135

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Deer Meadow Primary School",'Greencastle=' + Greencastle.length); Fillmore[Fillmore.length] = createMarker(new GPoint(-86.73680115,39.65629959),"
Fillmore Elementary School
161 S Main St
Fillmore, IN 46128

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Fillmore Elementary School",'Fillmore=' + Fillmore.length); Greencastle[Greencastle.length] = createMarker(new GPoint(-86.84100342,39.64339828),"
Greencastle Middle School
400 Percy L Julian Dr
Greencastle, IN 46135

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Greencastle Middle School",'Greencastle=' + Greencastle.length); Greencastle[Greencastle.length] = createMarker(new GPoint(-86.84528351,39.64386368),"
Greencastle Senior High School
910 E Washington
Greencastle, IN 46135

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Greencastle Senior High School",'Greencastle=' + Greencastle.length); Greencastle[Greencastle.length] = createMarker(new GPoint(-86.85966492,39.63613510),"
Martha J Ridpath Elementary School
405 Howard St
Greencastle, IN 46135

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Martha J Ridpath Elementary School",'Greencastle=' + Greencastle.length); Roachdale[Roachdale.length] = createMarker(new GPoint(-86.80100250,39.84938812),"
North Putnam Middle School
8905 N Cr 250 E
Roachdale, IN 46172

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("North Putnam Middle School",'Roachdale=' + Roachdale.length); Roachdale[Roachdale.length] = createMarker(new GPoint(-86.80100250,39.84938812),"
North Putnam Senior High School
8869 N Cr 250 E
Roachdale, IN 46172

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("North Putnam Senior High School",'Roachdale=' + Roachdale.length); Greencastle[Greencastle.length] = createMarker(new GPoint(-86.83640289,39.64630127),"
Old Natl Trail Spec Srvs Coop
522 Anderson St Box 267
Greencastle, IN 46135

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Old Natl Trail Spec Srvs Coop",'Greencastle=' + Greencastle.length); Reelsville[Reelsville.length] = createMarker(new GPoint(-86.96648407,39.55730820),"
Reelsville Elementary School
7840 S Cr 625 W
Reelsville, IN 46171

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Reelsville Elementary School",'Reelsville=' + Reelsville.length); Roachdale[Roachdale.length] = createMarker(new GPoint(-86.80339813,39.83380127),"
Roachdale Elementary School
Box 309-305 S Indiana
Roachdale, IN 46172

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Roachdale Elementary School",'Roachdale=' + Roachdale.length); Greencastle[Greencastle.length] = createMarker(new GPoint(-86.86354065,39.64468002),"
South Putnam High School
1780 E Us Hwy 231
Greencastle, IN 46135

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("South Putnam High School",'Greencastle=' + Greencastle.length); Greencastle[Greencastle.length] = createMarker(new GPoint(-86.85603333,39.65088272),"
Tzouanakis Intermediate School
500 Linwood Dr
Greencastle, IN 46135

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Tzouanakis Intermediate School",'Greencastle=' + Greencastle.length); } // 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(Bainbridge); map.removeOverlays(Cloverdale); map.removeOverlays(Fillmore); map.removeOverlays(Greencastle); map.removeOverlays(Reelsville); map.removeOverlays(Roachdale); 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(Greencastle);map.removeOverlays(Bainbridge); map.removeOverlays(Cloverdale); map.removeOverlays(Fillmore); map.removeOverlays(Greencastle); map.removeOverlays(Reelsville); map.removeOverlays(Roachdale); map.addOverlays(Bainbridge); centerByArray(Bainbridge, false, false); cntMarker += Bainbridge.length; map.addOverlays(Cloverdale); centerByArray(Cloverdale, false, false); cntMarker += Cloverdale.length; map.addOverlays(Fillmore); centerByArray(Fillmore, false, false); cntMarker += Fillmore.length; map.addOverlays(Greencastle); centerByArray(Greencastle, false, false); cntMarker += Greencastle.length; map.addOverlays(Reelsville); centerByArray(Reelsville, false, false); cntMarker += Reelsville.length; map.addOverlays(Roachdale); centerByArray(Roachdale, false, false); cntMarker += Roachdale.length; centerByArray(Greencastle,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'); } }