function addMarkers() { mySelect = document.getElementById('selection'); Wintersville = [];Rayland = [];Brilliant = [];Yorkville = [];Tiltonsville = [];Adena = [];Steubenville = [];Richmond = [];Mingo_Junction = [];Irondale = [];Toronto = [];Bloomingdale = [];Bergholz = [];Hammondsville = [];mySelect.options[mySelect.options.length] = new Option("Adena schools",'all=Adena'); mySelect.options[mySelect.options.length] = new Option("Bergholz schools",'all=Bergholz'); mySelect.options[mySelect.options.length] = new Option("Bloomingdale schools",'all=Bloomingdale'); mySelect.options[mySelect.options.length] = new Option("Brilliant schools",'all=Brilliant'); mySelect.options[mySelect.options.length] = new Option("Hammondsville schools",'all=Hammondsville'); mySelect.options[mySelect.options.length] = new Option("Irondale schools",'all=Irondale'); mySelect.options[mySelect.options.length] = new Option("Mingo Junction schools",'all=Mingo_Junction'); mySelect.options[mySelect.options.length] = new Option("Rayland schools",'all=Rayland'); mySelect.options[mySelect.options.length] = new Option("Richmond schools",'all=Richmond'); mySelect.options[mySelect.options.length] = new Option("Steubenville schools",'all=Steubenville'); mySelect.options[mySelect.options.length] = new Option("Tiltonsville schools",'all=Tiltonsville'); mySelect.options[mySelect.options.length] = new Option("Toronto schools",'all=Toronto'); mySelect.options[mySelect.options.length] = new Option("Wintersville schools",'all=Wintersville'); mySelect.options[mySelect.options.length] = new Option("Yorkville schools",'all=Yorkville'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Wintersville[Wintersville.length] = createMarker(new GPoint(-80.72299194,40.33446121),"
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bantam Ridge Elementary School",'Wintersville=' + Wintersville.length); Rayland[Rayland.length] = createMarker(new GPoint(-80.72216797,40.19104004),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Buckeye Local High School",'Rayland=' + Rayland.length); Brilliant[Brilliant.length] = createMarker(new GPoint(-80.63260651,40.26258469),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Buckeye North Elementary School",'Brilliant=' + Brilliant.length); Brilliant[Brilliant.length] = createMarker(new GPoint(-80.63260651,40.26258469),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Buckeye North Middle School",'Brilliant=' + Brilliant.length); Rayland[Rayland.length] = createMarker(new GPoint(-80.77399445,40.27215958),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Buckeye Northwest Elementary School",'Rayland=' + Rayland.length); Yorkville[Yorkville.length] = createMarker(new GPoint(-80.70746613,40.15780640),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Buckeye South Elementary School",'Yorkville=' + Yorkville.length); Tiltonsville[Tiltonsville.length] = createMarker(new GPoint(-80.69766998,40.17078018),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Buckeye Southwest Middle School",'Tiltonsville=' + Tiltonsville.length); Adena[Adena.length] = createMarker(new GPoint(-80.87220001,40.21879959),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Buckeye West Elementary School",'Adena=' + Adena.length); Steubenville[Steubenville.length] = createMarker(new GPoint(-80.66680145,40.37949753),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Buena Vista Elementary School",'Steubenville=' + Steubenville.length); Richmond[Richmond.length] = createMarker(new GPoint(-80.74273682,40.45159149),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Edison High School",'Richmond=' + Richmond.length); Steubenville[Steubenville.length] = createMarker(new GPoint(-80.61065674,40.37117386),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Garfield Elementary School",'Steubenville=' + Steubenville.length); Steubenville[Steubenville.length] = createMarker(new GPoint(-80.63602448,40.36937714),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Harding Middle School",'Steubenville=' + Steubenville.length); Mingo_Junction[Mingo_Junction.length] = createMarker(new GPoint(-80.62085724,40.32631683),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Hills Elementary School",'Mingo_Junction=' + Mingo_Junction.length); Wintersville[Wintersville.length] = createMarker(new GPoint(-80.71386719,40.37697601),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Indian Creek High School",'Wintersville=' + Wintersville.length); Mingo_Junction[Mingo_Junction.length] = createMarker(new GPoint(-80.60853577,40.31977463),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Indian Creek Junior High School",'Mingo_Junction=' + Mingo_Junction.length); Irondale[Irondale.length] = createMarker(new GPoint(-80.72834778,40.57136536),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Irondale Elementary School",'Irondale=' + Irondale.length); Toronto[Toronto.length] = createMarker(new GPoint(-80.61304474,40.45527267),"",iconBl); mySelect.options[mySelect.options.length] = new Option("J T Karaffa Middle School",'Toronto=' + Toronto.length); Bloomingdale[Bloomingdale.length] = createMarker(new GPoint(-80.76277924,40.35614014),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Jefferson County High School",'Bloomingdale=' + Bloomingdale.length); Bergholz[Bergholz.length] = createMarker(new GPoint(-80.90048218,40.49676132),"",iconRd); mySelect.options[mySelect.options.length] = new Option("John E Gregg Elementary School",'Bergholz=' + Bergholz.length); Toronto[Toronto.length] = createMarker(new GPoint(-80.60072327,40.47791672),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Toronto=' + Toronto.length); Steubenville[Steubenville.length] = createMarker(new GPoint(-80.62751007,40.34922028),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Steubenville=' + Steubenville.length); Steubenville[Steubenville.length] = createMarker(new GPoint(-80.63146210,40.36093903),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Mckinley Elementary School",'Steubenville=' + Steubenville.length); Steubenville[Steubenville.length] = createMarker(new GPoint(-80.69984436,40.37330246),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Pleasant Hill Elementary School",'Steubenville=' + Steubenville.length); Richmond[Richmond.length] = createMarker(new GPoint(-80.76841736,40.42942429),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Richmond Elementary School",'Richmond=' + Richmond.length); Steubenville[Steubenville.length] = createMarker(new GPoint(-80.62304687,40.36560059),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Roosevelt Elementary School",'Steubenville=' + Steubenville.length); Toronto[Toronto.length] = createMarker(new GPoint(-80.61303711,40.45527649),"",iconRd); mySelect.options[mySelect.options.length] = new Option("S C Dennis Elementary School",'Toronto=' + Toronto.length); Bergholz[Bergholz.length] = createMarker(new GPoint(-80.89485931,40.50397110),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Springfield Middle School",'Bergholz=' + Bergholz.length); Hammondsville[Hammondsville.length] = createMarker(new GPoint(-80.70919800,40.54962921),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Stanton Middle School",'Hammondsville=' + Hammondsville.length); Steubenville[Steubenville.length] = createMarker(new GPoint(-80.61249542,40.36475372),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Steubenville High School",'Steubenville=' + Steubenville.length); Toronto[Toronto.length] = createMarker(new GPoint(-80.59970093,40.46926117),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Toronto High School",'Toronto=' + Toronto.length); Bloomingdale[Bloomingdale.length] = createMarker(new GPoint(-80.82713318,40.33880615),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Wayne Elementary School",'Bloomingdale=' + Bloomingdale.length); Steubenville[Steubenville.length] = createMarker(new GPoint(-80.61376953,40.36336136),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Wells Elementary School",'Steubenville=' + Steubenville.length); Wintersville[Wintersville.length] = createMarker(new GPoint(-80.71321869,40.37583923),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Wintersville Elementary School",'Wintersville=' + Wintersville.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(Adena); map.removeOverlays(Bergholz); map.removeOverlays(Bloomingdale); map.removeOverlays(Brilliant); map.removeOverlays(Hammondsville); map.removeOverlays(Irondale); map.removeOverlays(Mingo_Junction); map.removeOverlays(Rayland); map.removeOverlays(Richmond); map.removeOverlays(Steubenville); map.removeOverlays(Tiltonsville); map.removeOverlays(Toronto); map.removeOverlays(Wintersville); map.removeOverlays(Yorkville); 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(Wintersville);map.removeOverlays(Adena); map.removeOverlays(Bergholz); map.removeOverlays(Bloomingdale); map.removeOverlays(Brilliant); map.removeOverlays(Hammondsville); map.removeOverlays(Irondale); map.removeOverlays(Mingo_Junction); map.removeOverlays(Rayland); map.removeOverlays(Richmond); map.removeOverlays(Steubenville); map.removeOverlays(Tiltonsville); map.removeOverlays(Toronto); map.removeOverlays(Wintersville); map.removeOverlays(Yorkville); map.addOverlays(Adena); centerByArray(Adena, false, false); cntMarker += Adena.length; map.addOverlays(Bergholz); centerByArray(Bergholz, false, false); cntMarker += Bergholz.length; map.addOverlays(Bloomingdale); centerByArray(Bloomingdale, false, false); cntMarker += Bloomingdale.length; map.addOverlays(Brilliant); centerByArray(Brilliant, false, false); cntMarker += Brilliant.length; map.addOverlays(Hammondsville); centerByArray(Hammondsville, false, false); cntMarker += Hammondsville.length; map.addOverlays(Irondale); centerByArray(Irondale, false, false); cntMarker += Irondale.length; map.addOverlays(Mingo_Junction); centerByArray(Mingo_Junction, false, false); cntMarker += Mingo_Junction.length; map.addOverlays(Rayland); centerByArray(Rayland, false, false); cntMarker += Rayland.length; map.addOverlays(Richmond); centerByArray(Richmond, false, false); cntMarker += Richmond.length; map.addOverlays(Steubenville); centerByArray(Steubenville, false, false); cntMarker += Steubenville.length; map.addOverlays(Tiltonsville); centerByArray(Tiltonsville, false, false); cntMarker += Tiltonsville.length; map.addOverlays(Toronto); centerByArray(Toronto, false, false); cntMarker += Toronto.length; map.addOverlays(Wintersville); centerByArray(Wintersville, false, false); cntMarker += Wintersville.length; map.addOverlays(Yorkville); centerByArray(Yorkville, false, false); cntMarker += Yorkville.length; centerByArray(Wintersville,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'); } }