function addMarkers() { mySelect = document.getElementById('selection'); Bountiful = [];Clearfield = [];Layton = [];Syracuse = [];Kaysville = [];Centerville = [];Clinton = [];Sunset = [];Farmington = [];East_Layton = [];West_Point = [];No_Salt_Lake = [];So_Weber = [];North_Salt_Lake = [];Ogden = [];West_Bountiful = [];Woods_Cross = [];mySelect.options[mySelect.options.length] = new Option("Bountiful schools",'all=Bountiful'); mySelect.options[mySelect.options.length] = new Option("Centerville schools",'all=Centerville'); mySelect.options[mySelect.options.length] = new Option("Clearfield schools",'all=Clearfield'); mySelect.options[mySelect.options.length] = new Option("Clinton schools",'all=Clinton'); mySelect.options[mySelect.options.length] = new Option("East Layton schools",'all=East_Layton'); mySelect.options[mySelect.options.length] = new Option("Farmington schools",'all=Farmington'); mySelect.options[mySelect.options.length] = new Option("Kaysville schools",'all=Kaysville'); mySelect.options[mySelect.options.length] = new Option("Layton schools",'all=Layton'); mySelect.options[mySelect.options.length] = new Option("No Salt Lake schools",'all=No_Salt_Lake'); mySelect.options[mySelect.options.length] = new Option("North Salt Lake schools",'all=North_Salt_Lake'); mySelect.options[mySelect.options.length] = new Option("Ogden schools",'all=Ogden'); mySelect.options[mySelect.options.length] = new Option("So Weber schools",'all=So_Weber'); mySelect.options[mySelect.options.length] = new Option("Sunset schools",'all=Sunset'); mySelect.options[mySelect.options.length] = new Option("Syracuse schools",'all=Syracuse'); mySelect.options[mySelect.options.length] = new Option("West Bountiful schools",'all=West_Bountiful'); mySelect.options[mySelect.options.length] = new Option("West Point schools",'all=West_Point'); mySelect.options[mySelect.options.length] = new Option("Woods Cross schools",'all=Woods_Cross'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Bountiful[Bountiful.length] = createMarker(new GPoint(-111.87243400,40.88204300),"
",iconGr); mySelect.options[mySelect.options.length] = new Option("3-6 Prog (bountiful High School)",'Bountiful=' + Bountiful.length); Clearfield[Clearfield.length] = createMarker(new GPoint(-112.00688400,41.09499800),"",iconGr); mySelect.options[mySelect.options.length] = new Option("3-6 Prog (clearfield High School)",'Clearfield=' + Clearfield.length); Layton[Layton.length] = createMarker(new GPoint(-111.92596436,41.09531021),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Adams Elementary School",'Layton=' + Layton.length); Bountiful[Bountiful.length] = createMarker(new GPoint(-111.90001678,40.85026169),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Adelaide Elementary School",'Bountiful=' + Bountiful.length); Clearfield[Clearfield.length] = createMarker(new GPoint(-112.02628326,41.08742905),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Antelope Elementary School",'Clearfield=' + Clearfield.length); Clearfield[Clearfield.length] = createMarker(new GPoint(-112.01746368,41.10706329),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Arrow Academy (yic)",'Clearfield=' + Clearfield.length); Syracuse[Syracuse.length] = createMarker(new GPoint(-112.03997803,41.07509995),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Bluff Ridge Elementary School",'Syracuse=' + Syracuse.length); Bountiful[Bountiful.length] = createMarker(new GPoint(-111.88561249,40.86118698),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Boulton Elementary School",'Bountiful=' + Bountiful.length); Bountiful[Bountiful.length] = createMarker(new GPoint(-111.88227844,40.87329102),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Bountiful Elementary School",'Bountiful=' + Bountiful.length); Bountiful[Bountiful.length] = createMarker(new GPoint(-111.87226105,40.88219452),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Bountiful High School",'Bountiful=' + Bountiful.length); Bountiful[Bountiful.length] = createMarker(new GPoint(-111.88127899,40.89383698),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Bountiful Junior High School",'Bountiful=' + Bountiful.length); Kaysville[Kaysville.length] = createMarker(new GPoint(-111.93644714,41.03499985),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Canyon Heights High School",'Kaysville=' + Kaysville.length); Centerville[Centerville.length] = createMarker(new GPoint(-111.87692261,40.92054749),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Centerville Elementary School",'Centerville=' + Centerville.length); Centerville[Centerville.length] = createMarker(new GPoint(-111.87881470,40.91044617),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Centerville Junior High School",'Centerville=' + Centerville.length); Layton[Layton.length] = createMarker(new GPoint(-111.96375275,41.06952286),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Central Davis Junior High School",'Layton=' + Layton.length); Clearfield[Clearfield.length] = createMarker(new GPoint(-112.00708008,41.10035324),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Clearfield High School",'Clearfield=' + Clearfield.length); Clearfield[Clearfield.length] = createMarker(new GPoint(-112.03040314,41.09659958),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Clearfield Job Corps High School",'Clearfield=' + Clearfield.length); Clinton[Clinton.length] = createMarker(new GPoint(-112.04717255,41.13976288),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Clinton Elementary School",'Clinton=' + Clinton.length); Kaysville[Kaysville.length] = createMarker(new GPoint(-111.93964386,41.02870178),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Columbia Elementary School",'Kaysville=' + Kaysville.length); Syracuse[Syracuse.length] = createMarker(new GPoint(-112.04855347,41.09416580),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Cook Elementary School",'Syracuse=' + Syracuse.length); Kaysville[Kaysville.length] = createMarker(new GPoint(-111.94317627,41.05060577),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Creekside Elementary School",'Kaysville=' + Kaysville.length); Layton[Layton.length] = createMarker(new GPoint(-111.96945190,41.07056427),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Crestview Elementary School",'Layton=' + Layton.length); Kaysville[Kaysville.length] = createMarker(new GPoint(-111.93456268,41.03013992),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Davis High School",'Kaysville=' + Kaysville.length); Kaysville[Kaysville.length] = createMarker(new GPoint(-111.92722200,41.02954600),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Davis Junior High School",'Kaysville=' + Kaysville.length); Sunset[Sunset.length] = createMarker(new GPoint(-112.03061676,41.12780380),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Doxey Elementary School",'Sunset=' + Sunset.length); Farmington[Farmington.length] = createMarker(new GPoint(-111.88363647,40.97860718),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Eagle Bay Elementary School",'Farmington=' + Farmington.length); East_Layton[East_Layton.length] = createMarker(new GPoint(-111.91827393,41.08086395),"",iconRd); mySelect.options[mySelect.options.length] = new Option("East Layton Elementary School",'East_Layton=' + East_Layton.length); Kaysville[Kaysville.length] = createMarker(new GPoint(-111.93972778,41.05146027),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Fairfield Junior High School",'Kaysville=' + Kaysville.length); Kaysville[Kaysville.length] = createMarker(new GPoint(-111.92748260,41.02930069),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Family Enrichment Center",'Kaysville=' + Kaysville.length); Farmington[Farmington.length] = createMarker(new GPoint(-111.90732400,40.98206000),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Farmington Bay Youth Center - Yic",'Farmington=' + Farmington.length); Farmington[Farmington.length] = createMarker(new GPoint(-111.88948059,40.97703552),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Farmington Elementary School",'Farmington=' + Farmington.length); Farmington[Farmington.length] = createMarker(new GPoint(-111.89208221,40.97863770),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Farmington Junior High School",'Farmington=' + Farmington.length); Sunset[Sunset.length] = createMarker(new GPoint(-112.05696106,41.13885880),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Fremont Elementary School",'Sunset=' + Sunset.length); Kaysville[Kaysville.length] = createMarker(new GPoint(-111.91961670,41.03183746),"",iconRd); mySelect.options[mySelect.options.length] = new Option("H C Burton Elementary School",'Kaysville=' + Kaysville.length); Layton[Layton.length] = createMarker(new GPoint(-111.99169159,41.04427719),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Heritage Elementary School",'Layton=' + Layton.length); Clearfield[Clearfield.length] = createMarker(new GPoint(-112.00661469,41.10789490),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Hill Field Elementary School",'Clearfield=' + Clearfield.length); Bountiful[Bountiful.length] = createMarker(new GPoint(-111.85994720,40.89210510),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Holbrook Elementary School",'Bountiful=' + Bountiful.length); Clearfield[Clearfield.length] = createMarker(new GPoint(-112.04529572,41.12025070),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Holt Elementary School",'Clearfield=' + Clearfield.length); Farmington[Farmington.length] = createMarker(new GPoint(-111.89910126,40.98720169),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Home Instruction-elem",'Farmington=' + Farmington.length); Farmington[Farmington.length] = createMarker(new GPoint(-111.89910126,40.98720169),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Home Instruction-sec",'Farmington=' + Farmington.length); Centerville[Centerville.length] = createMarker(new GPoint(-111.87437439,40.90673828),"",iconRd); mySelect.options[mySelect.options.length] = new Option("J A Taylor Elementary School",'Centerville=' + Centerville.length); Kaysville[Kaysville.length] = createMarker(new GPoint(-111.93611908,41.03570175),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Kaysville Elementary School",'Kaysville=' + Kaysville.length); Kaysville[Kaysville.length] = createMarker(new GPoint(-111.93630219,41.02894592),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Kaysville Junior High School",'Kaysville=' + Kaysville.length); Layton[Layton.length] = createMarker(new GPoint(-111.95389557,41.07472992),"",iconRd); mySelect.options[mySelect.options.length] = new Option("King Elementary School",'Layton=' + Layton.length); Farmington[Farmington.length] = createMarker(new GPoint(-111.90492249,41.00066376),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Knowlton Elementary School",'Farmington=' + Farmington.length); West_Point[West_Point.length] = createMarker(new GPoint(-112.08257294,41.12516403),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Lakeside Elementary School",'West_Point=' + West_Point.length); Layton[Layton.length] = createMarker(new GPoint(-111.97325897,41.06006241),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Layton Elementary School",'Layton=' + Layton.length); Layton[Layton.length] = createMarker(new GPoint(-111.95850372,41.06606293),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Layton High School",'Layton=' + Layton.length); Bountiful[Bountiful.length] = createMarker(new GPoint(-111.87203979,40.86511230),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Leo J Muir Elementary School",'Bountiful=' + Bountiful.length); No_Salt_Lake[No_Salt_Lake.length] = createMarker(new GPoint(-111.94178009,40.84203720),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Lifeline High School",'No_Salt_Lake=' + No_Salt_Lake.length); Layton[Layton.length] = createMarker(new GPoint(-111.97689819,41.08906174),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Layton=' + Layton.length); Bountiful[Bountiful.length] = createMarker(new GPoint(-111.88871765,40.89803696),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Meadowbrook Elementary School",'Bountiful=' + Bountiful.length); Bountiful[Bountiful.length] = createMarker(new GPoint(-111.87590790,40.87943649),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Millcreek Junior High School",'Bountiful=' + Bountiful.length); Kaysville[Kaysville.length] = createMarker(new GPoint(-111.91902161,41.05165100),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Morgan Elementary School",'Kaysville=' + Kaysville.length); Kaysville[Kaysville.length] = createMarker(new GPoint(-111.93010712,41.02663803),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Mountain High School",'Kaysville=' + Kaysville.length); Layton[Layton.length] = createMarker(new GPoint(-111.93166351,41.10292053),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Mountain View Elementary School",'Layton=' + Layton.length); Kaysville[Kaysville.length] = createMarker(new GPoint(-111.93010200,41.02638200),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Mt High Shoupp 10-12",'Kaysville=' + Kaysville.length); Kaysville[Kaysville.length] = createMarker(new GPoint(-111.93010200,41.02638200),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Mt High Shoupp 7-9",'Kaysville=' + Kaysville.length); Kaysville[Kaysville.length] = createMarker(new GPoint(-111.93010200,41.02638200),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Mt High Shoupp K-6",'Kaysville=' + Kaysville.length); Bountiful[Bountiful.length] = createMarker(new GPoint(-111.86093140,40.87133789),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Mueller Park Junior High School",'Bountiful=' + Bountiful.length); Clearfield[Clearfield.length] = createMarker(new GPoint(-112.01316071,41.10149384),"",iconBl); mySelect.options[mySelect.options.length] = new Option("North Davis Junior High School",'Clearfield=' + Clearfield.length); Layton[Layton.length] = createMarker(new GPoint(-10.00000000,10.00000000),"",iconRd); mySelect.options[mySelect.options.length] = new Option("North Davis Preparatory Academy",'Layton=' + Layton.length); Layton[Layton.length] = createMarker(new GPoint(-111.98600769,41.08933640),"",iconBl); mySelect.options[mySelect.options.length] = new Option("North Layton Junior High School",'Layton=' + Layton.length); Layton[Layton.length] = createMarker(new GPoint(-111.97321320,41.09524536),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Northridge High School",'Layton=' + Layton.length); Bountiful[Bountiful.length] = createMarker(new GPoint(-111.85583496,40.88251114),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Oak Hills Elementary School",'Bountiful=' + Bountiful.length); Farmington[Farmington.length] = createMarker(new GPoint(-111.89910126,40.98720169),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Online Elementary School",'Farmington=' + Farmington.length); No_Salt_Lake[No_Salt_Lake.length] = createMarker(new GPoint(-111.90509796,40.84193802),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Orchard Elementary School",'No_Salt_Lake=' + No_Salt_Lake.length); Centerville[Centerville.length] = createMarker(new GPoint(-111.88589478,40.94743729),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Reading Elementary School",'Centerville=' + Centerville.length); Layton[Layton.length] = createMarker(new GPoint(-111.97589874,41.07460022),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Reflections (yic) High School",'Layton=' + Layton.length); Layton[Layton.length] = createMarker(new GPoint(-112.02626300,41.06368300),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Sand Springs School",'Layton=' + Layton.length); Clearfield[Clearfield.length] = createMarker(new GPoint(-112.00725555,41.10336304),"",iconRd); mySelect.options[mySelect.options.length] = new Option("South Clearfield Elementary School",'Clearfield=' + Clearfield.length); Bountiful[Bountiful.length] = createMarker(new GPoint(-111.88796234,40.86173630),"",iconBl); mySelect.options[mySelect.options.length] = new Option("South Davis Junior High School",'Bountiful=' + Bountiful.length); So_Weber[So_Weber.length] = createMarker(new GPoint(-111.94708252,41.13217926),"",iconRd); mySelect.options[mySelect.options.length] = new Option("South Weber Elementary School",'So_Weber=' + So_Weber.length); Farmington[Farmington.length] = createMarker(new GPoint(-111.87390137,40.87559891),"",iconGr); mySelect.options[mySelect.options.length] = new Option("St Olaf - Private (rec Serv In Pub Sch)",'Farmington=' + Farmington.length); Kaysville[Kaysville.length] = createMarker(new GPoint(-111.92628479,41.02986145),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Star Transition High School",'Kaysville=' + Kaysville.length); Farmington[Farmington.length] = createMarker(new GPoint(-111.93161774,41.03116226),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Steps High School",'Farmington=' + Farmington.length); Centerville[Centerville.length] = createMarker(new GPoint(-111.87908173,40.93136978),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Stewart Elementary School",'Centerville=' + Centerville.length); Sunset[Sunset.length] = createMarker(new GPoint(-112.03061676,41.14286423),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Sunset Elementary School",'Sunset=' + Sunset.length); Sunset[Sunset.length] = createMarker(new GPoint(-112.03061676,41.13722229),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Sunset Junior High School",'Sunset=' + Sunset.length); Syracuse[Syracuse.length] = createMarker(new GPoint(-112.06441498,41.09181213),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Syracuse Elementary School",'Syracuse=' + Syracuse.length); Syracuse[Syracuse.length] = createMarker(new GPoint(-112.06478119,41.09237289),"",iconBl); mySelect.options[mySelect.options.length] = new Option("Syracuse Junior High School",'Syracuse=' + Syracuse.length); Bountiful[Bountiful.length] = createMarker(new GPoint(-111.87426758,40.90146255),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Tolman Elementary School",'Bountiful=' + Bountiful.length); Farmington[Farmington.length] = createMarker(new GPoint(-111.88731384,40.98089600),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Transition High School",'Farmington=' + Farmington.length); Layton[Layton.length] = createMarker(new GPoint(-111.99711609,41.09227371),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Trident School (drug & Alcoh)",'Layton=' + Layton.length); Layton[Layton.length] = createMarker(new GPoint(-111.99922180,41.08283615),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Vae View Elementary School",'Layton=' + Layton.length); Bountiful[Bountiful.length] = createMarker(new GPoint(-111.86791229,40.87678909),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Valley View Elementary School",'Bountiful=' + Bountiful.length); Bountiful[Bountiful.length] = createMarker(new GPoint(-111.88303375,40.89973831),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Viewmont High School",'Bountiful=' + Bountiful.length); Clearfield[Clearfield.length] = createMarker(new GPoint(-112.02096558,41.11372757),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Wasatch Elementary School",'Clearfield=' + Clearfield.length); North_Salt_Lake[North_Salt_Lake.length] = createMarker(new GPoint(-111.93187900,40.84945600),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Wasatch Peak Academy",'North_Salt_Lake=' + North_Salt_Lake.length); Bountiful[Bountiful.length] = createMarker(new GPoint(-111.88793182,40.88243866),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Washington Elementary School",'Bountiful=' + Bountiful.length); Ogden[Ogden.length] = createMarker(new GPoint(-111.90805054,41.12823868),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Weber Basin Job Corps High School",'Ogden=' + Ogden.length); West_Bountiful[West_Bountiful.length] = createMarker(new GPoint(-111.90107727,40.89403915),"",iconRd); mySelect.options[mySelect.options.length] = new Option("West Bountiful Elementary School",'West_Bountiful=' + West_Bountiful.length); Clinton[Clinton.length] = createMarker(new GPoint(-112.08060455,41.14003754),"",iconRd); mySelect.options[mySelect.options.length] = new Option("West Clinton Elementary School",'Clinton=' + Clinton.length); West_Point[West_Point.length] = createMarker(new GPoint(-112.09886932,41.11823654),"",iconRd); mySelect.options[mySelect.options.length] = new Option("West Point Elementary School",'West_Point=' + West_Point.length); West_Point[West_Point.length] = createMarker(new GPoint(-112.02040100,41.13386154),"",iconBl); mySelect.options[mySelect.options.length] = new Option("West Point Junior High School",'West_Point=' + West_Point.length); Layton[Layton.length] = createMarker(new GPoint(-111.95257568,41.06377029),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Whitesides Elementary School",'Layton=' + Layton.length); Kaysville[Kaysville.length] = createMarker(new GPoint(-111.92250824,41.01370239),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Windridge Elementary School",'Kaysville=' + Kaysville.length); Woods_Cross[Woods_Cross.length] = createMarker(new GPoint(-111.90014648,40.87838364),"",iconRd); mySelect.options[mySelect.options.length] = new Option("Woods Cross Elementary School",'Woods_Cross=' + Woods_Cross.length); Woods_Cross[Woods_Cross.length] = createMarker(new GPoint(-111.88506317,40.86627960),"",iconGr); mySelect.options[mySelect.options.length] = new Option("Woods Cross High School",'Woods_Cross=' + Woods_Cross.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(Bountiful); map.removeOverlays(Centerville); map.removeOverlays(Clearfield); map.removeOverlays(Clinton); map.removeOverlays(East_Layton); map.removeOverlays(Farmington); map.removeOverlays(Kaysville); map.removeOverlays(Layton); map.removeOverlays(No_Salt_Lake); map.removeOverlays(North_Salt_Lake); map.removeOverlays(Ogden); map.removeOverlays(So_Weber); map.removeOverlays(Sunset); map.removeOverlays(Syracuse); map.removeOverlays(West_Bountiful); map.removeOverlays(West_Point); map.removeOverlays(Woods_Cross); 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(Bountiful);map.removeOverlays(Bountiful); map.removeOverlays(Centerville); map.removeOverlays(Clearfield); map.removeOverlays(Clinton); map.removeOverlays(East_Layton); map.removeOverlays(Farmington); map.removeOverlays(Kaysville); map.removeOverlays(Layton); map.removeOverlays(No_Salt_Lake); map.removeOverlays(North_Salt_Lake); map.removeOverlays(Ogden); map.removeOverlays(So_Weber); map.removeOverlays(Sunset); map.removeOverlays(Syracuse); map.removeOverlays(West_Bountiful); map.removeOverlays(West_Point); map.removeOverlays(Woods_Cross); map.addOverlays(Bountiful); centerByArray(Bountiful, false, false); cntMarker += Bountiful.length; map.addOverlays(Centerville); centerByArray(Centerville, false, false); cntMarker += Centerville.length; map.addOverlays(Clearfield); centerByArray(Clearfield, false, false); cntMarker += Clearfield.length; map.addOverlays(Clinton); centerByArray(Clinton, false, false); cntMarker += Clinton.length; map.addOverlays(East_Layton); centerByArray(East_Layton, false, false); cntMarker += East_Layton.length; map.addOverlays(Farmington); centerByArray(Farmington, false, false); cntMarker += Farmington.length; map.addOverlays(Kaysville); centerByArray(Kaysville, false, false); cntMarker += Kaysville.length; map.addOverlays(Layton); centerByArray(Layton, false, false); cntMarker += Layton.length; map.addOverlays(No_Salt_Lake); centerByArray(No_Salt_Lake, false, false); cntMarker += No_Salt_Lake.length; map.addOverlays(North_Salt_Lake); centerByArray(North_Salt_Lake, false, false); cntMarker += North_Salt_Lake.length; map.addOverlays(Ogden); centerByArray(Ogden, false, false); cntMarker += Ogden.length; map.addOverlays(So_Weber); centerByArray(So_Weber, false, false); cntMarker += So_Weber.length; map.addOverlays(Sunset); centerByArray(Sunset, false, false); cntMarker += Sunset.length; map.addOverlays(Syracuse); centerByArray(Syracuse, false, false); cntMarker += Syracuse.length; map.addOverlays(West_Bountiful); centerByArray(West_Bountiful, false, false); cntMarker += West_Bountiful.length; map.addOverlays(West_Point); centerByArray(West_Point, false, false); cntMarker += West_Point.length; map.addOverlays(Woods_Cross); centerByArray(Woods_Cross, false, false); cntMarker += Woods_Cross.length; centerByArray(Bountiful,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'); } }