function addMarkers(){ mySelect = document.getElementById('selection'); Draper = [];Farmington = [];Holladay = [];Kaysville = [];Kearns = [];Layton = [];Midvale = [];Murray = [];Ogden = [];Park_City = [];Provo = [];Salt_Lake_City = [];Sandy = [];South_Ogden = [];West_Jordan = [];West_Valley_City = [];mySelect.options[mySelect.options.length] = new Option("Draper schools",'all=Draper'); mySelect.options[mySelect.options.length] = new Option("Farmington schools",'all=Farmington'); mySelect.options[mySelect.options.length] = new Option("Holladay schools",'all=Holladay'); mySelect.options[mySelect.options.length] = new Option("Kaysville schools",'all=Kaysville'); mySelect.options[mySelect.options.length] = new Option("Kearns schools",'all=Kearns'); mySelect.options[mySelect.options.length] = new Option("Layton schools",'all=Layton'); mySelect.options[mySelect.options.length] = new Option("Midvale schools",'all=Midvale'); mySelect.options[mySelect.options.length] = new Option("Murray schools",'all=Murray'); mySelect.options[mySelect.options.length] = new Option("Ogden schools",'all=Ogden'); mySelect.options[mySelect.options.length] = new Option("Park City schools",'all=Park_City'); mySelect.options[mySelect.options.length] = new Option("Provo schools",'all=Provo'); mySelect.options[mySelect.options.length] = new Option("Salt Lake City schools",'all=Salt_Lake_City'); mySelect.options[mySelect.options.length] = new Option("Sandy schools",'all=Sandy'); mySelect.options[mySelect.options.length] = new Option("South Ogden schools",'all=South_Ogden'); mySelect.options[mySelect.options.length] = new Option("West Jordan schools",'all=West_Jordan'); mySelect.options[mySelect.options.length] = new Option("West Valley City schools",'all=West_Valley_City'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Draper[Draper.length] = createMarker(new GPoint(-111.86851900,40.52776900),"
Newcastle Preschool
12257 S 800 E
Draper, UT 84020
Co-ed school, PK-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Newcastle Preschool",'Draper=' + Draper.length); Farmington[Farmington.length] = createMarker(new GPoint(-111.91004800,40.99880100),"
Challenger School—Farmington
1089 Shepard Creek Parkway
Farmington, UT 84025
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Challenger School—Farmington",'Farmington=' + Farmington.length); Holladay[Holladay.length] = createMarker(new GPoint(-111.82439400,40.67238300),"
Challenger School—Holladay
4555 S. 2300 East
Holladay, UT 84117
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Challenger School—Holladay",'Holladay=' + Holladay.length); Kaysville[Kaysville.length] = createMarker(new GPoint(-111.95730900,41.04174400),"
Time For Families
440 N. 900 W.
Kaysville, UT 84037
Co-ed school, KG-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Time For Families",'Kaysville=' + Kaysville.length); Kearns[Kearns.length] = createMarker(new GPoint(-111.98305300,40.65323600),"
Kinder Care-kearns
3854 West 5400 South
Kearns, UT 84118
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kinder Care-kearns",'Kearns=' + Kearns.length); Layton[Layton.length] = createMarker(new GPoint(-111.97259700,41.07056300),"
Trinity Lutheran Preschool And Kindergarten
385 W Golden Avenue
Layton, UT 84041
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Trinity Lutheran Preschool And Kindergarten",'Layton=' + Layton.length); Layton[Layton.length] = createMarker(new GPoint(-111.97326800,41.09180000),"
Adventures In Learning
2182 N Hillfield Road Suite 4
Layton, UT 84041
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Adventures In Learning",'Layton=' + Layton.length); Midvale[Midvale.length] = createMarker(new GPoint(-111.88500000,40.61560000),"
New Tyme
Po Box 205
Midvale, UT 84047
Co-ed school, K-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("New Tyme",'Midvale=' + Midvale.length); Murray[Murray.length] = createMarker(new GPoint(-111.88609000,40.66348200),"
Mount Vernon Academy
184 E Vine Street
Murray, UT 84107
Co-ed school, K-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mount Vernon Academy",'Murray=' + Murray.length); Ogden[Ogden.length] = createMarker(new GPoint(-111.97633100,41.24878300),"
Children S Classic
160 9th Street
Ogden, UT 84404
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Children S Classic",'Ogden=' + Ogden.length); Ogden[Ogden.length] = createMarker(new GPoint(-111.95347200,41.24295900),"
Teddy Bear Childcare
1285 Monroe
Ogden, UT 84401
Co-ed school, PK-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Teddy Bear Childcare",'Ogden=' + Ogden.length); Park_City[Park_City.length] = createMarker(new GPoint(-111.49309300,40.66419900),"
Creative Beginnings
2180 Sidewinder Drive
Park City, UT 84060
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Creative Beginnings",'Park_City=' + Park_City.length); Park_City[Park_City.length] = createMarker(new GPoint(-111.57165900,40.74746900),"
Total Energy
3160 Pinebrook Rd
Park City, UT 84098
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Total Energy",'Park_City=' + Park_City.length); Park_City[Park_City.length] = createMarker(new GPoint(-111.53894500,40.72600100),"
Little Miners Montessori
1400 Bitner Road
Park City, UT 84098
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Little Miners Montessori",'Park_City=' + Park_City.length); Provo[Provo.length] = createMarker(new GPoint(-111.65579700,40.21784900),"
Milestone Learning Center Inc
1165 S 180 E
Provo, UT 84606
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Milestone Learning Center Inc",'Provo=' + Provo.length); Salt_Lake_City[Salt_Lake_City.length] = createMarker(new GPoint(-111.81733100,40.68696300),"
Buttons N Bows
2600 E 3900 S
Salt Lake City, UT 84124
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Buttons N Bows",'Salt_Lake_City=' + Salt_Lake_City.length); Salt_Lake_City[Salt_Lake_City.length] = createMarker(new GPoint(-111.87661800,40.76348800),"
Intermountain Health Care Child Development Center
259 S 500 E
Salt Lake City, UT 84102
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Intermountain Health Care Child Development Center",'Salt_Lake_City=' + Salt_Lake_City.length); Salt_Lake_City[Salt_Lake_City.length] = createMarker(new GPoint(-111.89765800,40.75213700),"
Kids Kampus Child Care
232 W 800 S
Salt Lake City, UT 84101
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kids Kampus Child Care",'Salt_Lake_City=' + Salt_Lake_City.length); Salt_Lake_City[Salt_Lake_City.length] = createMarker(new GPoint(-111.95818000,40.68330600),"
Over The Rainbow Child Care
4050 Constitution Blvd
Salt Lake City, UT 84119
Co-ed school, PK-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Over The Rainbow Child Care",'Salt_Lake_City=' + Salt_Lake_City.length); Salt_Lake_City[Salt_Lake_City.length] = createMarker(new GPoint(-111.92057800,40.75150200),"
Tlc Teaching/learning Center
1035 West Indiana Ave
Salt Lake City, UT 84104
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tlc Teaching/learning Center",'Salt_Lake_City=' + Salt_Lake_City.length); Sandy[Sandy.length] = createMarker(new GPoint(-111.85291800,40.57299400),"
Kids Etc. Preschool
9825 S 1300 E
Sandy, UT 84094
Co-ed school, K-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kids Etc. Preschool",'Sandy=' + Sandy.length); Sandy[Sandy.length] = createMarker(new GPoint(-111.85301800,40.58481800),"
Kindercare
9165 S 1300 E
Sandy, UT 84094
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kindercare",'Sandy=' + Sandy.length); Sandy[Sandy.length] = createMarker(new GPoint(-111.85420500,40.59486300),"
Challenger School-Cottonwood
1260 E 8600 S
Sandy, UT 84094
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Challenger School-Cottonwood",'Sandy=' + Sandy.length); South_Ogden[South_Ogden.length] = createMarker(new GPoint(-111.93598800,41.15724000),"
Childrens Classic
5820 Wasatch Drive
South Ogden, UT 84403
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Childrens Classic",'South_Ogden=' + South_Ogden.length); West_Jordan[West_Jordan.length] = createMarker(new GPoint(-111.94080700,40.60748200),"
Kinder Care
1785 W 7888 S
West Jordan, UT 84088
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kinder Care",'West_Jordan=' + West_Jordan.length); West_Jordan[West_Jordan.length] = createMarker(new GPoint(-111.96114000,40.60936300),"
Learning Tree-southwest
2857 W 7800 S
West Jordan, UT 84088
Co-ed school, NS-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Learning Tree-southwest",'West_Jordan=' + West_Jordan.length); West_Jordan[West_Jordan.length] = createMarker(new GPoint(-111.92938000,40.62453500),"
Tender Touch #2(wj)
6990 S 1300 W
West Jordan, UT 84084
Co-ed school, K-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tender Touch #2(wj)",'West_Jordan=' + West_Jordan.length); West_Valley_City[West_Valley_City.length] = createMarker(new GPoint(-111.97738000,40.71948800),"
Learning Tree West
3655 W 2340 S
West Valley City, UT 84120
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Learning Tree West",'West_Valley_City=' + West_Valley_City.length); West_Valley_City[West_Valley_City.length] = createMarker(new GPoint(-111.95818000,40.68440200),"
Tender Touch
3990 S 2700 W
West Valley City, UT 84119
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tender Touch",'West_Valley_City=' + West_Valley_City.length); West_Valley_City[West_Valley_City.length] = createMarker(new GPoint(-111.98216700,40.66770400),"
Wee Willie Winkle Child Care
3818 W 4700 S
West Valley City, UT 84118
Co-ed school, K-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wee Willie Winkle Child Care",'West_Valley_City=' + West_Valley_City.length); map.removeOverlays(Draper); map.removeOverlays(Farmington); map.removeOverlays(Holladay); map.removeOverlays(Kaysville); map.removeOverlays(Kearns); map.removeOverlays(Layton); map.removeOverlays(Midvale); map.removeOverlays(Murray); map.removeOverlays(Ogden); map.removeOverlays(Park_City); map.removeOverlays(Provo); map.removeOverlays(Salt_Lake_City); map.removeOverlays(Sandy); map.removeOverlays(South_Ogden); map.removeOverlays(West_Jordan); map.removeOverlays(West_Valley_City); setTimeout(function(){map.addOverlays(Draper)},1000); setTimeout(function(){map.addOverlays(Farmington)},1000); setTimeout(function(){map.addOverlays(Holladay)},1000); setTimeout(function(){map.addOverlays(Kaysville)},1000); setTimeout(function(){map.addOverlays(Kearns)},1000); setTimeout(function(){map.addOverlays(Layton)},1000); setTimeout(function(){map.addOverlays(Midvale)},1000); setTimeout(function(){map.addOverlays(Murray)},1000); setTimeout(function(){map.addOverlays(Ogden)},1000); setTimeout(function(){map.addOverlays(Park_City)},1000); setTimeout(function(){map.addOverlays(Provo)},1000); setTimeout(function(){map.addOverlays(Salt_Lake_City)},1000); setTimeout(function(){map.addOverlays(Sandy)},1000); setTimeout(function(){map.addOverlays(South_Ogden)},1000); setTimeout(function(){map.addOverlays(West_Jordan)},1000); setTimeout(function(){map.addOverlays(West_Valley_City)},1000); maxLng = -111.49309300; maxLat = 41.24878300; minLng = -111.98305300; minLat = 40.21784900; reCenterMap(); } // 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,11); /* 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(Draper); map.removeOverlays(Farmington); map.removeOverlays(Holladay); map.removeOverlays(Kaysville); map.removeOverlays(Kearns); map.removeOverlays(Layton); map.removeOverlays(Midvale); map.removeOverlays(Murray); map.removeOverlays(Ogden); map.removeOverlays(Park_City); map.removeOverlays(Provo); map.removeOverlays(Salt_Lake_City); map.removeOverlays(Sandy); map.removeOverlays(South_Ogden); map.removeOverlays(West_Jordan); map.removeOverlays(West_Valley_City); 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(Draper);map.removeOverlays(Draper); map.removeOverlays(Farmington); map.removeOverlays(Holladay); map.removeOverlays(Kaysville); map.removeOverlays(Kearns); map.removeOverlays(Layton); map.removeOverlays(Midvale); map.removeOverlays(Murray); map.removeOverlays(Ogden); map.removeOverlays(Park_City); map.removeOverlays(Provo); map.removeOverlays(Salt_Lake_City); map.removeOverlays(Sandy); map.removeOverlays(South_Ogden); map.removeOverlays(West_Jordan); map.removeOverlays(West_Valley_City); map.addOverlays(Draper); centerByArray(Draper, false, false); cntMarker += Draper.length; map.addOverlays(Farmington); centerByArray(Farmington, false, false); cntMarker += Farmington.length; map.addOverlays(Holladay); centerByArray(Holladay, false, false); cntMarker += Holladay.length; map.addOverlays(Kaysville); centerByArray(Kaysville, false, false); cntMarker += Kaysville.length; map.addOverlays(Kearns); centerByArray(Kearns, false, false); cntMarker += Kearns.length; map.addOverlays(Layton); centerByArray(Layton, false, false); cntMarker += Layton.length; map.addOverlays(Midvale); centerByArray(Midvale, false, false); cntMarker += Midvale.length; map.addOverlays(Murray); centerByArray(Murray, false, false); cntMarker += Murray.length; map.addOverlays(Ogden); centerByArray(Ogden, false, false); cntMarker += Ogden.length; map.addOverlays(Park_City); centerByArray(Park_City, false, false); cntMarker += Park_City.length; map.addOverlays(Provo); centerByArray(Provo, false, false); cntMarker += Provo.length; map.addOverlays(Salt_Lake_City); centerByArray(Salt_Lake_City, false, false); cntMarker += Salt_Lake_City.length; map.addOverlays(Sandy); centerByArray(Sandy, false, false); cntMarker += Sandy.length; map.addOverlays(South_Ogden); centerByArray(South_Ogden, false, false); cntMarker += South_Ogden.length; map.addOverlays(West_Jordan); centerByArray(West_Jordan, false, false); cntMarker += West_Jordan.length; map.addOverlays(West_Valley_City); centerByArray(West_Valley_City, false, false); cntMarker += West_Valley_City.length; centerByArray(Draper,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'); //window.open('/map.php?type=2&schools=&school_level=&radius=&zipcode=&school_type_search=&school_type_code='); } } function createMarker(point, label, icon) { var marker = new GMarker(point, icon); var html = label; GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); return marker; }