function addMarkers(){ mySelect = document.getElementById('selection'); Fridley = [];Anoka = [];Blaine = [];Coon_Rapids = [];Columbia_Heights = [];Andover = [];Spring_Lake_Park = [];Saint_Francis = [];Elk_River = [];mySelect.options[mySelect.options.length] = new Option("Andover schools",'all=Andover'); mySelect.options[mySelect.options.length] = new Option("Anoka schools",'all=Anoka'); mySelect.options[mySelect.options.length] = new Option("Blaine schools",'all=Blaine'); mySelect.options[mySelect.options.length] = new Option("Columbia Heights schools",'all=Columbia_Heights'); mySelect.options[mySelect.options.length] = new Option("Coon Rapids schools",'all=Coon_Rapids'); mySelect.options[mySelect.options.length] = new Option("Elk River schools",'all=Elk_River'); mySelect.options[mySelect.options.length] = new Option("Fridley schools",'all=Fridley'); mySelect.options[mySelect.options.length] = new Option("Saint Francis schools",'all=Saint_Francis'); mySelect.options[mySelect.options.length] = new Option("Spring Lake Park schools",'all=Spring_Lake_Park'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Fridley[Fridley.length] = createMarker(new GPoint(-93.23481800,45.07494100),"
Al-amal School
1401 Gardena Avenue Ne
Fridley, MN 55432
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Al-amal School",'Fridley=' + Fridley.length); Anoka[Anoka.length] = createMarker(new GPoint(-93.36985600,45.20763700),"
Anoka Adventist Christian School
1035 Lincoln Street
Anoka, MN 55303
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Anoka Adventist Christian School",'Anoka=' + Anoka.length); Blaine[Blaine.length] = createMarker(new GPoint(-93.24186900,45.13314900),"
Calvin Christian School
8966 Pierce St Ne
Blaine, MN 55434
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Calvin Christian School",'Blaine=' + Blaine.length); Coon_Rapids[Coon_Rapids.length] = createMarker(new GPoint(-93.31799400,45.17344400),"
Coon Rapids Christian School
11164 Hanson Blvd Nw
Coon Rapids, MN 55433
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Coon Rapids Christian School",'Coon_Rapids=' + Coon_Rapids.length); Coon_Rapids[Coon_Rapids.length] = createMarker(new GPoint(-93.27543100,45.15015900),"
Cross Of Christ Lutheran School
9931 Foley Blvd NW
Coon Rapids, MN 55433
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cross Of Christ Lutheran School",'Coon_Rapids=' + Coon_Rapids.length); Coon_Rapids[Coon_Rapids.length] = createMarker(new GPoint(-93.31750300,45.17018800),"
Epiphany School
11001 Hanson Blvd Nw
Coon Rapids, MN 55433
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Epiphany School",'Coon_Rapids=' + Coon_Rapids.length); Fridley[Fridley.length] = createMarker(new GPoint(-93.26028700,45.10416300),"
Grace Lutheran School
460 75th Avenue Ne
Fridley, MN 55432
Co-ed school, 1-7
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Grace Lutheran School",'Fridley=' + Fridley.length); Columbia_Heights[Columbia_Heights.length] = createMarker(new GPoint(-93.25009300,45.04160100),"
Immaculate Conception School
4030 Jackson Street Ne
Columbia Heights, MN 55421
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Immaculate Conception School",'Columbia_Heights=' + Columbia_Heights.length); Columbia_Heights[Columbia_Heights.length] = createMarker(new GPoint(-93.25050800,45.06093700),"
Little Voyageurs Montessori School
825 51st Avenue Ne
Columbia Heights, MN 55421
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Little Voyageurs Montessori School",'Columbia_Heights=' + Columbia_Heights.length); Andover[Andover.length] = createMarker(new GPoint(-93.34327300,45.21935700),"
Meadow Creek Christian School
3037 Bunker Lake Blvd Nw
Andover, MN 55304
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Meadow Creek Christian School",'Andover=' + Andover.length); Anoka[Anoka.length] = createMarker(new GPoint(-93.38374400,45.18935500),"
Minnesota Renaissance School
1333 5th Ave. S.
Anoka, MN 55303
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Minnesota Renaissance School",'Anoka=' + Anoka.length); Anoka[Anoka.length] = createMarker(new GPoint(-93.40306600,45.20185900),"
Mt Olive Christian Preschool & Kindergarten
700 Western Street
Anoka, MN 55303
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mt Olive Christian Preschool & Kindergarten",'Anoka=' + Anoka.length); Blaine[Blaine.length] = createMarker(new GPoint(-93.24905800,45.20811300),"
Northside Christian School
804 131st Ave Ne
Blaine, MN 55434
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Northside Christian School",'Blaine=' + Blaine.length); Spring_Lake_Park[Spring_Lake_Park.length] = createMarker(new GPoint(-93.25369300,45.10803700),"
Prince Of Peace Lutheran School
7700 Monroe Street Ne
Spring Lake Park, MN 55432
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Prince Of Peace Lutheran School",'Spring_Lake_Park=' + Spring_Lake_Park.length); Anoka[Anoka.length] = createMarker(new GPoint(-93.38320200,45.19865600),"
St. Stephen's School
506 Jackson Street
Anoka, MN 55303
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Stephen's School",'Anoka=' + Anoka.length); Coon_Rapids[Coon_Rapids.length] = createMarker(new GPoint(-93.27517200,45.17614800),"
Salem Montessori School
11337 Flintwood Street NW
Coon Rapids, MN 55448
Co-ed school, NS-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Salem Montessori School",'Coon_Rapids=' + Coon_Rapids.length); Saint_Francis[Saint_Francis.length] = createMarker(new GPoint(-93.36860100,45.38577800),"
St Francis Christian School
22940 Saint Francis Blvd Nw
Saint Francis, MN 55070
Co-ed school, 1-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Francis Christian School",'Saint_Francis=' + Saint_Francis.length); Elk_River[Elk_River.length] = createMarker(new GPoint(-93.74250000,45.35940000),"
St John Lutheran School
9243 Viking Blvd Nw
Elk River, MN 55330
Co-ed school, PK-7
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St John Lutheran School",'Elk_River=' + Elk_River.length); Saint_Francis[Saint_Francis.length] = createMarker(new GPoint(-93.36336000,45.38456300),"
Trinity Lutheran School
3812 229th Avenue Nw
Saint Francis, MN 55070
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Trinity Lutheran School",'Saint_Francis=' + Saint_Francis.length); Blaine[Blaine.length] = createMarker(new GPoint(-93.23502200,45.20985000),"
The Way Of The Shepherd Montessori
13200 Central Avenue Ne
Blaine, MN 55434
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Way Of The Shepherd Montessori",'Blaine=' + Blaine.length); Fridley[Fridley.length] = createMarker(new GPoint(-93.26322500,45.09240300),"
Woodcrest Baptist Academy
6875 University Ave Ne
Fridley, MN 55432
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Woodcrest Baptist Academy",'Fridley=' + Fridley.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/////1/' + showArray); map.removeOverlays(Andover); map.removeOverlays(Anoka); map.removeOverlays(Blaine); map.removeOverlays(Columbia_Heights); map.removeOverlays(Coon_Rapids); map.removeOverlays(Elk_River); map.removeOverlays(Fridley); map.removeOverlays(Saint_Francis); map.removeOverlays(Spring_Lake_Park); 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(Fridley);map.removeOverlays(Andover); map.removeOverlays(Anoka); map.removeOverlays(Blaine); map.removeOverlays(Columbia_Heights); map.removeOverlays(Coon_Rapids); map.removeOverlays(Elk_River); map.removeOverlays(Fridley); map.removeOverlays(Saint_Francis); map.removeOverlays(Spring_Lake_Park); map.addOverlays(Andover); centerByArray(Andover, false, false); cntMarker += Andover.length; map.addOverlays(Anoka); centerByArray(Anoka, false, false); cntMarker += Anoka.length; map.addOverlays(Blaine); centerByArray(Blaine, false, false); cntMarker += Blaine.length; map.addOverlays(Columbia_Heights); centerByArray(Columbia_Heights, false, false); cntMarker += Columbia_Heights.length; map.addOverlays(Coon_Rapids); centerByArray(Coon_Rapids, false, false); cntMarker += Coon_Rapids.length; map.addOverlays(Elk_River); centerByArray(Elk_River, false, false); cntMarker += Elk_River.length; map.addOverlays(Fridley); centerByArray(Fridley, false, false); cntMarker += Fridley.length; map.addOverlays(Saint_Francis); centerByArray(Saint_Francis, false, false); cntMarker += Saint_Francis.length; map.addOverlays(Spring_Lake_Park); centerByArray(Spring_Lake_Park, false, false); cntMarker += Spring_Lake_Park.length; centerByArray(Fridley,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=1&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; }