function addMarkers()
{
mySelect = document.getElementById('selection');
Greeley = [];Evans = [];Eaton = [];Briggsdale = [];Frederick = [];Keenesburg = [];Erie = [];Fort_Lupton = [];Firestone = [];Galeton = [];Gilcrest = [];Windsor = [];Pierce = [];Ault = [];Hudson = [];Milliken = [];Johnstown = [];Lochbuie = [];Mead = [];La_Salle = [];Grover = [];Kersey = [];Platteville = [];New_Raymer = [];Roggen = [];mySelect.options[mySelect.options.length] = new Option("Ault schools",'all=Ault');
mySelect.options[mySelect.options.length] = new Option("Briggsdale schools",'all=Briggsdale');
mySelect.options[mySelect.options.length] = new Option("Eaton schools",'all=Eaton');
mySelect.options[mySelect.options.length] = new Option("Erie schools",'all=Erie');
mySelect.options[mySelect.options.length] = new Option("Evans schools",'all=Evans');
mySelect.options[mySelect.options.length] = new Option("Firestone schools",'all=Firestone');
mySelect.options[mySelect.options.length] = new Option("Fort Lupton schools",'all=Fort_Lupton');
mySelect.options[mySelect.options.length] = new Option("Frederick schools",'all=Frederick');
mySelect.options[mySelect.options.length] = new Option("Galeton schools",'all=Galeton');
mySelect.options[mySelect.options.length] = new Option("Gilcrest schools",'all=Gilcrest');
mySelect.options[mySelect.options.length] = new Option("Greeley schools",'all=Greeley');
mySelect.options[mySelect.options.length] = new Option("Grover schools",'all=Grover');
mySelect.options[mySelect.options.length] = new Option("Hudson schools",'all=Hudson');
mySelect.options[mySelect.options.length] = new Option("Johnstown schools",'all=Johnstown');
mySelect.options[mySelect.options.length] = new Option("Keenesburg schools",'all=Keenesburg');
mySelect.options[mySelect.options.length] = new Option("Kersey schools",'all=Kersey');
mySelect.options[mySelect.options.length] = new Option("La Salle schools",'all=La_Salle');
mySelect.options[mySelect.options.length] = new Option("Lochbuie schools",'all=Lochbuie');
mySelect.options[mySelect.options.length] = new Option("Mead schools",'all=Mead');
mySelect.options[mySelect.options.length] = new Option("Milliken schools",'all=Milliken');
mySelect.options[mySelect.options.length] = new Option("New Raymer schools",'all=New_Raymer');
mySelect.options[mySelect.options.length] = new Option("Pierce schools",'all=Pierce');
mySelect.options[mySelect.options.length] = new Option("Platteville schools",'all=Platteville');
mySelect.options[mySelect.options.length] = new Option("Roggen schools",'all=Roggen');
mySelect.options[mySelect.options.length] = new Option("Windsor schools",'all=Windsor');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Greeley[Greeley.length] = createMarker(new GPoint(-104.72541809,40.42858124),"
",iconBl);
mySelect.options[mySelect.options.length] = new Option("Adelante Alternative Middle School",'Greeley=' + Greeley.length);
Evans[Evans.length] = createMarker(new GPoint(-104.73007965,40.37126160),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Ann K Heiman Elementary School",'Evans=' + Evans.length);
Greeley[Greeley.length] = createMarker(new GPoint(-104.78082275,40.38198090),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Bella Romero Elememtary School",'Greeley=' + Greeley.length);
Eaton[Eaton.length] = createMarker(new GPoint(-104.71755981,40.52470016),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Benjamin Eaton Elementary School",'Eaton=' + Eaton.length);
Greeley[Greeley.length] = createMarker(new GPoint(-104.70151520,40.43634796),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Billie Martinez Elementary School",'Greeley=' + Greeley.length);
Greeley[Greeley.length] = createMarker(new GPoint(-104.72071838,40.39617920),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Brentwood Middle School",'Greeley=' + Greeley.length);
Briggsdale[Briggsdale.length] = createMarker(new GPoint(-104.26689911,40.60459900),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Briggsdale Elementary School",'Briggsdale=' + Briggsdale.length);
Briggsdale[Briggsdale.length] = createMarker(new GPoint(-104.26689911,40.60459900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Briggsdale Undivided High School",'Briggsdale=' + Briggsdale.length);
Greeley[Greeley.length] = createMarker(new GPoint(-104.69993591,40.41672516),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Cameron Elementary School",'Greeley=' + Greeley.length);
Frederick[Frederick.length] = createMarker(new GPoint(-104.97797600,40.11317100),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Carbon Valley Charter School",'Frederick=' + Frederick.length);
Keenesburg[Keenesburg.length] = createMarker(new GPoint(-104.50080109,40.09140015),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Cardinal Community Academy Charter School",'Keenesburg=' + Keenesburg.length);
Greeley[Greeley.length] = createMarker(new GPoint(-104.76210785,40.43046570),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Carson Treatment Center",'Greeley=' + Greeley.length);
Evans[Evans.length] = createMarker(new GPoint(-104.70042419,40.37738037),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Centennial Elementary School",'Evans=' + Evans.length);
Evans[Evans.length] = createMarker(new GPoint(-104.70948029,40.38111115),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Chappelow Arts & Literacy Magnet School",'Evans=' + Evans.length);
Greeley[Greeley.length] = createMarker(new GPoint(-104.76631165,40.42741394),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Christa Mc Auliffe Elementary School",'Greeley=' + Greeley.length);
Greeley[Greeley.length] = createMarker(new GPoint(-104.72316742,40.42076111),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Colorado High School Of Greeley",'Greeley=' + Greeley.length);
Greeley[Greeley.length] = createMarker(new GPoint(-104.70909882,40.42317963),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Deaf Or Hard Of Hearing Prog",'Greeley=' + Greeley.length);
Greeley[Greeley.length] = createMarker(new GPoint(-104.78545380,40.41023636),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Deaf Or Hard Of Hearing Program",'Greeley=' + Greeley.length);
Evans[Evans.length] = createMarker(new GPoint(-104.71364594,40.38113403),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Dos Rios Elementary School",'Evans=' + Evans.length);
Greeley[Greeley.length] = createMarker(new GPoint(-104.66982269,40.40645218),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("East Memorial Elementary School",'Greeley=' + Greeley.length);
Eaton[Eaton.length] = createMarker(new GPoint(-104.71578217,40.52582169),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Eaton Elementary School",'Eaton=' + Eaton.length);
Eaton[Eaton.length] = createMarker(new GPoint(-104.71720123,40.52629471),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Eaton High School",'Eaton=' + Eaton.length);
Eaton[Eaton.length] = createMarker(new GPoint(-104.72384644,40.52774429),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Eaton Middle School",'Eaton=' + Eaton.length);
Erie[Erie.length] = createMarker(new GPoint(-105.13100200,39.98133500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Erie High School",'Erie=' + Erie.length);
Erie[Erie.length] = createMarker(new GPoint(-105.03829956,40.04100037),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Erie Middle/senior High School",'Erie=' + Erie.length);
Greeley[Greeley.length] = createMarker(new GPoint(-104.70909882,40.42317963),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("External Charter School (u N C",'Greeley=' + Greeley.length);
Fort_Lupton[Fort_Lupton.length] = createMarker(new GPoint(-104.81291400,40.07961000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Fort Lupton High School",'Fort_Lupton=' + Fort_Lupton.length);
Fort_Lupton[Fort_Lupton.length] = createMarker(new GPoint(-104.81275940,40.07895279),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Fort Lupton Middle School",'Fort_Lupton=' + Fort_Lupton.length);
Greeley[Greeley.length] = createMarker(new GPoint(-104.73518372,40.42477417),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Franklin Middle School",'Greeley=' + Greeley.length);
Frederick[Frederick.length] = createMarker(new GPoint(-104.93422699,40.09615707),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Frederick Elementary School",'Frederick=' + Frederick.length);
Firestone[Firestone.length] = createMarker(new GPoint(-104.93209839,40.09939957),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Frederick Middle School",'Firestone=' + Firestone.length);
Frederick[Frederick.length] = createMarker(new GPoint(-104.93343353,40.09862900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Frederick Senior High School",'Frederick=' + Frederick.length);
Greeley[Greeley.length] = createMarker(new GPoint(-104.72970581,40.38746643),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Frontier Charter Academy",'Greeley=' + Greeley.length);
Galeton[Galeton.length] = createMarker(new GPoint(-104.46410370,40.57239914),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Galeton Elementary School",'Galeton=' + Galeton.length);
Gilcrest[Gilcrest.length] = createMarker(new GPoint(-104.77809906,40.28359985),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Gilcrest Elementary School",'Gilcrest=' + Gilcrest.length);
Windsor[Windsor.length] = createMarker(new GPoint(-105.05560303,40.54489899),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Grandview Elementary School",'Windsor=' + Windsor.length);
Greeley[Greeley.length] = createMarker(new GPoint(-104.70174408,40.41543198),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Greeley Central High School",'Greeley=' + Greeley.length);
Greeley[Greeley.length] = createMarker(new GPoint(-104.73498535,40.39923096),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Greeley West High School",'Greeley=' + Greeley.length);
Greeley[Greeley.length] = createMarker(new GPoint(-104.78082275,40.38198090),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Harold S Winograd Elementary School",'Greeley=' + Greeley.length);
Greeley[Greeley.length] = createMarker(new GPoint(-104.71466064,40.41383362),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Heath Middle School",'Greeley=' + Greeley.length);
Pierce[Pierce.length] = createMarker(new GPoint(-104.75250244,40.63970184),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Highland Elementary School",'Pierce=' + Pierce.length);
Ault[Ault.length] = createMarker(new GPoint(-104.70269775,40.60639954),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Highland High School",'Ault=' + Ault.length);
Ault[Ault.length] = createMarker(new GPoint(-104.70269775,40.60639954),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Highland Middle School",'Ault=' + Ault.length);
Keenesburg[Keenesburg.length] = createMarker(new GPoint(-104.50080109,40.09140015),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hoff Elementary School",'Keenesburg=' + Keenesburg.length);
Hudson[Hudson.length] = createMarker(new GPoint(-104.62760162,40.05339813),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hudson Elementary School",'Hudson=' + Hudson.length);
Hudson[Hudson.length] = createMarker(new GPoint(-104.64041901,40.07609940),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hudson Headstart Elementary School",'Hudson=' + Hudson.length);
Greeley[Greeley.length] = createMarker(new GPoint(-104.71171570,40.39600372),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Jackson Elementary School",'Greeley=' + Greeley.length);
Greeley[Greeley.length] = createMarker(new GPoint(-104.68370056,40.41814804),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Jefferson Elementary School",'Greeley=' + Greeley.length);
Greeley[Greeley.length] = createMarker(new GPoint(-104.70280457,40.39116669),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("John Evans Middle School",'Greeley=' + Greeley.length);
Milliken[Milliken.length] = createMarker(new GPoint(-104.83412170,40.32969284),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Knowledge Quest Academy",'Milliken=' + Milliken.length);
Frederick[Frederick.length] = createMarker(new GPoint(-104.96594600,40.11325000),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Legacy Elementary School",'Frederick=' + Frederick.length);
Fort_Lupton[Fort_Lupton.length] = createMarker(new GPoint(-104.81275940,40.07667160),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Leo William Butler Elementary School",'Fort_Lupton=' + Fort_Lupton.length);
Johnstown[Johnstown.length] = createMarker(new GPoint(-104.91860199,40.34078217),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Letford Elementary School",'Johnstown=' + Johnstown.length);
Lochbuie[Lochbuie.length] = createMarker(new GPoint(-104.72171783,40.00403976),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lochbuie Elementary School",'Lochbuie=' + Lochbuie.length);
Greeley[Greeley.length] = createMarker(new GPoint(-104.71832275,40.42778015),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Madison Elementary School",'Greeley=' + Greeley.length);
Greeley[Greeley.length] = createMarker(new GPoint(-104.71134949,40.41989899),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Maplewood Middle School",'Greeley=' + Greeley.length);
Mead[Mead.length] = createMarker(new GPoint(-104.99160004,40.23799896),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mead Elementary School",'Mead=' + Mead.length);
Mead[Mead.length] = createMarker(new GPoint(-104.99160004,40.23799896),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Mead Middle School",'Mead=' + Mead.length);
Greeley[Greeley.length] = createMarker(new GPoint(-104.72735596,40.40247726),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Meeker Elementary School",'Greeley=' + Greeley.length);
Milliken[Milliken.length] = createMarker(new GPoint(-104.85569763,40.32939911),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Milliken Elementary School",'Milliken=' + Milliken.length);
Milliken[Milliken.length] = createMarker(new GPoint(-104.85569763,40.32939911),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Milliken Middle School",'Milliken=' + Milliken.length);
Greeley[Greeley.length] = createMarker(new GPoint(-104.75627136,40.40499878),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Monfort Elementary School",'Greeley=' + Greeley.length);
Windsor[Windsor.length] = createMarker(new GPoint(-104.90097809,40.47037506),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mountain View Elementary School",'Windsor=' + Windsor.length);
La_Salle[La_Salle.length] = createMarker(new GPoint(-104.69339752,40.32389832),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("North Valley Middle School",'La_Salle=' + La_Salle.length);
Greeley[Greeley.length] = createMarker(new GPoint(-104.79241180,40.43633652),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Northridge High School",'Greeley=' + Greeley.length);
Grover[Grover.length] = createMarker(new GPoint(-104.20749664,40.88539886),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pawnee Elementary School",'Grover=' + Grover.length);
Grover[Grover.length] = createMarker(new GPoint(-104.20749664,40.88539886),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pawnee Junior-senior High School",'Grover=' + Grover.length);
La_Salle[La_Salle.length] = createMarker(new GPoint(-104.69339752,40.32389832),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pete Mirich Elementary School",'La_Salle=' + La_Salle.length);
Johnstown[Johnstown.length] = createMarker(new GPoint(-104.90768700,40.30210100),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pioneer Ridge Elementary School",'Johnstown=' + Johnstown.length);
Kersey[Kersey.length] = createMarker(new GPoint(-104.53610229,40.36640167),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Platte Valley Elementary School",'Kersey=' + Kersey.length);
Kersey[Kersey.length] = createMarker(new GPoint(-104.53610229,40.36640167),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Platte Valley High School",'Kersey=' + Kersey.length);
Kersey[Kersey.length] = createMarker(new GPoint(-104.53610229,40.36640167),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Platte Valley Middle School",'Kersey=' + Kersey.length);
Platteville[Platteville.length] = createMarker(new GPoint(-104.81169891,40.23199844),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Platteville Elementary School",'Platteville=' + Platteville.length);
New_Raymer[New_Raymer.length] = createMarker(new GPoint(-103.83550262,40.67699814),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Prairie Elementary School",'New_Raymer=' + New_Raymer.length);
New_Raymer[New_Raymer.length] = createMarker(new GPoint(-103.83550262,40.67699814),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Prairie Junior-senior High School",'New_Raymer=' + New_Raymer.length);
Firestone[Firestone.length] = createMarker(new GPoint(-105.19860077,40.17414474),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Prairie Ridge Elementary School",'Firestone=' + Firestone.length);
Johnstown[Johnstown.length] = createMarker(new GPoint(-104.91282654,40.33826447),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Roosevelt High School",'Johnstown=' + Johnstown.length);
Greeley[Greeley.length] = createMarker(new GPoint(-104.72887421,40.41835022),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Scott Elementary School",'Greeley=' + Greeley.length);
Greeley[Greeley.length] = createMarker(new GPoint(-104.73622131,40.42626953),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Shawsheen Elementary School",'Greeley=' + Greeley.length);
Windsor[Windsor.length] = createMarker(new GPoint(-104.91470337,40.47063828),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Skyview Elementary School",'Windsor=' + Windsor.length);
Roggen[Roggen.length] = createMarker(new GPoint(-104.37143707,40.16827774),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Small Wonders Preschool",'Roggen=' + Roggen.length);
Platteville[Platteville.length] = createMarker(new GPoint(-104.82335663,40.21022415),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("South Valley Middle School",'Platteville=' + Platteville.length);
Windsor[Windsor.length] = createMarker(new GPoint(-104.90438080,40.47456360),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Tozer Elementary School",'Windsor=' + Windsor.length);
Greeley[Greeley.length] = createMarker(new GPoint(-104.71308136,40.41759491),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Trademark Learning Center",'Greeley=' + Greeley.length);
Greeley[Greeley.length] = createMarker(new GPoint(-104.71308136,40.41759491),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Trademark Night School",'Greeley=' + Greeley.length);
Fort_Lupton[Fort_Lupton.length] = createMarker(new GPoint(-104.79904938,40.08721542),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Twombly Elementary School",'Fort_Lupton=' + Fort_Lupton.length);
Greeley[Greeley.length] = createMarker(new GPoint(-104.76839447,40.40690231),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Union Colony Prepatory School",'Greeley=' + Greeley.length);
Greeley[Greeley.length] = createMarker(new GPoint(-104.76284900,40.40935000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("University Schools",'Greeley=' + Greeley.length);
Gilcrest[Gilcrest.length] = createMarker(new GPoint(-104.77732900,40.28266400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Valley High School",'Gilcrest=' + Gilcrest.length);
Keenesburg[Keenesburg.length] = createMarker(new GPoint(-104.51988983,40.10823059),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Weld Central Junior High School",'Keenesburg=' + Keenesburg.length);
Keenesburg[Keenesburg.length] = createMarker(new GPoint(-104.51988983,40.10823059),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Weld Central Senior High School",'Keenesburg=' + Keenesburg.length);
Greeley[Greeley.length] = createMarker(new GPoint(-104.67797852,40.39673996),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Weld Opportunity High School",'Greeley=' + Greeley.length);
Windsor[Windsor.length] = createMarker(new GPoint(-104.88116455,40.47154236),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Windsor Charter Academy",'Windsor=' + Windsor.length);
Windsor[Windsor.length] = createMarker(new GPoint(-104.90142400,40.47852500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Windsor High School",'Windsor=' + Windsor.length);
Windsor[Windsor.length] = createMarker(new GPoint(-104.91130066,40.48002243),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Windsor Middle School",'Windsor=' + Windsor.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(Ault);
map.removeOverlays(Briggsdale);
map.removeOverlays(Eaton);
map.removeOverlays(Erie);
map.removeOverlays(Evans);
map.removeOverlays(Firestone);
map.removeOverlays(Fort_Lupton);
map.removeOverlays(Frederick);
map.removeOverlays(Galeton);
map.removeOverlays(Gilcrest);
map.removeOverlays(Greeley);
map.removeOverlays(Grover);
map.removeOverlays(Hudson);
map.removeOverlays(Johnstown);
map.removeOverlays(Keenesburg);
map.removeOverlays(Kersey);
map.removeOverlays(La_Salle);
map.removeOverlays(Lochbuie);
map.removeOverlays(Mead);
map.removeOverlays(Milliken);
map.removeOverlays(New_Raymer);
map.removeOverlays(Pierce);
map.removeOverlays(Platteville);
map.removeOverlays(Roggen);
map.removeOverlays(Windsor);
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(Greeley);map.removeOverlays(Ault);
map.removeOverlays(Briggsdale);
map.removeOverlays(Eaton);
map.removeOverlays(Erie);
map.removeOverlays(Evans);
map.removeOverlays(Firestone);
map.removeOverlays(Fort_Lupton);
map.removeOverlays(Frederick);
map.removeOverlays(Galeton);
map.removeOverlays(Gilcrest);
map.removeOverlays(Greeley);
map.removeOverlays(Grover);
map.removeOverlays(Hudson);
map.removeOverlays(Johnstown);
map.removeOverlays(Keenesburg);
map.removeOverlays(Kersey);
map.removeOverlays(La_Salle);
map.removeOverlays(Lochbuie);
map.removeOverlays(Mead);
map.removeOverlays(Milliken);
map.removeOverlays(New_Raymer);
map.removeOverlays(Pierce);
map.removeOverlays(Platteville);
map.removeOverlays(Roggen);
map.removeOverlays(Windsor);
map.addOverlays(Ault);
centerByArray(Ault, false, false);
cntMarker += Ault.length;
map.addOverlays(Briggsdale);
centerByArray(Briggsdale, false, false);
cntMarker += Briggsdale.length;
map.addOverlays(Eaton);
centerByArray(Eaton, false, false);
cntMarker += Eaton.length;
map.addOverlays(Erie);
centerByArray(Erie, false, false);
cntMarker += Erie.length;
map.addOverlays(Evans);
centerByArray(Evans, false, false);
cntMarker += Evans.length;
map.addOverlays(Firestone);
centerByArray(Firestone, false, false);
cntMarker += Firestone.length;
map.addOverlays(Fort_Lupton);
centerByArray(Fort_Lupton, false, false);
cntMarker += Fort_Lupton.length;
map.addOverlays(Frederick);
centerByArray(Frederick, false, false);
cntMarker += Frederick.length;
map.addOverlays(Galeton);
centerByArray(Galeton, false, false);
cntMarker += Galeton.length;
map.addOverlays(Gilcrest);
centerByArray(Gilcrest, false, false);
cntMarker += Gilcrest.length;
map.addOverlays(Greeley);
centerByArray(Greeley, false, false);
cntMarker += Greeley.length;
map.addOverlays(Grover);
centerByArray(Grover, false, false);
cntMarker += Grover.length;
map.addOverlays(Hudson);
centerByArray(Hudson, false, false);
cntMarker += Hudson.length;
map.addOverlays(Johnstown);
centerByArray(Johnstown, false, false);
cntMarker += Johnstown.length;
map.addOverlays(Keenesburg);
centerByArray(Keenesburg, false, false);
cntMarker += Keenesburg.length;
map.addOverlays(Kersey);
centerByArray(Kersey, false, false);
cntMarker += Kersey.length;
map.addOverlays(La_Salle);
centerByArray(La_Salle, false, false);
cntMarker += La_Salle.length;
map.addOverlays(Lochbuie);
centerByArray(Lochbuie, false, false);
cntMarker += Lochbuie.length;
map.addOverlays(Mead);
centerByArray(Mead, false, false);
cntMarker += Mead.length;
map.addOverlays(Milliken);
centerByArray(Milliken, false, false);
cntMarker += Milliken.length;
map.addOverlays(New_Raymer);
centerByArray(New_Raymer, false, false);
cntMarker += New_Raymer.length;
map.addOverlays(Pierce);
centerByArray(Pierce, false, false);
cntMarker += Pierce.length;
map.addOverlays(Platteville);
centerByArray(Platteville, false, false);
cntMarker += Platteville.length;
map.addOverlays(Roggen);
centerByArray(Roggen, false, false);
cntMarker += Roggen.length;
map.addOverlays(Windsor);
centerByArray(Windsor, false, false);
cntMarker += Windsor.length;
centerByArray(Greeley,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');
}
}