function addMarkers() { mySelect = document.getElementById('selection'); Lima = [];Lafayette = [];Harrod = [];Bluffton = [];Elida = [];Delphos = [];Gomer = [];Spencerville = [];mySelect.options[mySelect.options.length] = new Option("Bluffton schools",'all=Bluffton'); mySelect.options[mySelect.options.length] = new Option("Delphos schools",'all=Delphos'); mySelect.options[mySelect.options.length] = new Option("Elida schools",'all=Elida'); mySelect.options[mySelect.options.length] = new Option("Gomer schools",'all=Gomer'); mySelect.options[mySelect.options.length] = new Option("Harrod schools",'all=Harrod'); mySelect.options[mySelect.options.length] = new Option("Lafayette schools",'all=Lafayette'); mySelect.options[mySelect.options.length] = new Option("Lima schools",'all=Lima'); mySelect.options[mySelect.options.length] = new Option("Spencerville schools",'all=Spencerville'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Lima[Lima.length] = createMarker(new GPoint(-84.10674900,40.73691400),"
",iconGr); mySelect.options[mySelect.options.length] = new Option("Allen County Schools Alternative Program",'Lima=' + Lima.length); Lafayette[Lafayette.length] = createMarker(new GPoint(-84.11219788,40.74166107),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Allen East High School",'Lafayette=' + Lafayette.length); Harrod[Harrod.length] = createMarker(new GPoint(-83.92523956,40.70626450),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Allen East Middle School",'Harrod=' + Harrod.length); Lima[Lima.length] = createMarker(new GPoint(-84.11219788,40.74166107),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Allen East Primary Elementary School",'Lima=' + Lima.length); Lima[Lima.length] = createMarker(new GPoint(-84.15111542,40.69287109),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Apollo Career Center",'Lima=' + Lima.length); Lima[Lima.length] = createMarker(new GPoint(-84.15111542,40.69287109),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Apollo Practical Nursing",'Lima=' + Lima.length); Lima[Lima.length] = createMarker(new GPoint(-84.08934300,40.72945100),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Auglaize County Educational Academy",'Lima=' + Lima.length); Lima[Lima.length] = createMarker(new GPoint(-84.08934300,40.72945100),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Auglaize County Special Needs School",'Lima=' + Lima.length); Lima[Lima.length] = createMarker(new GPoint(-84.05138397,40.77528381),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Bath Elementary School",'Lima=' + Lima.length); Lima[Lima.length] = createMarker(new GPoint(-84.05698395,40.77436447),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Bath High School",'Lima=' + Lima.length); Lima[Lima.length] = createMarker(new GPoint(-84.06562042,40.77436447),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Bath Middle School",'Lima=' + Lima.length); Bluffton[Bluffton.length] = createMarker(new GPoint(-83.89315033,40.89421082),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Bluffton Elementary School",'Bluffton=' + Bluffton.length); Bluffton[Bluffton.length] = createMarker(new GPoint(-83.89355469,40.89233398),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Bluffton High School",'Bluffton=' + Bluffton.length); Bluffton[Bluffton.length] = createMarker(new GPoint(-83.89315796,40.89421082),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Bluffton Middle School",'Bluffton=' + Bluffton.length); Lima[Lima.length] = createMarker(new GPoint(-84.18376923,40.78754044),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Elida Digital Academy",'Lima=' + Lima.length); Elida[Elida.length] = createMarker(new GPoint(-84.18911743,40.78524017),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Elida Elementary School",'Elida=' + Elida.length); Elida[Elida.length] = createMarker(new GPoint(-84.20349884,40.78973770),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Elida High School",'Elida=' + Elida.length); Elida[Elida.length] = createMarker(new GPoint(-84.18675232,40.78763580),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Elida Middle School",'Elida=' + Elida.length); Lima[Lima.length] = createMarker(new GPoint(-84.15081787,40.67550659),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Elmwood Elementary School",'Lima=' + Lima.length); Lima[Lima.length] = createMarker(new GPoint(-84.09654236,40.75450134),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Emerson Elementary School",'Lima=' + Lima.length); Lima[Lima.length] = createMarker(new GPoint(-84.11089325,40.73738098),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Faurot Elementary School",'Lima=' + Lima.length); Delphos[Delphos.length] = createMarker(new GPoint(-84.33549500,40.84599304),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Franklin Elementary School",'Delphos=' + Delphos.length); Lima[Lima.length] = createMarker(new GPoint(-84.09134674,40.73241043),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Freedom Elementary School",'Lima=' + Lima.length); Gomer[Gomer.length] = createMarker(new GPoint(-84.18164825,40.84389877),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Gomer Elementary School",'Gomer=' + Gomer.length); Lima[Lima.length] = createMarker(new GPoint(-84.11331700,40.74273900),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Heir Force Community School",'Lima=' + Lima.length); Lima[Lima.length] = createMarker(new GPoint(-84.12641907,40.74845505),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Heritage Elementary School",'Lima=' + Lima.length); Lima[Lima.length] = createMarker(new GPoint(-84.12572479,40.74716949),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Horace Mann Elementary School",'Lima=' + Lima.length); Lima[Lima.length] = createMarker(new GPoint(-84.11362200,40.75405800),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Independence Elementary School",'Lima=' + Lima.length); Lima[Lima.length] = createMarker(new GPoint(-84.11344147,40.75322723),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Irving Elementary School",'Lima=' + Lima.length); Delphos[Delphos.length] = createMarker(new GPoint(-84.35399628,40.85070038),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Jefferson High School",'Delphos=' + Delphos.length); Delphos[Delphos.length] = createMarker(new GPoint(-84.38689423,40.80115509),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Landeck Elementary School",'Delphos=' + Delphos.length); Lima[Lima.length] = createMarker(new GPoint(-84.10937500,40.73008900),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Liberty Elementary School",'Lima=' + Lima.length); Lima[Lima.length] = createMarker(new GPoint(-84.10792542,40.73453140),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Lima Alternative High School",'Lima=' + Lima.length); Lima[Lima.length] = createMarker(new GPoint(-79.09586334,36.07536316),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Lima Alternative Special Need High School",'Lima=' + Lima.length); Lima[Lima.length] = createMarker(new GPoint(-84.09111786,40.73456955),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Lima Digital Academy",'Lima=' + Lima.length); Lima[Lima.length] = createMarker(new GPoint(-84.10792542,40.73453140),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Lima High School",'Lima=' + Lima.length); Lima[Lima.length] = createMarker(new GPoint(-84.10855103,40.75791168),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Lima North Middle School",'Lima=' + Lima.length); Lima[Lima.length] = createMarker(new GPoint(-84.09133911,40.73075485),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Lima South Middle School",'Lima=' + Lima.length); Lima[Lima.length] = createMarker(new GPoint(-84.14693451,40.74595261),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Lima West Middle School",'Lima=' + Lima.length); Lima[Lima.length] = createMarker(new GPoint(-84.12458038,40.73868179),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Lowell Elementary School",'Lima=' + Lima.length); Lima[Lima.length] = createMarker(new GPoint(-84.18518066,40.71036148),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Maplewood Elementary School",'Lima=' + Lima.length); Lima[Lima.length] = createMarker(new GPoint(-84.05396271,40.68756485),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Perry Elementary School",'Lima=' + Lima.length); Lima[Lima.length] = createMarker(new GPoint(-84.05396271,40.68756485),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Perry High School",'Lima=' + Lima.length); Lima[Lima.length] = createMarker(new GPoint(-84.10372162,40.71166229),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Quest Academy Community",'Lima=' + Lima.length); Lima[Lima.length] = createMarker(new GPoint(-84.16537476,40.69346237),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Shawnee High School",'Lima=' + Lima.length); Lima[Lima.length] = createMarker(new GPoint(-84.16375732,40.69346237),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Shawnee Middle School",'Lima=' + Lima.length); Spencerville[Spencerville.length] = createMarker(new GPoint(-84.34848022,40.70721054),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Spencerville Elementary School",'Spencerville=' + Spencerville.length); Spencerville[Spencerville.length] = createMarker(new GPoint(-84.34460449,40.70527267),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Spencerville High School",'Spencerville=' + Spencerville.length); Spencerville[Spencerville.length] = createMarker(new GPoint(-84.34848022,40.70721054),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Spencerville Middle School",'Spencerville=' + Spencerville.length); Lima[Lima.length] = createMarker(new GPoint(-84.09191132,40.71880341),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Unity Elementary School",'Lima=' + Lima.length); Lima[Lima.length] = createMarker(new GPoint(-84.14693451,40.74591827),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Westwood Elementary School",'Lima=' + Lima.length); Lima[Lima.length] = createMarker(new GPoint(-84.10087585,40.72072983),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Whittier Elementary School",'Lima=' + Lima.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(Bluffton); map.removeOverlays(Delphos); map.removeOverlays(Elida); map.removeOverlays(Gomer); map.removeOverlays(Harrod); map.removeOverlays(Lafayette); map.removeOverlays(Lima); map.removeOverlays(Spencerville); 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(Lima);map.removeOverlays(Bluffton); map.removeOverlays(Delphos); map.removeOverlays(Elida); map.removeOverlays(Gomer); map.removeOverlays(Harrod); map.removeOverlays(Lafayette); map.removeOverlays(Lima); map.removeOverlays(Spencerville); map.addOverlays(Bluffton); centerByArray(Bluffton, false, false); cntMarker += Bluffton.length; map.addOverlays(Delphos); centerByArray(Delphos, false, false); cntMarker += Delphos.length; map.addOverlays(Elida); centerByArray(Elida, false, false); cntMarker += Elida.length; map.addOverlays(Gomer); centerByArray(Gomer, false, false); cntMarker += Gomer.length; map.addOverlays(Harrod); centerByArray(Harrod, false, false); cntMarker += Harrod.length; map.addOverlays(Lafayette); centerByArray(Lafayette, false, false); cntMarker += Lafayette.length; map.addOverlays(Lima); centerByArray(Lima, false, false); cntMarker += Lima.length; map.addOverlays(Spencerville); centerByArray(Spencerville, false, false); cntMarker += Spencerville.length; centerByArray(Lima,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'); } }