function addMarkers(){ mySelect = document.getElementById('selection'); South_Jordan = [];Salt_Lake_City = [];Murray = [];West_Jordan = [];West_Valley_City = [];Draper = [];Midvale = [];Kearns = [];Magna = [];Sandy = [];mySelect.options[mySelect.options.length] = new Option("Draper schools",'all=Draper'); mySelect.options[mySelect.options.length] = new Option("Kearns schools",'all=Kearns'); mySelect.options[mySelect.options.length] = new Option("Magna schools",'all=Magna'); 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("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 Jordan schools",'all=South_Jordan'); 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("---------------------------",''); South_Jordan[South_Jordan.length] = createMarker(new GPoint(-111.93885000,40.54908800),"
American Heritage of South Jordan
11100 S. Redwood Road
South Jordan, UT 84095
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("American Heritage of South Jordan",'South_Jordan=' + South_Jordan.length); Salt_Lake_City[Salt_Lake_City.length] = createMarker(new GPoint(-111.83787000,40.64926300),"
Anchor Christian Academy
1880 E 5600 South
Salt Lake City, UT 84121
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Anchor Christian Academy",'Salt_Lake_City=' + Salt_Lake_City.length); Salt_Lake_City[Salt_Lake_City.length] = createMarker(new GPoint(-111.90689500,40.68683300),"
Applied Scholastics Academy of Salt Lake City
547 W. 3900 So. Suite E
Salt Lake City, UT 84123
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Applied Scholastics Academy of Salt Lake City",'Salt_Lake_City=' + Salt_Lake_City.length); Murray[Murray.length] = createMarker(new GPoint(-111.87447400,40.67247100),"
Benjamin Franklin Academy
4511 South 600 East
Murray, UT 84107
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Benjamin Franklin Academy",'Murray=' + Murray.length); West_Jordan[West_Jordan.length] = createMarker(new GPoint(-111.93875400,40.60675000),"
Copper Hills Youth Center
5899 Rivendell Drive
West Jordan, UT 84088
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Copper Hills Youth Center",'West_Jordan=' + West_Jordan.length); Murray[Murray.length] = createMarker(new GPoint(-111.90298200,40.65226900),"
Deseret Academy
5430 S Green St
Murray, UT 84123
Co-ed school, KG-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Deseret Academy",'Murray=' + Murray.length); West_Valley_City[West_Valley_City.length] = createMarker(new GPoint(-112.00774700,40.68213700),"
Grace Baptist School
4880 W 4100 S
West Valley City, UT 84120
Co-ed school, KG-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Grace Baptist School",'West_Valley_City=' + West_Valley_City.length); Salt_Lake_City[Salt_Lake_City.length] = createMarker(new GPoint(-111.80521100,40.63269100),"
Intermountain Christian School
6515 Lion Lane
Salt Lake City, UT 84121
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Intermountain Christian School",'Salt_Lake_City=' + Salt_Lake_City.length); Draper[Draper.length] = createMarker(new GPoint(-111.88194200,40.53811100),"
Juan Diego Catholic High School
11800 South 300 East
Draper, UT 84020
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Juan Diego Catholic High School",'Draper=' + Draper.length); Salt_Lake_City[Salt_Lake_City.length] = createMarker(new GPoint(-111.85976100,40.75520400),"
Judge Memorial Catholic High School
650 South 1100 East
Salt Lake City, UT 84102
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Judge Memorial Catholic High School",'Salt_Lake_City=' + Salt_Lake_City.length); Draper[Draper.length] = createMarker(new GPoint(-111.89046400,40.52227900),"
Pine Ridge Academy
12595 Minuteman Drive
Draper, UT 84020
Co-ed school, 8-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pine Ridge Academy",'Draper=' + Draper.length); Salt_Lake_City[Salt_Lake_City.length] = createMarker(new GPoint(-111.93408000,40.64671000),"
Primary Children's Medical Center School
5770 S 1500 W
Salt Lake City, UT 84123
Co-ed school, 8-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Primary Children's Medical Center School",'Salt_Lake_City=' + Salt_Lake_City.length); Midvale[Midvale.length] = createMarker(new GPoint(-111.86579300,40.62536100),"
Prosperity Academy
6947 South 900 East
Midvale, UT 84047
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Prosperity Academy",'Midvale=' + Midvale.length); Salt_Lake_City[Salt_Lake_City.length] = createMarker(new GPoint(-111.86548000,40.74420000),"
Realms Of Inquiry
1140 S 900 E
Salt Lake City, UT 84105
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Realms Of Inquiry",'Salt_Lake_City=' + Salt_Lake_City.length); Salt_Lake_City[Salt_Lake_City.length] = createMarker(new GPoint(-111.80845200,40.69690600),"
Reid School
2965 East 3435 South
Salt Lake City, UT 84109
Co-ed school, PK-9
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Reid School",'Salt_Lake_City=' + Salt_Lake_City.length); Salt_Lake_City[Salt_Lake_City.length] = createMarker(new GPoint(-111.84550900,40.75354300),"
Rowland Hall St Marks School
720 Guardsman Way
Salt Lake City, UT 84108
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Rowland Hall St Marks School",'Salt_Lake_City=' + Salt_Lake_City.length); Salt_Lake_City[Salt_Lake_City.length] = createMarker(new GPoint(-111.86566400,40.68416300),"
Salt Lake Lutheran High School
4020 S 900 E
Salt Lake City, UT 84124
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Salt Lake Lutheran High School",'Salt_Lake_City=' + Salt_Lake_City.length); Salt_Lake_City[Salt_Lake_City.length] = createMarker(new GPoint(-111.85978000,40.72854300),"
Specialized Educational Progra
1924 South 1100 East Suite D
Salt Lake City, UT 84105
Co-ed school, NS-NS
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Specialized Educational Progra",'Salt_Lake_City=' + Salt_Lake_City.length); South_Jordan[South_Jordan.length] = createMarker(new GPoint(-111.93850000,40.54801100),"
Stillwater Academy
11175 South Redwood Road
South Jordan, UT 84095
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Stillwater Academy",'South_Jordan=' + South_Jordan.length); Kearns[Kearns.length] = createMarker(new GPoint(-111.98216700,40.66770400),"
Valley Christian School
3818 W 4700 S
Kearns, UT 84118
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Valley Christian School",'Kearns=' + Kearns.length); Magna[Magna.length] = createMarker(new GPoint(-112.08882800,40.71048900),"
Vista Private School
8265 W 2700 S
Magna, UT 84044
Co-ed school, 10-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Vista Private School",'Magna=' + Magna.length); Sandy[Sandy.length] = createMarker(new GPoint(-111.84888600,40.58023300),"
The Waterford School
1480 E 9400 S
Sandy, UT 84121
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Waterford School",'Sandy=' + Sandy.length); West_Jordan[West_Jordan.length] = createMarker(new GPoint(-112.02188000,40.58303700),"
West Ridge Academy (boys Ranch)
5500 Bagley Park Road
West Jordan, UT 84088
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("West Ridge Academy (boys Ranch)",'West_Jordan=' + West_Jordan.length); Salt_Lake_City[Salt_Lake_City.length] = createMarker(new GPoint(-111.86616800,40.64464500),"
Woodland Hills School
5858 South 900 East
Salt Lake City, UT 84121
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Woodland Hills School",'Salt_Lake_City=' + Salt_Lake_City.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,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/////2/' + showArray); map.removeOverlays(Draper); map.removeOverlays(Kearns); map.removeOverlays(Magna); map.removeOverlays(Midvale); map.removeOverlays(Murray); map.removeOverlays(Salt_Lake_City); map.removeOverlays(Sandy); map.removeOverlays(South_Jordan); 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(South_Jordan);map.removeOverlays(Draper); map.removeOverlays(Kearns); map.removeOverlays(Magna); map.removeOverlays(Midvale); map.removeOverlays(Murray); map.removeOverlays(Salt_Lake_City); map.removeOverlays(Sandy); map.removeOverlays(South_Jordan); map.removeOverlays(West_Jordan); map.removeOverlays(West_Valley_City); map.addOverlays(Draper); centerByArray(Draper, false, false); cntMarker += Draper.length; map.addOverlays(Kearns); centerByArray(Kearns, false, false); cntMarker += Kearns.length; map.addOverlays(Magna); centerByArray(Magna, false, false); cntMarker += Magna.length; map.addOverlays(Midvale); centerByArray(Midvale, false, false); cntMarker += Midvale.length; map.addOverlays(Murray); centerByArray(Murray, false, false); cntMarker += Murray.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_Jordan); centerByArray(South_Jordan, false, false); cntMarker += South_Jordan.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(South_Jordan,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=1&schools=&school_level=2&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; }