function addMarkers(){ mySelect = document.getElementById('selection'); Salt_Lake_City = [];South_Ogden = [];Layton = [];Taylorsville = [];Lindon = [];Sandy = [];Park_City = [];Bountiful = [];mySelect.options[mySelect.options.length] = new Option("Bountiful schools",'all=Bountiful'); mySelect.options[mySelect.options.length] = new Option("Layton schools",'all=Layton'); mySelect.options[mySelect.options.length] = new Option("Lindon schools",'all=Lindon'); mySelect.options[mySelect.options.length] = new Option("Park City schools",'all=Park_City'); 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("Taylorsville schools",'all=Taylorsville'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Salt_Lake_City[Salt_Lake_City.length] = createMarker(new GPoint(-111.99094800,40.71849800),"
Dancing Moose Montessori School
4428 Links Drive
Salt Lake City, UT 84120
Co-ed school, PK-2
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Dancing Moose Montessori School",'Salt_Lake_City=' + Salt_Lake_City.length); South_Ogden[South_Ogden.length] = createMarker(new GPoint(-111.97773900,41.16135000),"
Evergreen Montessori Academy
5875 S. Adams Ave. Pkwy., Ste. 100
South Ogden, UT 84405
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Evergreen Montessori Academy",'South_Ogden=' + South_Ogden.length); Layton[Layton.length] = createMarker(new GPoint(-111.91721500,41.06589900),"
Mills Montessori School
2621 East Oak Hills Drive
Layton, UT 84040
Co-ed school, PK-3
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mills Montessori School",'Layton=' + Layton.length); Taylorsville[Taylorsville.length] = createMarker(new GPoint(-111.93898000,40.65637100),"
Montessori Building Blocks
5218 S Redwood Road
Taylorsville, UT 84123
Co-ed school, PK-1
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Montessori Building Blocks",'Taylorsville=' + Taylorsville.length); Salt_Lake_City[Salt_Lake_City.length] = createMarker(new GPoint(-111.84818000,40.73031700),"
Montessori Child Discovery Center
1838 S 1500 E
Salt Lake City, UT 84105
Co-ed school, K-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Montessori Child Discovery Center",'Salt_Lake_City=' + Salt_Lake_City.length); Salt_Lake_City[Salt_Lake_City.length] = createMarker(new GPoint(-111.85947800,40.74148900),"
Montessori Childrens House
1303 S 1100 E
Salt Lake City, UT 84105
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Montessori Childrens House",'Salt_Lake_City=' + Salt_Lake_City.length); Salt_Lake_City[Salt_Lake_City.length] = createMarker(new GPoint(-111.82189900,40.73344700),"
Montessori Community School of Salt Lake City
2416 East 1700 South
Salt Lake City, UT 84108
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Montessori Community School of Salt Lake City",'Salt_Lake_City=' + Salt_Lake_City.length); Lindon[Lindon.length] = createMarker(new GPoint(-111.72507900,40.33132000),"
Montessori Learning Center
310 South 400 West
Lindon, UT 84042
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Montessori Learning Center",'Lindon=' + Lindon.length); Sandy[Sandy.length] = createMarker(new GPoint(-111.79021800,40.67745000),"
Montessori Of Oakridge
9269 Teal Circle
Sandy, UT 84093
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Montessori Of Oakridge",'Sandy=' + Sandy.length); Salt_Lake_City[Salt_Lake_City.length] = createMarker(new GPoint(-111.81245400,40.69966300),"
Montessori Of Salt Lake
2806 East 3300 South
Salt Lake City, UT 84109
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Montessori Of Salt Lake",'Salt_Lake_City=' + Salt_Lake_City.length); Salt_Lake_City[Salt_Lake_City.length] = createMarker(new GPoint(-111.86608000,40.63345900),"
Montessori School Of Murray
6446 South 900 East
Salt Lake City, UT 84121
Co-ed school, PK-2
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Montessori School Of Murray",'Salt_Lake_City=' + Salt_Lake_City.length); Park_City[Park_City.length] = createMarker(new GPoint(-111.49262400,40.67110400),"
Soaring Wings Montessori School
2083 Equestrian Court
Park City, UT 84060
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Soaring Wings Montessori School",'Park_City=' + Park_City.length); Bountiful[Bountiful.length] = createMarker(new GPoint(-111.88541700,40.88891000),"
Sunrise Montessori
43 South 200 West
Bountiful, UT 84010
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sunrise Montessori",'Bountiful=' + Bountiful.length); Salt_Lake_City[Salt_Lake_City.length] = createMarker(new GPoint(-111.83267700,40.60880600),"
Willow Creek Montessori
7839 Highland Drive
Salt Lake City, UT 84121
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Willow Creek Montessori",'Salt_Lake_City=' + Salt_Lake_City.length); map.removeOverlays(Bountiful); map.removeOverlays(Layton); map.removeOverlays(Lindon); map.removeOverlays(Park_City); map.removeOverlays(Salt_Lake_City); map.removeOverlays(Sandy); map.removeOverlays(South_Ogden); map.removeOverlays(Taylorsville); setTimeout(function(){map.addOverlays(Bountiful)},1000); setTimeout(function(){map.addOverlays(Layton)},1000); setTimeout(function(){map.addOverlays(Lindon)},1000); setTimeout(function(){map.addOverlays(Park_City)},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(Taylorsville)},1000); maxLng = -111.49262400; maxLat = 41.16135000; minLng = -111.99094800; minLat = 40.33132000; 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(Bountiful); map.removeOverlays(Layton); map.removeOverlays(Lindon); map.removeOverlays(Park_City); map.removeOverlays(Salt_Lake_City); map.removeOverlays(Sandy); map.removeOverlays(South_Ogden); map.removeOverlays(Taylorsville); 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(Salt_Lake_City);map.removeOverlays(Bountiful); map.removeOverlays(Layton); map.removeOverlays(Lindon); map.removeOverlays(Park_City); map.removeOverlays(Salt_Lake_City); map.removeOverlays(Sandy); map.removeOverlays(South_Ogden); map.removeOverlays(Taylorsville); map.addOverlays(Bountiful); centerByArray(Bountiful, false, false); cntMarker += Bountiful.length; map.addOverlays(Layton); centerByArray(Layton, false, false); cntMarker += Layton.length; map.addOverlays(Lindon); centerByArray(Lindon, false, false); cntMarker += Lindon.length; map.addOverlays(Park_City); centerByArray(Park_City, false, false); cntMarker += Park_City.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(Taylorsville); centerByArray(Taylorsville, false, false); cntMarker += Taylorsville.length; centerByArray(Salt_Lake_City,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///27884,27875,27878,27833,30705,27877,31889,27889,27817,27880,27894,27879,36282,27876,/all'); //window.open('/map.php?type=2&schools=27884,27875,27878,27833,30705,27877,31889,27889,27817,27880,27894,27879,36282,27876,&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; }