function addMarkers() { mySelect = document.getElementById('selection'); Evansville = [];mySelect.options[mySelect.options.length] = new Option("Evansville schools",'all=Evansville'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Evansville[Evansville.length] = createMarker(new GPoint(-87.60952759,37.97900391),"
",iconBl); mySelect.options[mySelect.options.length] = new Option("Barker Learning Center",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.54062653,37.96293640),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Benjamin Bosse High School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.49312592,37.94886017),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Caze Elementary School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.58097076,37.99794006),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Cedar Hall Elementary School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.57397461,38.02833557),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Central High School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.55916400,37.96385000),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Christa Mcauliffe Alt Mid School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.63814545,38.04509735),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Cynthia Heights Elementary School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.62848663,37.95856094),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Daniel Wertz Elementary School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.46581100,37.97894900),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Deaconess School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.55677032,37.98383713),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Delaware Elementary School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.51377106,37.96394730),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Dexter Elementary School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.55069733,38.00606155),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Evans Middle School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.57562256,37.97378159),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Evansville Psychiatric Center",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.56414900,37.97109900),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Evs Juvenile Correctional Fac",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.52537537,37.94863892),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Fairlawn Elementary School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.60632324,37.97306442),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Francis Joseph Reitz High School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.55001831,37.95176315),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Glenwood Middle School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.52510071,37.97638702),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Harper Elementary School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.57412720,38.00631714),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Harwood Middle School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.49665070,37.96715546),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Hebron Elementary School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.60411835,37.98593521),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Helfrich Park Middle School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.55598450,37.99497986),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Henry Reis Educ Cntr-alt High School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.57357788,38.04017639),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Highland Elementary School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.54245758,37.97913742),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Howard Roosa Elementary School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.56147003,37.95785904),"",iconRd); mySelect.options[mySelect.options.length] = new Option("John M Culver Elementary School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.56446700,37.97257100),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Joshua Academy",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.57562256,37.97378159),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Learning Center",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.55644226,37.96996307),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.52510071,37.95880127),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Lodge Elementary School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.47819400,37.97404000),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Mcgary Middle School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.55393982,37.99863815),"",iconGr); mySelect.options[mySelect.options.length] = new Option("North High School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.50983429,38.04769135),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Oak Hill Middle School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.64594269,37.98223877),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Perry Heights Middle School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.55671692,37.97463989),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Plaza Park Middle School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.53742218,38.11363602),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Scott Elementary School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.57562256,37.97378159),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Signature School Inc",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.55889893,37.96400070),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Stanley Hall Enrichment Cntr High School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.50152588,37.99680710),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Stockwell Elementary School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.56240082,38.02153397),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Stringtown Elementary School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.61870575,37.97897720),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Tekoppel Elementary School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.58147430,38.02192688),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Thompkins Middle School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.52692413,37.99096680),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Vogel Elementary School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.53282928,37.96256256),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Washington Middle School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.67037201,37.97266388),"",iconRd); mySelect.options[mySelect.options.length] = new Option("West Terrace Elementary School",'Evansville=' + Evansville.length); Evansville[Evansville.length] = createMarker(new GPoint(-87.48530579,37.97423172),"",iconGr); mySelect.options[mySelect.options.length] = new Option("William Henry Harrison High School",'Evansville=' + Evansville.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(Evansville); 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(Evansville);map.removeOverlays(Evansville); map.addOverlays(Evansville); centerByArray(Evansville, false, false); cntMarker += Evansville.length; centerByArray(Evansville,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'); } }