function addMarkers() { mySelect = document.getElementById('selection'); Alex = [];Amber = [];Chickasha = [];Blanchard = [];Minco = [];Ninnekah = [];Rush_Springs = [];Tuttle = [];Verden = [];mySelect.options[mySelect.options.length] = new Option("Alex schools",'all=Alex'); mySelect.options[mySelect.options.length] = new Option("Amber schools",'all=Amber'); mySelect.options[mySelect.options.length] = new Option("Blanchard schools",'all=Blanchard'); mySelect.options[mySelect.options.length] = new Option("Chickasha schools",'all=Chickasha'); mySelect.options[mySelect.options.length] = new Option("Minco schools",'all=Minco'); mySelect.options[mySelect.options.length] = new Option("Ninnekah schools",'all=Ninnekah'); mySelect.options[mySelect.options.length] = new Option("Rush Springs schools",'all=Rush_Springs'); mySelect.options[mySelect.options.length] = new Option("Tuttle schools",'all=Tuttle'); mySelect.options[mySelect.options.length] = new Option("Verden schools",'all=Verden'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Alex[Alex.length] = createMarker(new GPoint(-97.76049805,34.97370148),"
Alex Elementary School
Po Box 188
Alex, OK 73002

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Alex Elementary School",'Alex=' + Alex.length); Alex[Alex.length] = createMarker(new GPoint(-97.76049805,34.97370148),"
Alex Junior Senior High School (jr)
Po Box 188
Alex, OK 73002

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Alex Junior Senior High School (jr)",'Alex=' + Alex.length); Alex[Alex.length] = createMarker(new GPoint(-97.77881400,34.91733000),"
Alex Junior Senior High School (sr)
Po Box 188
Alex, OK 73002

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Alex Junior Senior High School (sr)",'Alex=' + Alex.length); Amber[Amber.length] = createMarker(new GPoint(-97.77919769,35.14540100),"
Amber-pocasset Elementary School
Po Box 38
Amber, OK 73004

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Amber-pocasset Elementary School",'Amber=' + Amber.length); Amber[Amber.length] = createMarker(new GPoint(-97.77919769,35.14540100),"
Amber-pocasset High School
Po Box 38
Amber, OK 73004

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Amber-pocasset High School",'Amber=' + Amber.length); Amber[Amber.length] = createMarker(new GPoint(-97.77919769,35.14540100),"
Amber-pocasset Junior High School
Po Box 38
Amber, OK 73004

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Amber-pocasset Junior High School",'Amber=' + Amber.length); Chickasha[Chickasha.length] = createMarker(new GPoint(-97.94426727,35.05253601),"
Bill Wallace Ec Center
900 W Choctaw Ave
Chickasha, OK 73018

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bill Wallace Ec Center",'Chickasha=' + Chickasha.length); Blanchard[Blanchard.length] = createMarker(new GPoint(-97.67220306,35.13209915),"
Bridge Creek Elementary School
2209 E Sooner Rd
Blanchard, OK 73010

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Bridge Creek Elementary School",'Blanchard=' + Blanchard.length); Blanchard[Blanchard.length] = createMarker(new GPoint(-97.67220306,35.13209915),"
Bridge Creek High School
2209 E Sooner Rd
Blanchard, OK 73010

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Bridge Creek High School",'Blanchard=' + Blanchard.length); Blanchard[Blanchard.length] = createMarker(new GPoint(-97.67220306,35.13209915),"
Bridge Creek Middle School
2209 E Sooner Rd
Blanchard, OK 73010

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Bridge Creek Middle School",'Blanchard=' + Blanchard.length); Chickasha[Chickasha.length] = createMarker(new GPoint(-97.94426727,35.05253601),"
Chickasha High School
900 W Choctaw Ave
Chickasha, OK 73018

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Chickasha High School",'Chickasha=' + Chickasha.length); Chickasha[Chickasha.length] = createMarker(new GPoint(-97.94426727,35.05253601),"
Chickasha Ies Middle School
900 W Choctaw Ave
Chickasha, OK 73018

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Chickasha Ies Middle School",'Chickasha=' + Chickasha.length); Chickasha[Chickasha.length] = createMarker(new GPoint(-97.94426727,35.05253601),"
Chickasha Middle School
900 W Choctaw Ave
Chickasha, OK 73018

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Chickasha Middle School",'Chickasha=' + Chickasha.length); Chickasha[Chickasha.length] = createMarker(new GPoint(-97.88369751,35.06700134),"
Friend Elementary School
1307 County Rd 1350
Chickasha, OK 73018

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Friend Elementary School",'Chickasha=' + Chickasha.length); Chickasha[Chickasha.length] = createMarker(new GPoint(-97.94426727,35.05253601),"
Grand Avenue Elementary School
900 W Choctaw Ave
Chickasha, OK 73018

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Grand Avenue Elementary School",'Chickasha=' + Chickasha.length); Chickasha[Chickasha.length] = createMarker(new GPoint(-97.94110107,35.04990005),"
Jane Brooks Schl For Deaf Elementary School
Po Box 669
Chickasha, OK 73023

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Jane Brooks Schl For Deaf Elementary School",'Chickasha=' + Chickasha.length); Chickasha[Chickasha.length] = createMarker(new GPoint(-97.94426727,35.05253601),"
Lincoln Elementary School
900 W Choctaw Ave
Chickasha, OK 73018

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Chickasha=' + Chickasha.length); Chickasha[Chickasha.length] = createMarker(new GPoint(-97.99928284,34.98691940),"
Lincoln-west Elementary School
900 W Choctaw Ave
Chickasha, OK 73018

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln-west Elementary School",'Chickasha=' + Chickasha.length); Blanchard[Blanchard.length] = createMarker(new GPoint(-97.68440247,35.13719940),"
Middleberg Elementary School
2130 County Rd 1317
Blanchard, OK 73010

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Middleberg Elementary School",'Blanchard=' + Blanchard.length); Minco[Minco.length] = createMarker(new GPoint(-97.96199799,35.29980087),"
Minco Elementary School
Po Box 428
Minco, OK 73059

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Minco Elementary School",'Minco=' + Minco.length); Minco[Minco.length] = createMarker(new GPoint(-97.96199799,35.29980087),"
Minco High School
Po Box 428
Minco, OK 73059

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Minco High School",'Minco=' + Minco.length); Minco[Minco.length] = createMarker(new GPoint(-97.96199799,35.29980087),"
Minco Middle School
Po Box 428
Minco, OK 73059

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Minco Middle School",'Minco=' + Minco.length); Ninnekah[Ninnekah.length] = createMarker(new GPoint(-97.94509888,34.91939926),"
Ninnekah Elementary School
Po Box 275
Ninnekah, OK 73067

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Ninnekah Elementary School",'Ninnekah=' + Ninnekah.length); Ninnekah[Ninnekah.length] = createMarker(new GPoint(-97.94509888,34.91939926),"
Ninnekah Junior High School
Po Box 275
Ninnekah, OK 73067

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Ninnekah Junior High School",'Ninnekah=' + Ninnekah.length); Chickasha[Chickasha.length] = createMarker(new GPoint(-97.93499756,35.00410080),"
Pioneer Elementary School
3686 State Highway 92
Chickasha, OK 73018

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Pioneer Elementary School",'Chickasha=' + Chickasha.length); Rush_Springs[Rush_Springs.length] = createMarker(new GPoint(-97.92759705,34.76639938),"
Rush Springs Elementary School
Po Box 308
Rush Springs, OK 73082

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Rush Springs Elementary School",'Rush_Springs=' + Rush_Springs.length); Rush_Springs[Rush_Springs.length] = createMarker(new GPoint(-97.92759705,34.76639938),"
Rush Springs High School
Po Box 308
Rush Springs, OK 73082

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Rush Springs High School",'Rush_Springs=' + Rush_Springs.length); Rush_Springs[Rush_Springs.length] = createMarker(new GPoint(-97.92759705,34.76639938),"
Rush Springs Middle School
Po Box 308
Rush Springs, OK 73082

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Rush Springs Middle School",'Rush_Springs=' + Rush_Springs.length); Ninnekah[Ninnekah.length] = createMarker(new GPoint(-97.94509888,34.91939926),"
Senior High School
Po Box 275
Ninnekah, OK 73067

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Senior High School",'Ninnekah=' + Ninnekah.length); Chickasha[Chickasha.length] = createMarker(new GPoint(-97.94426727,35.05253601),"
Southwest Elementary School
900 W Choctaw Ave
Chickasha, OK 73018

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Southwest Elementary School",'Chickasha=' + Chickasha.length); Tuttle[Tuttle.length] = createMarker(new GPoint(-97.75330353,35.26879883),"
Tuttle Elementary School
Po Box 780
Tuttle, OK 73089

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Tuttle Elementary School",'Tuttle=' + Tuttle.length); Tuttle[Tuttle.length] = createMarker(new GPoint(-97.75330353,35.26879883),"
Tuttle High School
Po Box 780
Tuttle, OK 73089

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tuttle High School",'Tuttle=' + Tuttle.length); Tuttle[Tuttle.length] = createMarker(new GPoint(-97.75330353,35.26879883),"
Tuttle Ies Middle School
Po Box 780
Tuttle, OK 73089

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Tuttle Ies Middle School",'Tuttle=' + Tuttle.length); Tuttle[Tuttle.length] = createMarker(new GPoint(-97.75330353,35.26879883),"
Tuttle Middle School
Po Box 780
Tuttle, OK 73089

[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("Tuttle Middle School",'Tuttle=' + Tuttle.length); Verden[Verden.length] = createMarker(new GPoint(-98.07720184,35.08689880),"
Verden Elementary School
Po Box 99
Verden, OK 73092

[ View School Profile ]
",iconRd); mySelect.options[mySelect.options.length] = new Option("Verden Elementary School",'Verden=' + Verden.length); Verden[Verden.length] = createMarker(new GPoint(-98.07720184,35.08689880),"
Verden High School
Po Box 99
Verden, OK 73092

[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Verden High School",'Verden=' + Verden.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(Alex); map.removeOverlays(Amber); map.removeOverlays(Blanchard); map.removeOverlays(Chickasha); map.removeOverlays(Minco); map.removeOverlays(Ninnekah); map.removeOverlays(Rush_Springs); map.removeOverlays(Tuttle); map.removeOverlays(Verden); 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(Alex);map.removeOverlays(Alex); map.removeOverlays(Amber); map.removeOverlays(Blanchard); map.removeOverlays(Chickasha); map.removeOverlays(Minco); map.removeOverlays(Ninnekah); map.removeOverlays(Rush_Springs); map.removeOverlays(Tuttle); map.removeOverlays(Verden); map.addOverlays(Alex); centerByArray(Alex, false, false); cntMarker += Alex.length; map.addOverlays(Amber); centerByArray(Amber, false, false); cntMarker += Amber.length; map.addOverlays(Blanchard); centerByArray(Blanchard, false, false); cntMarker += Blanchard.length; map.addOverlays(Chickasha); centerByArray(Chickasha, false, false); cntMarker += Chickasha.length; map.addOverlays(Minco); centerByArray(Minco, false, false); cntMarker += Minco.length; map.addOverlays(Ninnekah); centerByArray(Ninnekah, false, false); cntMarker += Ninnekah.length; map.addOverlays(Rush_Springs); centerByArray(Rush_Springs, false, false); cntMarker += Rush_Springs.length; map.addOverlays(Tuttle); centerByArray(Tuttle, false, false); cntMarker += Tuttle.length; map.addOverlays(Verden); centerByArray(Verden, false, false); cntMarker += Verden.length; centerByArray(Alex,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'); } }