function addMarkers(){ mySelect = document.getElementById('selection'); Tucson = [];Scottsdale = [];Glendale = [];Sedona = [];Mayer = [];Phoenix = [];Chandler = [];Rimrock = [];mySelect.options[mySelect.options.length] = new Option("Chandler schools",'all=Chandler'); mySelect.options[mySelect.options.length] = new Option("Glendale schools",'all=Glendale'); mySelect.options[mySelect.options.length] = new Option("Mayer schools",'all=Mayer'); mySelect.options[mySelect.options.length] = new Option("Phoenix schools",'all=Phoenix'); mySelect.options[mySelect.options.length] = new Option("Rimrock schools",'all=Rimrock'); mySelect.options[mySelect.options.length] = new Option("Scottsdale schools",'all=Scottsdale'); mySelect.options[mySelect.options.length] = new Option("Sedona schools",'all=Sedona'); mySelect.options[mySelect.options.length] = new Option("Tucson schools",'all=Tucson'); mySelect.options[mySelect.options.length] = new Option("---------------------------",''); Tucson[Tucson.length] = createMarker(new GPoint(-110.81207000,32.22025800),"
Desert Trail School
8425 E Old Spanish Tr
Tucson, AZ 85710
Co-ed school, PK-KG
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Desert Trail School",'Tucson=' + Tucson.length); Tucson[Tucson.length] = createMarker(new GPoint(-110.81388400,32.30155100),"
Fenster School
8500 E Ocotillo Drive
Tucson, AZ 85750
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Fenster School",'Tucson=' + Tucson.length); Scottsdale[Scottsdale.length] = createMarker(new GPoint(-111.88616500,33.58468100),"
Hand In Hand Of Scottsdale
10850 N 90th St
Scottsdale, AZ 85260
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hand In Hand Of Scottsdale",'Scottsdale=' + Scottsdale.length); Tucson[Tucson.length] = createMarker(new GPoint(-110.95176100,32.21645100),"
Highland Free School
510 S Highland Ave
Tucson, AZ 85719
Co-ed school, K-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Highland Free School",'Tucson=' + Tucson.length); Tucson[Tucson.length] = createMarker(new GPoint(-110.98440000,32.33470000),"
Immaculate Heart Academy
410 E Magee Rd
Tucson, AZ 85704
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Immaculate Heart Academy",'Tucson=' + Tucson.length); Tucson[Tucson.length] = createMarker(new GPoint(-110.96263400,32.35203700),"
Immaculate Heart School
625 E. Magee Rd
Tucson, AZ 85704
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Immaculate Heart School",'Tucson=' + Tucson.length); Glendale[Glendale.length] = createMarker(new GPoint(-112.20273400,33.67009800),"
Kindercare Learning Center
20245 North 67th Avenue
Glendale, AZ 85308
Co-ed school, K-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Kindercare Learning Center",'Glendale=' + Glendale.length); Sedona[Sedona.length] = createMarker(new GPoint(-111.78670000,34.85800000),"
Oak Creek Ranch School
Po Box 4329
Sedona, AZ 86340
Co-ed school, 8-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Oak Creek Ranch School",'Sedona=' + Sedona.length); Mayer[Mayer.length] = createMarker(new GPoint(-112.15059200,34.34842300),"
The Orme School Of Arizona
Hc 63 Box 3040 1000 Orme School Road
Mayer, AZ 86333
Co-ed school, 6-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("The Orme School Of Arizona",'Mayer=' + Mayer.length); Phoenix[Phoenix.length] = createMarker(new GPoint(-112.09751500,33.55296300),"
Phoenix Special Programs & Academy
1717 W Northern Ave Suite 104
Phoenix, AZ 85021
Co-ed school, 7-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Phoenix Special Programs & Academy",'Phoenix=' + Phoenix.length); Chandler[Chandler.length] = createMarker(new GPoint(-111.84670200,33.31355100),"
St. Mary-Basha Catholic School
200 West Galveston St
Chandler, AZ 85225
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("St. Mary-Basha Catholic School",'Chandler=' + Chandler.length); Phoenix[Phoenix.length] = createMarker(new GPoint(-112.02443400,33.48752200),"
St. Paul's Academy
2645 E Osborn Rd
Phoenix, AZ 85016
All-boys school, 8-12
[ View School Profile ]
",iconBl); mySelect.options[mySelect.options.length] = new Option("St. Paul's Academy",'Phoenix=' + Phoenix.length); Rimrock[Rimrock.length] = createMarker(new GPoint(-111.78029700,34.64187600),"
Southwestern Academy
Hc 64 Box 235
Rimrock, AZ 86335
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Southwestern Academy",'Rimrock=' + Rimrock.length); Tucson[Tucson.length] = createMarker(new GPoint(-110.92214200,32.26324100),"
Tucson Waldorf School
3349 E Presidio Road
Tucson, AZ 85716
Co-ed school, NS-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tucson Waldorf School",'Tucson=' + Tucson.length); Sedona[Sedona.length] = createMarker(new GPoint(-111.79905900,34.80543400),"
Verde Valley School
3511 Verde Valley School Road
Sedona, AZ 86351
Co-ed school, 9-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Verde Valley School",'Sedona=' + Sedona.length); map.removeOverlays(Chandler); map.removeOverlays(Glendale); map.removeOverlays(Mayer); map.removeOverlays(Phoenix); map.removeOverlays(Rimrock); map.removeOverlays(Scottsdale); map.removeOverlays(Sedona); map.removeOverlays(Tucson); setTimeout(function(){map.addOverlays(Chandler)},1000); setTimeout(function(){map.addOverlays(Glendale)},1000); setTimeout(function(){map.addOverlays(Mayer)},1000); setTimeout(function(){map.addOverlays(Phoenix)},1000); setTimeout(function(){map.addOverlays(Rimrock)},1000); setTimeout(function(){map.addOverlays(Scottsdale)},1000); setTimeout(function(){map.addOverlays(Sedona)},1000); setTimeout(function(){map.addOverlays(Tucson)},1000); maxLng = -110.81207000; maxLat = 34.85800000; minLng = -112.20273400; minLat = 32.21645100; 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(Chandler); map.removeOverlays(Glendale); map.removeOverlays(Mayer); map.removeOverlays(Phoenix); map.removeOverlays(Rimrock); map.removeOverlays(Scottsdale); map.removeOverlays(Sedona); map.removeOverlays(Tucson); 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(Chandler); map.removeOverlays(Glendale); map.removeOverlays(Mayer); map.removeOverlays(Phoenix); map.removeOverlays(Rimrock); map.removeOverlays(Scottsdale); map.removeOverlays(Sedona); map.removeOverlays(Tucson); map.addOverlays(Chandler); centerByArray(Chandler, false, false); cntMarker += Chandler.length; map.addOverlays(Glendale); centerByArray(Glendale, false, false); cntMarker += Glendale.length; map.addOverlays(Mayer); centerByArray(Mayer, false, false); cntMarker += Mayer.length; map.addOverlays(Phoenix); centerByArray(Phoenix, false, false); cntMarker += Phoenix.length; map.addOverlays(Rimrock); centerByArray(Rimrock, false, false); cntMarker += Rimrock.length; map.addOverlays(Scottsdale); centerByArray(Scottsdale, false, false); cntMarker += Scottsdale.length; map.addOverlays(Sedona); centerByArray(Sedona, false, false); cntMarker += Sedona.length; map.addOverlays(Tucson); centerByArray(Tucson, false, false); cntMarker += Tucson.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///737,656,717,634,738,35798,598,791,724,800,737,688,586,786,590,597,598,791,/all'); //window.open('/map.php?type=2&schools=737,656,717,634,738,35798,598,791,724,800,737,688,586,786,590,597,598,791,&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; }