function addMarkers(){ mySelect = document.getElementById('selection'); Tucson = [];Glendale = [];Phoenix = [];Gilbert = [];Anthem = [];Tempe = [];Apache_Junction = [];Flagstaff = [];Chandler = [];Scottsdale = [];Litchfield_Park = [];Yuma = [];mySelect.options[mySelect.options.length] = new Option("Anthem schools",'all=Anthem'); mySelect.options[mySelect.options.length] = new Option("Apache Junction schools",'all=Apache_Junction'); mySelect.options[mySelect.options.length] = new Option("Chandler schools",'all=Chandler'); mySelect.options[mySelect.options.length] = new Option("Flagstaff schools",'all=Flagstaff'); mySelect.options[mySelect.options.length] = new Option("Gilbert schools",'all=Gilbert'); mySelect.options[mySelect.options.length] = new Option("Glendale schools",'all=Glendale'); mySelect.options[mySelect.options.length] = new Option("Litchfield Park schools",'all=Litchfield_Park'); mySelect.options[mySelect.options.length] = new Option("Phoenix schools",'all=Phoenix'); mySelect.options[mySelect.options.length] = new Option("Scottsdale schools",'all=Scottsdale'); mySelect.options[mySelect.options.length] = new Option("Tempe schools",'all=Tempe'); mySelect.options[mySelect.options.length] = new Option("Tucson schools",'all=Tucson'); mySelect.options[mySelect.options.length] = new Option("Yuma schools",'all=Yuma'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Tucson[Tucson.length] = createMarker(new GPoint(-110.99224200,32.35194100),"
Ascension Lutheran School
1220 W Magee Road
Tucson, AZ 85704
Co-ed school, PK-5
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Ascension Lutheran School",'Tucson=' + Tucson.length); Glendale[Glendale.length] = createMarker(new GPoint(-112.14578100,33.66904800),"
Atonement Lutheran School
4001 W Beardsley Road
Glendale, AZ 85308
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Atonement Lutheran School",'Glendale=' + Glendale.length); Phoenix[Phoenix.length] = createMarker(new GPoint(-111.99741700,33.49496300),"
Christ Lutheran School
3901 E Indian School Road
Phoenix, AZ 85018
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Christ Lutheran School",'Phoenix=' + Phoenix.length); Phoenix[Phoenix.length] = createMarker(new GPoint(-112.15143400,33.56534500),"
Christ The Redeemer Lutheran School
8801 N 43rd Avenue
Phoenix, AZ 85051
Co-ed school, PK-4
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Christ The Redeemer Lutheran School",'Phoenix=' + Phoenix.length); Gilbert[Gilbert.length] = createMarker(new GPoint(-111.73846700,33.35813700),"
Christ's Greenfield Lutheran School
425 N Greenfield Road
Gilbert, AZ 85234
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Christ's Greenfield Lutheran School",'Gilbert=' + Gilbert.length); Anthem[Anthem.length] = createMarker(new GPoint(-112.13662000,33.84561600),"
Cross of Christ Christian School
39808 N. Gavilan Peak Parkway
Anthem, AZ 85086
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Cross of Christ Christian School",'Anthem=' + Anthem.length); Tucson[Tucson.length] = createMarker(new GPoint(-110.90893900,32.22903700),"
Faith Lutheran School
3925 E 5th Street
Tucson, AZ 85711
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Faith Lutheran School",'Tucson=' + Tucson.length); Phoenix[Phoenix.length] = createMarker(new GPoint(-112.00906000,33.30495900),"
Family Of Christ Learning Center
3501 E Chandler Blvd
Phoenix, AZ 85048
school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Family Of Christ Learning Center",'Phoenix=' + Phoenix.length); Tucson[Tucson.length] = createMarker(new GPoint(-110.84122600,32.21283300),"
Fountain Of Life Lutheran School
710 South Kolb Road
Tucson, AZ 85710
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fountain Of Life Lutheran School",'Tucson=' + Tucson.length); Tempe[Tempe.length] = createMarker(new GPoint(-111.92479700,33.36366300),"
Gethsemane Lutheran School
1035 E Guadalupe Road
Tempe, AZ 85283
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Gethsemane Lutheran School",'Tempe=' + Tempe.length); Apache_Junction[Apache_Junction.length] = createMarker(new GPoint(-111.51161400,33.39610700),"
Mountain View Lutheran School
2122 S Goldfield Road
Apache Junction, AZ 85219
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Mountain View Lutheran School",'Apache_Junction=' + Apache_Junction.length); Flagstaff[Flagstaff.length] = createMarker(new GPoint(-111.61333100,35.22019600),"
Peace Lutheran Preschool Kindergarten
3430 N 4th Street
Flagstaff, AZ 86004
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Peace Lutheran Preschool Kindergarten",'Flagstaff=' + Flagstaff.length); Chandler[Chandler.length] = createMarker(new GPoint(-111.85853400,33.23039200),"
Risen Savior Lutheran Church And School
23914 S Alma School Road
Chandler, AZ 85248
Co-ed school, PK-1
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Risen Savior Lutheran Church And School",'Chandler=' + Chandler.length); Scottsdale[Scottsdale.length] = createMarker(new GPoint(-111.87428800,33.58273700),"
Shep. Of The Desert Luth School
9590 E Shea Blvd
Scottsdale, AZ 85260
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Shep. Of The Desert Luth School",'Scottsdale=' + Scottsdale.length); Phoenix[Phoenix.length] = createMarker(new GPoint(-112.19531100,33.49476300),"
St Paul Lutheran Preschool, Kdgn, & Day Care
6301 W Indian School Road
Phoenix, AZ 85033
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St Paul Lutheran Preschool, Kdgn, & Day Care",'Phoenix=' + Phoenix.length); Litchfield_Park[Litchfield_Park.length] = createMarker(new GPoint(-112.34333800,33.49271900),"
Trinity Lutheran School
830 E Plaza Circle
Litchfield Park, AZ 85340
Co-ed school, NS-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Trinity Lutheran School",'Litchfield_Park=' + Litchfield_Park.length); Phoenix[Phoenix.length] = createMarker(new GPoint(-112.08233400,33.51286300),"
Valley Lutheran High School
5199 N 7th Avenue
Phoenix, AZ 85013
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Valley Lutheran High School",'Phoenix=' + Phoenix.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.59423600,32.68135600),"
Yuma Lutheran School
2555 S Engler Avenue
Yuma, AZ 85365
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Yuma Lutheran School",'Yuma=' + Yuma.length); map.removeOverlays(Anthem); map.removeOverlays(Apache_Junction); map.removeOverlays(Chandler); map.removeOverlays(Flagstaff); map.removeOverlays(Gilbert); map.removeOverlays(Glendale); map.removeOverlays(Litchfield_Park); map.removeOverlays(Phoenix); map.removeOverlays(Scottsdale); map.removeOverlays(Tempe); map.removeOverlays(Tucson); map.removeOverlays(Yuma); setTimeout(function(){map.addOverlays(Anthem)},1000); setTimeout(function(){map.addOverlays(Apache_Junction)},1000); setTimeout(function(){map.addOverlays(Chandler)},1000); setTimeout(function(){map.addOverlays(Flagstaff)},1000); setTimeout(function(){map.addOverlays(Gilbert)},1000); setTimeout(function(){map.addOverlays(Glendale)},1000); setTimeout(function(){map.addOverlays(Litchfield_Park)},1000); setTimeout(function(){map.addOverlays(Phoenix)},1000); setTimeout(function(){map.addOverlays(Scottsdale)},1000); setTimeout(function(){map.addOverlays(Tempe)},1000); setTimeout(function(){map.addOverlays(Tucson)},1000); setTimeout(function(){map.addOverlays(Yuma)},1000); maxLng = -110.84122600; maxLat = 35.22019600; minLng = -114.59423600; minLat = 32.21283300; 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(Anthem); map.removeOverlays(Apache_Junction); map.removeOverlays(Chandler); map.removeOverlays(Flagstaff); map.removeOverlays(Gilbert); map.removeOverlays(Glendale); map.removeOverlays(Litchfield_Park); map.removeOverlays(Phoenix); map.removeOverlays(Scottsdale); map.removeOverlays(Tempe); map.removeOverlays(Tucson); map.removeOverlays(Yuma); 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(Tucson);map.removeOverlays(Anthem); map.removeOverlays(Apache_Junction); map.removeOverlays(Chandler); map.removeOverlays(Flagstaff); map.removeOverlays(Gilbert); map.removeOverlays(Glendale); map.removeOverlays(Litchfield_Park); map.removeOverlays(Phoenix); map.removeOverlays(Scottsdale); map.removeOverlays(Tempe); map.removeOverlays(Tucson); map.removeOverlays(Yuma); map.addOverlays(Anthem); centerByArray(Anthem, false, false); cntMarker += Anthem.length; map.addOverlays(Apache_Junction); centerByArray(Apache_Junction, false, false); cntMarker += Apache_Junction.length; map.addOverlays(Chandler); centerByArray(Chandler, false, false); cntMarker += Chandler.length; map.addOverlays(Flagstaff); centerByArray(Flagstaff, false, false); cntMarker += Flagstaff.length; map.addOverlays(Gilbert); centerByArray(Gilbert, false, false); cntMarker += Gilbert.length; map.addOverlays(Glendale); centerByArray(Glendale, false, false); cntMarker += Glendale.length; map.addOverlays(Litchfield_Park); centerByArray(Litchfield_Park, false, false); cntMarker += Litchfield_Park.length; map.addOverlays(Phoenix); centerByArray(Phoenix, false, false); cntMarker += Phoenix.length; map.addOverlays(Scottsdale); centerByArray(Scottsdale, false, false); cntMarker += Scottsdale.length; map.addOverlays(Tempe); centerByArray(Tempe, false, false); cntMarker += Tempe.length; map.addOverlays(Tucson); centerByArray(Tucson, false, false); cntMarker += Tucson.length; map.addOverlays(Yuma); centerByArray(Yuma, false, false); cntMarker += Yuma.length; centerByArray(Tucson,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///756,30667,32025,34927,647,538,33892,742,535,536,33346,716,682,571,512,562,567,765,/all'); //window.open('/map.php?type=2&schools=756,30667,32025,34927,647,538,33892,742,535,536,33346,716,682,571,512,562,567,765,&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; }