function addMarkers()
{
mySelect = document.getElementById('selection');
Douglas = [];Portal = [];Sierra_Vista = [];Pearce = [];Phoenix = [];Benson = [];Bisbee = [];Willcox = [];Elfrida = [];Bowie = [];El_Frida = [];Cochise = [];Ft_Huachuca = [];Hereford = [];Mcneal = [];Tombstone = [];Naco = [];Pomerene = [];Tucson = [];St_David = [];San_Simon = [];mySelect.options[mySelect.options.length] = new Option("Benson schools",'all=Benson');
mySelect.options[mySelect.options.length] = new Option("Bisbee schools",'all=Bisbee');
mySelect.options[mySelect.options.length] = new Option("Bowie schools",'all=Bowie');
mySelect.options[mySelect.options.length] = new Option("Cochise schools",'all=Cochise');
mySelect.options[mySelect.options.length] = new Option("Douglas schools",'all=Douglas');
mySelect.options[mySelect.options.length] = new Option("El Frida schools",'all=El_Frida');
mySelect.options[mySelect.options.length] = new Option("Elfrida schools",'all=Elfrida');
mySelect.options[mySelect.options.length] = new Option("Ft Huachuca schools",'all=Ft_Huachuca');
mySelect.options[mySelect.options.length] = new Option("Hereford schools",'all=Hereford');
mySelect.options[mySelect.options.length] = new Option("Mcneal schools",'all=Mcneal');
mySelect.options[mySelect.options.length] = new Option("Naco schools",'all=Naco');
mySelect.options[mySelect.options.length] = new Option("Pearce schools",'all=Pearce');
mySelect.options[mySelect.options.length] = new Option("Phoenix schools",'all=Phoenix');
mySelect.options[mySelect.options.length] = new Option("Pomerene schools",'all=Pomerene');
mySelect.options[mySelect.options.length] = new Option("Portal schools",'all=Portal');
mySelect.options[mySelect.options.length] = new Option("San Simon schools",'all=San_Simon');
mySelect.options[mySelect.options.length] = new Option("Sierra Vista schools",'all=Sierra_Vista');
mySelect.options[mySelect.options.length] = new Option("St David schools",'all=St_David');
mySelect.options[mySelect.options.length] = new Option("Tombstone schools",'all=Tombstone');
mySelect.options[mySelect.options.length] = new Option("Tucson schools",'all=Tucson');
mySelect.options[mySelect.options.length] = new Option("Willcox schools",'all=Willcox');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Douglas[Douglas.length] = createMarker(new GPoint(-109.43530273,31.45800018),"
",iconRd);
mySelect.options[mySelect.options.length] = new Option("A Avenue Elementary School",'Douglas=' + Douglas.length);
Portal[Portal.length] = createMarker(new GPoint(-109.34040070,32.20050049),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Apache Elementary School",'Portal=' + Portal.length);
Sierra_Vista[Sierra_Vista.length] = createMarker(new GPoint(-110.26235962,31.55473709),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Apache Middle School",'Sierra_Vista=' + Sierra_Vista.length);
Pearce[Pearce.length] = createMarker(new GPoint(-109.63798523,31.87639999),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Ash Creek Elementary School",'Pearce=' + Pearce.length);
Phoenix[Phoenix.length] = createMarker(new GPoint(-112.13844200,33.47670000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Aspc - Douglas/a.c.i.",'Phoenix=' + Phoenix.length);
Sierra_Vista[Sierra_Vista.length] = createMarker(new GPoint(-110.26059723,31.56049919),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bella Vista Elementary School",'Sierra_Vista=' + Sierra_Vista.length);
Benson[Benson.length] = createMarker(new GPoint(-110.29822540,31.96608162),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Benson High School",'Benson=' + Benson.length);
Benson[Benson.length] = createMarker(new GPoint(-110.29822540,31.96608162),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Benson Middle School",'Benson=' + Benson.length);
Benson[Benson.length] = createMarker(new GPoint(-110.29822540,31.96608162),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Benson Primary School",'Benson=' + Benson.length);
Sierra_Vista[Sierra_Vista.length] = createMarker(new GPoint(-110.27467900,31.56945000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Berean Schools",'Sierra_Vista=' + Sierra_Vista.length);
Sierra_Vista[Sierra_Vista.length] = createMarker(new GPoint(-110.26059723,31.56049919),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Berean Schools Elementary School",'Sierra_Vista=' + Sierra_Vista.length);
Bisbee[Bisbee.length] = createMarker(new GPoint(-109.88417816,31.42804909),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bisbee High School",'Bisbee=' + Bisbee.length);
Bisbee[Bisbee.length] = createMarker(new GPoint(-109.88417816,31.42804909),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Bisbee Middle School",'Bisbee=' + Bisbee.length);
Willcox[Willcox.length] = createMarker(new GPoint(-109.96909332,32.58990097),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bonita Elementary School",'Willcox=' + Willcox.length);
Elfrida[Elfrida.length] = createMarker(new GPoint(-109.48650360,32.32540131),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bowie Elementary School",'Elfrida=' + Elfrida.length);
Bowie[Bowie.length] = createMarker(new GPoint(-109.48690900,32.32669500),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bowie Elementary School",'Bowie=' + Bowie.length);
El_Frida[El_Frida.length] = createMarker(new GPoint(-109.52940369,31.74160004),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bowie High School",'El_Frida=' + El_Frida.length);
Bowie[Bowie.length] = createMarker(new GPoint(-109.48650360,32.32540131),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bowie High School",'Bowie=' + Bowie.length);
Sierra_Vista[Sierra_Vista.length] = createMarker(new GPoint(-110.26235962,31.55473709),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Buena High School",'Sierra_Vista=' + Sierra_Vista.length);
Sierra_Vista[Sierra_Vista.length] = createMarker(new GPoint(-110.26235962,31.55473709),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Carmichael Elementary School",'Sierra_Vista=' + Sierra_Vista.length);
Douglas[Douglas.length] = createMarker(new GPoint(-109.55213400,31.34444400),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Center For Academic Success #4",'Douglas=' + Douglas.length);
Sierra_Vista[Sierra_Vista.length] = createMarker(new GPoint(-110.27467900,31.56945000),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Center For Academic Success #5",'Sierra_Vista=' + Sierra_Vista.length);
Sierra_Vista[Sierra_Vista.length] = createMarker(new GPoint(-110.29238892,31.55216217),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Center For Academic Success, #1",'Sierra_Vista=' + Sierra_Vista.length);
Douglas[Douglas.length] = createMarker(new GPoint(-109.55467987,31.33950043),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Center For Academic Success, #2",'Douglas=' + Douglas.length);
Douglas[Douglas.length] = createMarker(new GPoint(-109.55446625,31.33927727),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Center For Academic Success, #2 (charter)",'Douglas=' + Douglas.length);
Douglas[Douglas.length] = createMarker(new GPoint(-109.54553986,31.34445953),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Center For Academic Success, #3",'Douglas=' + Douglas.length);
Phoenix[Phoenix.length] = createMarker(new GPoint(-110.25505829,31.53574181),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Chancellor Charter School At Sierra Vista",'Phoenix=' + Phoenix.length);
Douglas[Douglas.length] = createMarker(new GPoint(-109.43530273,31.45800018),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Clawson School",'Douglas=' + Douglas.length);
Cochise[Cochise.length] = createMarker(new GPoint(-109.92500305,32.08800125),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Cochise Elementary School",'Cochise=' + Cochise.length);
Ft_Huachuca[Ft_Huachuca.length] = createMarker(new GPoint(-110.22989655,31.55050087),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Colonel Johnston Elementary School",'Ft_Huachuca=' + Ft_Huachuca.length);
Ft_Huachuca[Ft_Huachuca.length] = createMarker(new GPoint(-110.22989655,31.55050087),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Colonel Smith Middle School",'Ft_Huachuca=' + Ft_Huachuca.length);
Hereford[Hereford.length] = createMarker(new GPoint(-110.20320129,31.42239952),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Coronado Elementary School",'Hereford=' + Hereford.length);
Mcneal[Mcneal.length] = createMarker(new GPoint(-109.69812012,31.46337509),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Double Adobe Elementary School",'Mcneal=' + Mcneal.length);
Douglas[Douglas.length] = createMarker(new GPoint(-109.43530273,31.45800018),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Douglas East Campus High School",'Douglas=' + Douglas.length);
Douglas[Douglas.length] = createMarker(new GPoint(-109.43530273,31.45800018),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Douglas High School",'Douglas=' + Douglas.length);
Douglas[Douglas.length] = createMarker(new GPoint(-109.43530273,31.45800018),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Early Learning Center",'Douglas=' + Douglas.length);
Elfrida[Elfrida.length] = createMarker(new GPoint(-109.52940369,31.74160004),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Elfrida Elementary School",'Elfrida=' + Elfrida.length);
Douglas[Douglas.length] = createMarker(new GPoint(-109.43530273,31.45800018),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Faras Elementary School",'Douglas=' + Douglas.length);
Ft_Huachuca[Ft_Huachuca.length] = createMarker(new GPoint(-110.22989655,31.55050087),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("General Myer Elementary School",'Ft_Huachuca=' + Ft_Huachuca.length);
Bisbee[Bisbee.length] = createMarker(new GPoint(-109.88417816,31.42804909),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Greenway Primary School",'Bisbee=' + Bisbee.length);
Tombstone[Tombstone.length] = createMarker(new GPoint(-110.33370209,31.68709946),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Huachuca City School",'Tombstone=' + Tombstone.length);
Sierra_Vista[Sierra_Vista.length] = createMarker(new GPoint(-110.26235962,31.55473709),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Huachuca Mountain Elementary School",'Sierra_Vista=' + Sierra_Vista.length);
Douglas[Douglas.length] = createMarker(new GPoint(-109.43530273,31.45800018),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Joe Carlson Elementary School",'Douglas=' + Douglas.length);
Bisbee[Bisbee.length] = createMarker(new GPoint(-109.88417816,31.42804909),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Lowell School",'Bisbee=' + Bisbee.length);
Douglas[Douglas.length] = createMarker(new GPoint(-109.43530273,31.45800018),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Maryvale School",'Douglas=' + Douglas.length);
Mcneal[Mcneal.length] = createMarker(new GPoint(-109.70050049,31.52939987),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mcneal Elementary School",'Mcneal=' + Mcneal.length);
Naco[Naco.length] = createMarker(new GPoint(-109.94789886,31.33760071),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Naco Elementary School",'Naco=' + Naco.length);
Sierra_Vista[Sierra_Vista.length] = createMarker(new GPoint(-110.29929352,31.55233765),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Omega Alpha Academy School",'Sierra_Vista=' + Sierra_Vista.length);
Douglas[Douglas.length] = createMarker(new GPoint(-109.54660034,31.38389969),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Omega Alpha Academy School",'Douglas=' + Douglas.length);
Hereford[Hereford.length] = createMarker(new GPoint(-110.20320129,31.42239952),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Palominas Elementary School",'Hereford=' + Hereford.length);
Douglas[Douglas.length] = createMarker(new GPoint(-109.43530273,31.45800018),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Paul H Huber Junior High School",'Douglas=' + Douglas.length);
Pearce[Pearce.length] = createMarker(new GPoint(-109.81888580,31.89559555),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pearce Elementary School",'Pearce=' + Pearce.length);
Pomerene[Pomerene.length] = createMarker(new GPoint(-110.27469635,32.07799911),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pomerene Elementary School",'Pomerene=' + Pomerene.length);
Tucson[Tucson.length] = createMarker(new GPoint(-110.25900269,31.56250000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ppep Tec - Colin L. Powell Learning Center",'Tucson=' + Tucson.length);
Tucson[Tucson.length] = createMarker(new GPoint(-109.84156036,32.26123428),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ppep Tec - Eugene Lopez Learning Center",'Tucson=' + Tucson.length);
Tucson[Tucson.length] = createMarker(new GPoint(-109.88756561,31.42278671),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ppep Tec - Manuel Borjorquez Learning Center",'Tucson=' + Tucson.length);
Tucson[Tucson.length] = createMarker(new GPoint(-109.55389404,31.34657478),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ppep Tec - Raul H. Castro Learning Center",'Tucson=' + Tucson.length);
Sierra_Vista[Sierra_Vista.length] = createMarker(new GPoint(-110.26235962,31.55473709),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pueblo Del Sol Elementary School",'Sierra_Vista=' + Sierra_Vista.length);
Douglas[Douglas.length] = createMarker(new GPoint(-109.43530273,31.45800018),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Ray Borane Middle School",'Douglas=' + Douglas.length);
St_David[St_David.length] = createMarker(new GPoint(-109.52940369,31.74160004),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Saint David High School",'St_David=' + St_David.length);
Benson[Benson.length] = createMarker(new GPoint(-110.29783100,31.96697400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("San Pedro Valley High School",'Benson=' + Benson.length);
San_Simon[San_Simon.length] = createMarker(new GPoint(-109.52940369,31.74160004),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("San Simon High School",'San_Simon=' + San_Simon.length);
San_Simon[San_Simon.length] = createMarker(new GPoint(-109.22734500,32.26609000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("San Simon School",'San_Simon=' + San_Simon.length);
Douglas[Douglas.length] = createMarker(new GPoint(-109.43530273,31.45800018),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sarah Marley School",'Douglas=' + Douglas.length);
Hereford[Hereford.length] = createMarker(new GPoint(-110.20320129,31.42239952),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sierra Summit Academy",'Hereford=' + Hereford.length);
Sierra_Vista[Sierra_Vista.length] = createMarker(new GPoint(-110.28251648,31.54349136),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Sierra Vista Middle School",'Sierra_Vista=' + Sierra_Vista.length);
St_David[St_David.length] = createMarker(new GPoint(-110.21929932,31.89089966),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("St David Elementary School",'St_David=' + St_David.length);
St_David[St_David.length] = createMarker(new GPoint(-110.21929932,31.89089966),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("St David High School",'St_David=' + St_David.length);
Douglas[Douglas.length] = createMarker(new GPoint(-109.43530273,31.45800018),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Stevenson Elementary School",'Douglas=' + Douglas.length);
Elfrida[Elfrida.length] = createMarker(new GPoint(-109.52940369,31.74160004),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Tombstone High School",'Elfrida=' + Elfrida.length);
Tombstone[Tombstone.length] = createMarker(new GPoint(-110.06120300,31.72229958),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Tombstone High School",'Tombstone=' + Tombstone.length);
Sierra_Vista[Sierra_Vista.length] = createMarker(new GPoint(-110.26235962,31.55473709),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Town & Country Elementary School",'Sierra_Vista=' + Sierra_Vista.length);
Elfrida[Elfrida.length] = createMarker(new GPoint(-109.52940369,31.74160004),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Valley Union High School",'Elfrida=' + Elfrida.length);
Hereford[Hereford.length] = createMarker(new GPoint(-110.20320129,31.42239952),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Valley View Elementary School",'Hereford=' + Hereford.length);
Sierra_Vista[Sierra_Vista.length] = createMarker(new GPoint(-110.26235962,31.55473709),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Village Meadows Elementary School",'Sierra_Vista=' + Sierra_Vista.length);
Benson[Benson.length] = createMarker(new GPoint(-110.26915741,31.97069931),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Visions Unlimited Academy",'Benson=' + Benson.length);
Tombstone[Tombstone.length] = createMarker(new GPoint(-110.06120300,31.72229958),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Walter J Meyer School",'Tombstone=' + Tombstone.length);
Willcox[Willcox.length] = createMarker(new GPoint(-109.83517456,32.25709152),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Willcox Elementary School",'Willcox=' + Willcox.length);
Willcox[Willcox.length] = createMarker(new GPoint(-109.84149933,32.25618362),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Willcox High School",'Willcox=' + Willcox.length);
Willcox[Willcox.length] = createMarker(new GPoint(-109.84156036,32.25776291),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Willcox Middle School",'Willcox=' + Willcox.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,10);
/*
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(Benson);
map.removeOverlays(Bisbee);
map.removeOverlays(Bowie);
map.removeOverlays(Cochise);
map.removeOverlays(Douglas);
map.removeOverlays(El_Frida);
map.removeOverlays(Elfrida);
map.removeOverlays(Ft_Huachuca);
map.removeOverlays(Hereford);
map.removeOverlays(Mcneal);
map.removeOverlays(Naco);
map.removeOverlays(Pearce);
map.removeOverlays(Phoenix);
map.removeOverlays(Pomerene);
map.removeOverlays(Portal);
map.removeOverlays(San_Simon);
map.removeOverlays(Sierra_Vista);
map.removeOverlays(St_David);
map.removeOverlays(Tombstone);
map.removeOverlays(Tucson);
map.removeOverlays(Willcox);
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(Douglas);map.removeOverlays(Benson);
map.removeOverlays(Bisbee);
map.removeOverlays(Bowie);
map.removeOverlays(Cochise);
map.removeOverlays(Douglas);
map.removeOverlays(El_Frida);
map.removeOverlays(Elfrida);
map.removeOverlays(Ft_Huachuca);
map.removeOverlays(Hereford);
map.removeOverlays(Mcneal);
map.removeOverlays(Naco);
map.removeOverlays(Pearce);
map.removeOverlays(Phoenix);
map.removeOverlays(Pomerene);
map.removeOverlays(Portal);
map.removeOverlays(San_Simon);
map.removeOverlays(Sierra_Vista);
map.removeOverlays(St_David);
map.removeOverlays(Tombstone);
map.removeOverlays(Tucson);
map.removeOverlays(Willcox);
map.addOverlays(Benson);
centerByArray(Benson, false, false);
cntMarker += Benson.length;
map.addOverlays(Bisbee);
centerByArray(Bisbee, false, false);
cntMarker += Bisbee.length;
map.addOverlays(Bowie);
centerByArray(Bowie, false, false);
cntMarker += Bowie.length;
map.addOverlays(Cochise);
centerByArray(Cochise, false, false);
cntMarker += Cochise.length;
map.addOverlays(Douglas);
centerByArray(Douglas, false, false);
cntMarker += Douglas.length;
map.addOverlays(El_Frida);
centerByArray(El_Frida, false, false);
cntMarker += El_Frida.length;
map.addOverlays(Elfrida);
centerByArray(Elfrida, false, false);
cntMarker += Elfrida.length;
map.addOverlays(Ft_Huachuca);
centerByArray(Ft_Huachuca, false, false);
cntMarker += Ft_Huachuca.length;
map.addOverlays(Hereford);
centerByArray(Hereford, false, false);
cntMarker += Hereford.length;
map.addOverlays(Mcneal);
centerByArray(Mcneal, false, false);
cntMarker += Mcneal.length;
map.addOverlays(Naco);
centerByArray(Naco, false, false);
cntMarker += Naco.length;
map.addOverlays(Pearce);
centerByArray(Pearce, false, false);
cntMarker += Pearce.length;
map.addOverlays(Phoenix);
centerByArray(Phoenix, false, false);
cntMarker += Phoenix.length;
map.addOverlays(Pomerene);
centerByArray(Pomerene, false, false);
cntMarker += Pomerene.length;
map.addOverlays(Portal);
centerByArray(Portal, false, false);
cntMarker += Portal.length;
map.addOverlays(San_Simon);
centerByArray(San_Simon, false, false);
cntMarker += San_Simon.length;
map.addOverlays(Sierra_Vista);
centerByArray(Sierra_Vista, false, false);
cntMarker += Sierra_Vista.length;
map.addOverlays(St_David);
centerByArray(St_David, false, false);
cntMarker += St_David.length;
map.addOverlays(Tombstone);
centerByArray(Tombstone, false, false);
cntMarker += Tombstone.length;
map.addOverlays(Tucson);
centerByArray(Tucson, false, false);
cntMarker += Tucson.length;
map.addOverlays(Willcox);
centerByArray(Willcox, false, false);
cntMarker += Willcox.length;
centerByArray(Douglas,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');
}
}