function addMarkers(){ mySelect = document.getElementById('selection'); Wheat_Ridge = [];Lakewood = [];Westminster = [];Pine = [];Arvada = [];Denver = [];Littleton = [];Morrison = [];Golden = [];mySelect.options[mySelect.options.length] = new Option("Arvada schools",'all=Arvada'); mySelect.options[mySelect.options.length] = new Option("Denver schools",'all=Denver'); mySelect.options[mySelect.options.length] = new Option("Golden schools",'all=Golden'); mySelect.options[mySelect.options.length] = new Option("Lakewood schools",'all=Lakewood'); mySelect.options[mySelect.options.length] = new Option("Littleton schools",'all=Littleton'); mySelect.options[mySelect.options.length] = new Option("Morrison schools",'all=Morrison'); mySelect.options[mySelect.options.length] = new Option("Pine schools",'all=Pine'); mySelect.options[mySelect.options.length] = new Option("Westminster schools",'all=Westminster'); mySelect.options[mySelect.options.length] = new Option("Wheat Ridge schools",'all=Wheat_Ridge'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Wheat_Ridge[Wheat_Ridge.length] = createMarker(new GPoint(-105.12121500,39.77999700),"
Alpine Valley School
4501 Parfet Street
Wheat Ridge, CO 80033
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Alpine Valley School",'Wheat_Ridge=' + Wheat_Ridge.length); Wheat_Ridge[Wheat_Ridge.length] = createMarker(new GPoint(-105.08122100,39.67136400),"
Beth Eden Baptist School
2600 Wadsworth Blvd
Wheat Ridge, CO 80033
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Beth Eden Baptist School",'Wheat_Ridge=' + Wheat_Ridge.length); Lakewood[Lakewood.length] = createMarker(new GPoint(-105.08287900,39.67616300),"
Christian Fellowship School
7700 W Woodard Dr
Lakewood, CO 80227
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Christian Fellowship School",'Lakewood=' + Lakewood.length); Westminster[Westminster.length] = createMarker(new GPoint(-105.09201900,39.87948100),"
Cleo Wallace Center
8405 Church Ranch Blvd
Westminster, CO 80021
Co-ed school, 4-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cleo Wallace Center",'Westminster=' + Westminster.length); Pine[Pine.length] = createMarker(new GPoint(-105.44176200,39.50691400),"
Clonlara School
112 Road D
Pine, CO 80470
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Clonlara School",'Pine=' + Pine.length); Wheat_Ridge[Wheat_Ridge.length] = createMarker(new GPoint(-105.12312000,39.77806300),"
Colorado Catholic Academy
11180 W 44th Avenue
Wheat Ridge, CO 80033
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Colorado Catholic Academy",'Wheat_Ridge=' + Wheat_Ridge.length); Arvada[Arvada.length] = createMarker(new GPoint(-105.08025800,39.83106500),"
Colorado State Academy
7506 W 74th Place
Arvada, CO 80003
Co-ed school, 4-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Colorado State Academy",'Arvada=' + Arvada.length); Denver[Denver.length] = createMarker(new GPoint(-104.97234200,39.74109700),"
Denver Street School
1567 Marion Street
Denver, CO 80218
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Denver Street School",'Denver=' + Denver.length); Arvada[Arvada.length] = createMarker(new GPoint(-105.13525900,39.81293100),"
Faith Christian Academy
12189 W 64th Ave
Arvada, CO 80004
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Faith Christian Academy",'Arvada=' + Arvada.length); Wheat_Ridge[Wheat_Ridge.length] = createMarker(new GPoint(-105.11449000,39.78284400),"
Foothills Academy
4725 Miller Street
Wheat Ridge, CO 80033
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Foothills Academy",'Wheat_Ridge=' + Wheat_Ridge.length); Littleton[Littleton.length] = createMarker(new GPoint(-105.07093700,39.59142300),"
Front Range Christian School
6657 W Ottawa Ave Ste A17
Littleton, CO 80128
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Front Range Christian School",'Littleton=' + Littleton.length); Lakewood[Lakewood.length] = createMarker(new GPoint(-105.12843200,39.70136600),"
Green Mt Christian Academy
822 South Simms Street
Lakewood, CO 80228
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Green Mt Christian Academy",'Lakewood=' + Lakewood.length); Westminster[Westminster.length] = createMarker(new GPoint(-105.05431800,39.87453700),"
Hyland Christian School
5255 W 98th Avenue
Westminster, CO 80020
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hyland Christian School",'Westminster=' + Westminster.length); Arvada[Arvada.length] = createMarker(new GPoint(-105.11899400,39.82592300),"
Maranatha Christian Center
7180 Oak Street
Arvada, CO 80004
Co-ed school, NS-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Maranatha Christian Center",'Arvada=' + Arvada.length); Denver[Denver.length] = createMarker(new GPoint(-105.08742200,39.65263700),"
Mile High Baptist School
8100 W Hampden Avenue
Denver, CO 80227
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mile High Baptist School",'Denver=' + Denver.length); Morrison[Morrison.length] = createMarker(new GPoint(-105.19460000,39.61770000),"
Silver State Christian School
14711 W. Morrison Road
Morrison, CO 80465
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Silver State Christian School",'Morrison=' + Morrison.length); Golden[Golden.length] = createMarker(new GPoint(-105.14257700,39.74827300),"
Tetra Academy
2081 Youngfield Street
Golden, CO 80401
Co-ed school, 3-10
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tetra Academy",'Golden=' + Golden.length); Wheat_Ridge[Wheat_Ridge.length] = createMarker(new GPoint(-105.06805900,39.75863700),"
Wheat Ridge Christian Academy
6475 W 29th Ave
Wheat Ridge, CO 80214
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Wheat Ridge Christian Academy",'Wheat_Ridge=' + Wheat_Ridge.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(Arvada); map.removeOverlays(Denver); map.removeOverlays(Golden); map.removeOverlays(Lakewood); map.removeOverlays(Littleton); map.removeOverlays(Morrison); map.removeOverlays(Pine); map.removeOverlays(Westminster); map.removeOverlays(Wheat_Ridge); 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(Wheat_Ridge);map.removeOverlays(Arvada); map.removeOverlays(Denver); map.removeOverlays(Golden); map.removeOverlays(Lakewood); map.removeOverlays(Littleton); map.removeOverlays(Morrison); map.removeOverlays(Pine); map.removeOverlays(Westminster); map.removeOverlays(Wheat_Ridge); map.addOverlays(Arvada); centerByArray(Arvada, false, false); cntMarker += Arvada.length; map.addOverlays(Denver); centerByArray(Denver, false, false); cntMarker += Denver.length; map.addOverlays(Golden); centerByArray(Golden, false, false); cntMarker += Golden.length; map.addOverlays(Lakewood); centerByArray(Lakewood, false, false); cntMarker += Lakewood.length; map.addOverlays(Littleton); centerByArray(Littleton, false, false); cntMarker += Littleton.length; map.addOverlays(Morrison); centerByArray(Morrison, false, false); cntMarker += Morrison.length; map.addOverlays(Pine); centerByArray(Pine, false, false); cntMarker += Pine.length; map.addOverlays(Westminster); centerByArray(Westminster, false, false); cntMarker += Westminster.length; map.addOverlays(Wheat_Ridge); centerByArray(Wheat_Ridge, false, false); cntMarker += Wheat_Ridge.length; centerByArray(Wheat_Ridge,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; }