function addMarkers(){ mySelect = document.getElementById('selection'); Surprise = [];Glendale = [];Yuma = [];Lake_Havasu_City = [];Tucson = [];Prescott = [];Phoenix = [];Sierra_Vista = [];Gilbert = [];Kykotsmovi_Village = [];Mesa = [];Nogales = [];Marana = [];Chandler = [];mySelect.options[mySelect.options.length] = new Option("Chandler schools",'all=Chandler'); 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("Kykotsmovi Village schools",'all=Kykotsmovi_Village'); mySelect.options[mySelect.options.length] = new Option("Lake Havasu City schools",'all=Lake_Havasu_City'); mySelect.options[mySelect.options.length] = new Option("Marana schools",'all=Marana'); mySelect.options[mySelect.options.length] = new Option("Mesa schools",'all=Mesa'); mySelect.options[mySelect.options.length] = new Option("Nogales schools",'all=Nogales'); mySelect.options[mySelect.options.length] = new Option("Phoenix schools",'all=Phoenix'); mySelect.options[mySelect.options.length] = new Option("Prescott schools",'all=Prescott'); mySelect.options[mySelect.options.length] = new Option("Sierra Vista schools",'all=Sierra_Vista'); mySelect.options[mySelect.options.length] = new Option("Surprise schools",'all=Surprise'); 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("---------------------------",''); Surprise[Surprise.length] = createMarker(new GPoint(-112.43389800,33.63860700),"
Above And Beyond Childcare
17475 W Bell Road
Surprise, AZ 85374
Co-ed school, K-2
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Above And Beyond Childcare",'Surprise=' + Surprise.length); Glendale[Glendale.length] = createMarker(new GPoint(-112.14597100,33.66201000),"
Arrowhead Christian Academy
4030 W Yorkshire Drive
Glendale, AZ 85308
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Arrowhead Christian Academy",'Glendale=' + Glendale.length); Yuma[Yuma.length] = createMarker(new GPoint(-114.62052700,32.68016000),"
Calvary Baptist Church School
101 W 26th Street
Yuma, AZ 85364
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Calvary Baptist Church School",'Yuma=' + Yuma.length); Lake_Havasu_City[Lake_Havasu_City.length] = createMarker(new GPoint(-114.25906800,34.45874400),"
Calvary Christian Academy
1605 Mcculloch Blvd S
Lake Havasu City, AZ 86406
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Calvary Christian Academy",'Lake_Havasu_City=' + Lake_Havasu_City.length); Tucson[Tucson.length] = createMarker(new GPoint(-111.01299100,32.40792000),"
Casas Adobes Baptist School
10801 N La Cholla Blvd
Tucson, AZ 85742
Co-ed school, K-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Casas Adobes Baptist School",'Tucson=' + Tucson.length); Tucson[Tucson.length] = createMarker(new GPoint(-111.01986800,32.15285900),"
Chapel In The Hills Preschool
5455 S Westover Ave
Tucson, AZ 85746
Co-ed school, PK-2
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Chapel In The Hills Preschool",'Tucson=' + Tucson.length); Prescott[Prescott.length] = createMarker(new GPoint(-112.46750600,34.54054100),"
Christian Academy Of Prescott
148 S Marina Street
Prescott, AZ 86303
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Christian Academy Of Prescott",'Prescott=' + Prescott.length); Tucson[Tucson.length] = createMarker(new GPoint(-111.27039000,32.04981900),"
Faith Baptist Academy
11080 S Brandywine Lane
Tucson, AZ 85736
Co-ed school, 5-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Faith Baptist Academy",'Tucson=' + Tucson.length); Phoenix[Phoenix.length] = createMarker(new GPoint(-112.07396400,33.53843700),"
First Baptist Childrens Center
7000 N Central Avenue
Phoenix, AZ 85020
Co-ed school, K-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("First Baptist Childrens Center",'Phoenix=' + Phoenix.length); Sierra_Vista[Sierra_Vista.length] = createMarker(new GPoint(-110.29113800,31.53880900),"
First Baptist Christian Academy
1447 S 7th Street
Sierra Vista, AZ 85635
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("First Baptist Christian Academy",'Sierra_Vista=' + Sierra_Vista.length); Tucson[Tucson.length] = createMarker(new GPoint(-110.96461700,32.23608900),"
First Southern Christian School
445 E Speedway Blvd
Tucson, AZ 85705
Co-ed school, PK-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("First Southern Christian School",'Tucson=' + Tucson.length); Gilbert[Gilbert.length] = createMarker(new GPoint(-111.78203600,33.31023700),"
Gateway Baptist Academy
13792 E Pony Lane
Gilbert, AZ 85296
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Gateway Baptist Academy",'Gilbert=' + Gilbert.length); Gilbert[Gilbert.length] = createMarker(new GPoint(-111.77068700,33.36387100),"
Heritage Christian Academy
919 E Guadalupe Road
Gilbert, AZ 85234
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Heritage Christian Academy",'Gilbert=' + Gilbert.length); Kykotsmovi_Village[Kykotsmovi_Village.length] = createMarker(new GPoint(-110.47690000,35.63890000),"
Hopi Mission School
Po Box 39
Kykotsmovi Village, AZ 86039
Co-ed school, 1-6
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Hopi Mission School",'Kykotsmovi_Village=' + Kykotsmovi_Village.length); Phoenix[Phoenix.length] = createMarker(new GPoint(-112.05640300,33.52762400),"
Madison Christian Children's Center
6202 N 12th Street
Phoenix, AZ 85014
Co-ed school, PK-7
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Madison Christian Children's Center",'Phoenix=' + Phoenix.length); Phoenix[Phoenix.length] = createMarker(new GPoint(-112.06750000,33.39240000),"
Pleasantview Christian Elementary School
Po Box 8459
Phoenix, AZ 85066
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Pleasantview Christian Elementary School",'Phoenix=' + Phoenix.length); Mesa[Mesa.length] = createMarker(new GPoint(-111.68442300,33.44109100),"
Saguaro Hills Christian School
1402 N Power Road
Mesa, AZ 85205
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Saguaro Hills Christian School",'Mesa=' + Mesa.length); Nogales[Nogales.length] = createMarker(new GPoint(-110.95131900,31.36708400),"
Sonshine Christian Preschool And Kindergarten
1916 North Frank Reed Road
Nogales, AZ 85621
Co-ed school, PK-K
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sonshine Christian Preschool And Kindergarten",'Nogales=' + Nogales.length); Marana[Marana.length] = createMarker(new GPoint(-111.15268600,32.40245900),"
Sun & Shield Christian Academy
8811 West Avra Valley Road
Marana, AZ 85653
Co-ed school, K-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Sun & Shield Christian Academy",'Marana=' + Marana.length); Chandler[Chandler.length] = createMarker(new GPoint(-111.87937600,33.27592500),"
Tri-city Christian Academy
2211 W Germann Rd
Chandler, AZ 85286
Co-ed school, PK-12
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tri-city Christian Academy",'Chandler=' + Chandler.length); Mesa[Mesa.length] = createMarker(new GPoint(-111.78534600,33.42283700),"
Trinity Preschool And Kindergarten
2130 E University Drive
Mesa, AZ 85213
Co-ed school, NS-PK
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Trinity Preschool And Kindergarten",'Mesa=' + Mesa.length); Tucson[Tucson.length] = createMarker(new GPoint(-110.87540500,32.25872700),"
Tucson Christian School
2855 N Craycroft Rd
Tucson, AZ 85712
Co-ed school, PK-8
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Tucson Christian School",'Tucson=' + Tucson.length); Tucson[Tucson.length] = createMarker(new GPoint(-110.93751700,32.01333400),"
Verde Heights Christian Preschool
12961 S. Old Nogales Hwy
Tucson, AZ 85706
Co-ed school, PK-3
[ View School Profile ]
",iconGr); mySelect.options[mySelect.options.length] = new Option("Verde Heights Christian Preschool",'Tucson=' + Tucson.length); map.removeOverlays(Chandler); map.removeOverlays(Gilbert); map.removeOverlays(Glendale); map.removeOverlays(Kykotsmovi_Village); map.removeOverlays(Lake_Havasu_City); map.removeOverlays(Marana); map.removeOverlays(Mesa); map.removeOverlays(Nogales); map.removeOverlays(Phoenix); map.removeOverlays(Prescott); map.removeOverlays(Sierra_Vista); map.removeOverlays(Surprise); map.removeOverlays(Tucson); map.removeOverlays(Yuma); setTimeout(function(){map.addOverlays(Chandler)},1000); setTimeout(function(){map.addOverlays(Gilbert)},1000); setTimeout(function(){map.addOverlays(Glendale)},1000); setTimeout(function(){map.addOverlays(Kykotsmovi_Village)},1000); setTimeout(function(){map.addOverlays(Lake_Havasu_City)},1000); setTimeout(function(){map.addOverlays(Marana)},1000); setTimeout(function(){map.addOverlays(Mesa)},1000); setTimeout(function(){map.addOverlays(Nogales)},1000); setTimeout(function(){map.addOverlays(Phoenix)},1000); setTimeout(function(){map.addOverlays(Prescott)},1000); setTimeout(function(){map.addOverlays(Sierra_Vista)},1000); setTimeout(function(){map.addOverlays(Surprise)},1000); setTimeout(function(){map.addOverlays(Tucson)},1000); setTimeout(function(){map.addOverlays(Yuma)},1000); maxLng = -110.29113800; maxLat = 35.63890000; minLng = -114.62052700; minLat = 31.36708400; 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(Gilbert); map.removeOverlays(Glendale); map.removeOverlays(Kykotsmovi_Village); map.removeOverlays(Lake_Havasu_City); map.removeOverlays(Marana); map.removeOverlays(Mesa); map.removeOverlays(Nogales); map.removeOverlays(Phoenix); map.removeOverlays(Prescott); map.removeOverlays(Sierra_Vista); map.removeOverlays(Surprise); 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(Surprise);map.removeOverlays(Chandler); map.removeOverlays(Gilbert); map.removeOverlays(Glendale); map.removeOverlays(Kykotsmovi_Village); map.removeOverlays(Lake_Havasu_City); map.removeOverlays(Marana); map.removeOverlays(Mesa); map.removeOverlays(Nogales); map.removeOverlays(Phoenix); map.removeOverlays(Prescott); map.removeOverlays(Sierra_Vista); map.removeOverlays(Surprise); map.removeOverlays(Tucson); map.removeOverlays(Yuma); map.addOverlays(Chandler); centerByArray(Chandler, false, false); cntMarker += Chandler.length; map.addOverlays(Gilbert); centerByArray(Gilbert, false, false); cntMarker += Gilbert.length; map.addOverlays(Glendale); centerByArray(Glendale, false, false); cntMarker += Glendale.length; map.addOverlays(Kykotsmovi_Village); centerByArray(Kykotsmovi_Village, false, false); cntMarker += Kykotsmovi_Village.length; map.addOverlays(Lake_Havasu_City); centerByArray(Lake_Havasu_City, false, false); cntMarker += Lake_Havasu_City.length; map.addOverlays(Marana); centerByArray(Marana, false, false); cntMarker += Marana.length; map.addOverlays(Mesa); centerByArray(Mesa, false, false); cntMarker += Mesa.length; map.addOverlays(Nogales); centerByArray(Nogales, false, false); cntMarker += Nogales.length; map.addOverlays(Phoenix); centerByArray(Phoenix, false, false); cntMarker += Phoenix.length; map.addOverlays(Prescott); centerByArray(Prescott, false, false); cntMarker += Prescott.length; map.addOverlays(Sierra_Vista); centerByArray(Sierra_Vista, false, false); cntMarker += Sierra_Vista.length; map.addOverlays(Surprise); centerByArray(Surprise, false, false); cntMarker += Surprise.length; map.addOverlays(Tucson); centerByArray(Tucson, false, false); cntMarker += Tucson.length; map.addOverlays(Yuma); centerByArray(Yuma, false, false); cntMarker += Yuma.length; centerByArray(Surprise,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///33252,570,33249,521,725,33251,520,33252,570,36166,33249,594,521,725,33251,741,33349,563,34223,660,33343,564,32031,527,777,30732,565,744,834,520,/all'); //window.open('/map.php?type=2&schools=33252,570,33249,521,725,33251,520,33252,570,36166,33249,594,521,725,33251,741,33349,563,34223,660,33343,564,32031,527,777,30732,565,744,834,520,&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; }