function addMarkers()
{
mySelect = document.getElementById('selection');
Mullinville = [];Colwich = [];Winfield = [];Galena = [];Delia = [];El_Dorado = [];Newton = [];Elkhart = [];Galesburg = [];Tribune = [];Haysville = [];Topeka = [];Hutchinson = [];Lawrence = [];Moundridge = [];Mulvane = [];Chanute = [];Pratt = [];Lindsborg = [];Mt_Hope = [];Stafford = [];Colby = [];Emporia = [];Valley_Center = [];Williamsburg = [];Yoder = [];Zenda = [];mySelect.options[mySelect.options.length] = new Option("Chanute charter schools",'all=Chanute');
mySelect.options[mySelect.options.length] = new Option("Colby charter schools",'all=Colby');
mySelect.options[mySelect.options.length] = new Option("Colwich charter schools",'all=Colwich');
mySelect.options[mySelect.options.length] = new Option("Delia charter schools",'all=Delia');
mySelect.options[mySelect.options.length] = new Option("El Dorado charter schools",'all=El_Dorado');
mySelect.options[mySelect.options.length] = new Option("Elkhart charter schools",'all=Elkhart');
mySelect.options[mySelect.options.length] = new Option("Emporia charter schools",'all=Emporia');
mySelect.options[mySelect.options.length] = new Option("Galena charter schools",'all=Galena');
mySelect.options[mySelect.options.length] = new Option("Galesburg charter schools",'all=Galesburg');
mySelect.options[mySelect.options.length] = new Option("Haysville charter schools",'all=Haysville');
mySelect.options[mySelect.options.length] = new Option("Hutchinson charter schools",'all=Hutchinson');
mySelect.options[mySelect.options.length] = new Option("Lawrence charter schools",'all=Lawrence');
mySelect.options[mySelect.options.length] = new Option("Lindsborg charter schools",'all=Lindsborg');
mySelect.options[mySelect.options.length] = new Option("Moundridge charter schools",'all=Moundridge');
mySelect.options[mySelect.options.length] = new Option("Mt Hope charter schools",'all=Mt_Hope');
mySelect.options[mySelect.options.length] = new Option("Mullinville charter schools",'all=Mullinville');
mySelect.options[mySelect.options.length] = new Option("Mulvane charter schools",'all=Mulvane');
mySelect.options[mySelect.options.length] = new Option("Newton charter schools",'all=Newton');
mySelect.options[mySelect.options.length] = new Option("Pratt charter schools",'all=Pratt');
mySelect.options[mySelect.options.length] = new Option("Stafford charter schools",'all=Stafford');
mySelect.options[mySelect.options.length] = new Option("Topeka charter schools",'all=Topeka');
mySelect.options[mySelect.options.length] = new Option("Tribune charter schools",'all=Tribune');
mySelect.options[mySelect.options.length] = new Option("Valley Center charter schools",'all=Valley_Center');
mySelect.options[mySelect.options.length] = new Option("Williamsburg charter schools",'all=Williamsburg');
mySelect.options[mySelect.options.length] = new Option("Winfield charter schools",'all=Winfield');
mySelect.options[mySelect.options.length] = new Option("Yoder charter schools",'all=Yoder');
mySelect.options[mySelect.options.length] = new Option("Zenda charter schools",'all=Zenda');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Mullinville[Mullinville.length] = createMarker(new GPoint(-99.45290375,37.52069855),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("21st Century Learning Academy Charter Element",'Mullinville=' + Mullinville.length);
Mullinville[Mullinville.length] = createMarker(new GPoint(-99.45290375,37.52069855),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("21st Century Learning Academy Charter High School",'Mullinville=' + Mullinville.length);
Colwich[Colwich.length] = createMarker(new GPoint(-97.54329681,37.78160095),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Colwich Elementary School",'Colwich=' + Colwich.length);
Winfield[Winfield.length] = createMarker(new GPoint(-96.99464100,37.24605900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Community Learning Center",'Winfield=' + Winfield.length);
Galena[Galena.length] = createMarker(new GPoint(-94.63255310,37.07476425),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cornerstone Alternative Charter High School",'Galena=' + Galena.length);
Delia[Delia.length] = createMarker(new GPoint(-95.95279694,39.26779938),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Delia Elementary School",'Delia=' + Delia.length);
El_Dorado[El_Dorado.length] = createMarker(new GPoint(-96.85006600,37.81742200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("E-cats",'El_Dorado=' + El_Dorado.length);
Newton[Newton.length] = createMarker(new GPoint(-97.34513400,38.05286000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("E3 (entrepreheniel Ed. Enterprise)",'Newton=' + Newton.length);
Elkhart[Elkhart.length] = createMarker(new GPoint(-101.91259766,37.05059814),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Electronic Charter High School",'Elkhart=' + Elkhart.length);
Elkhart[Elkhart.length] = createMarker(new GPoint(-101.91259766,37.05059814),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Electronic Charter School - Elementary School",'Elkhart=' + Elkhart.length);
Galesburg[Galesburg.length] = createMarker(new GPoint(-95.30740356,37.45679855),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Galesburg Elementary School",'Galesburg=' + Galesburg.length);
Tribune[Tribune.length] = createMarker(new GPoint(-101.75632700,38.47181000),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Greeley County Charter School",'Tribune=' + Tribune.length);
Haysville[Haysville.length] = createMarker(new GPoint(-97.35688400,37.56330500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Haysvile Charter School",'Haysville=' + Haysville.length);
Topeka[Topeka.length] = createMarker(new GPoint(-95.72202700,39.04089700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hope Street Academy Charter Middle School",'Topeka=' + Topeka.length);
Topeka[Topeka.length] = createMarker(new GPoint(-95.73413086,39.03285980),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hope Street Charter Academy",'Topeka=' + Topeka.length);
Hutchinson[Hutchinson.length] = createMarker(new GPoint(-97.99648900,38.09970000),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hutchinson Cyber Charter",'Hutchinson=' + Hutchinson.length);
Lawrence[Lawrence.length] = createMarker(new GPoint(-95.25806700,38.98572300),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lawrence Virtual School",'Lawrence=' + Lawrence.length);
Moundridge[Moundridge.length] = createMarker(new GPoint(-97.51270294,38.20240021),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mid-kansas Independent Academy Elementary - Charte",'Moundridge=' + Moundridge.length);
Mulvane[Mulvane.length] = createMarker(new GPoint(-97.24460400,37.48740800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mulvane Academy",'Mulvane=' + Mulvane.length);
Chanute[Chanute.length] = createMarker(new GPoint(-95.44807434,37.67788315),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("New Beginnings Academy - Charter",'Chanute=' + Chanute.length);
Hutchinson[Hutchinson.length] = createMarker(new GPoint(-98.03156400,37.99662700),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pleasantview Academy Grade School",'Hutchinson=' + Hutchinson.length);
Hutchinson[Hutchinson.length] = createMarker(new GPoint(-98.03156400,37.99662700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pleasantview Academy High School",'Hutchinson=' + Hutchinson.length);
Elkhart[Elkhart.length] = createMarker(new GPoint(-101.89340100,36.99958600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Point Rock Academy",'Elkhart=' + Elkhart.length);
Pratt[Pratt.length] = createMarker(new GPoint(-98.73696899,37.64630890),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Productivity Academy - Charter",'Pratt=' + Pratt.length);
Lindsborg[Lindsborg.length] = createMarker(new GPoint(-10.00000000,10.00000000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Smoky Valley Charter School",'Lindsborg=' + Lindsborg.length);
Mt_Hope[Mt_Hope.length] = createMarker(new GPoint(-97.73412323,37.74940872),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("St Joseph Elementary Charter School",'Mt_Hope=' + Mt_Hope.length);
Stafford[Stafford.length] = createMarker(new GPoint(-98.57910156,37.93429947),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Stafford Middle School/high School",'Stafford=' + Stafford.length);
Colby[Colby.length] = createMarker(new GPoint(-101.05264900,39.39621300),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Thomas County Academy",'Colby=' + Colby.length);
Emporia[Emporia.length] = createMarker(new GPoint(-96.17766700,38.39394900),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Turning Point Learning Center",'Emporia=' + Emporia.length);
Valley_Center[Valley_Center.length] = createMarker(new GPoint(-97.34239960,37.84669876),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Valley Center Charter School",'Valley_Center=' + Valley_Center.length);
Williamsburg[Williamsburg.length] = createMarker(new GPoint(-95.44249725,38.46129990),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("West Franklin Learning Center Elementary (charter)",'Williamsburg=' + Williamsburg.length);
Williamsburg[Williamsburg.length] = createMarker(new GPoint(-95.43879700,38.48089981),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("West Franklin Learning Center Elementary - Charter",'Williamsburg=' + Williamsburg.length);
Williamsburg[Williamsburg.length] = createMarker(new GPoint(-95.43879700,38.48089981),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("West Franklin Learning Center High - Charter",'Williamsburg=' + Williamsburg.length);
Williamsburg[Williamsburg.length] = createMarker(new GPoint(-95.46527100,38.47999191),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("West Franklin Learning Center High School",'Williamsburg=' + Williamsburg.length);
Yoder[Yoder.length] = createMarker(new GPoint(-97.76529694,37.97349930),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Yoder Charter Elementary School",'Yoder=' + Yoder.length);
Zenda[Zenda.length] = createMarker(new GPoint(-98.28849792,37.43280029),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Zenda Elementary School",'Zenda=' + Zenda.length);
maxLng = -10.00000000;
maxLat = 39.39621300;
minLng = -101.91259766;
minLat = 10.00000000;
reCenterMap();
map.removeOverlays(Chanute);
map.removeOverlays(Colby);
map.removeOverlays(Colwich);
map.removeOverlays(Delia);
map.removeOverlays(El_Dorado);
map.removeOverlays(Elkhart);
map.removeOverlays(Emporia);
map.removeOverlays(Galena);
map.removeOverlays(Galesburg);
map.removeOverlays(Haysville);
map.removeOverlays(Hutchinson);
map.removeOverlays(Lawrence);
map.removeOverlays(Lindsborg);
map.removeOverlays(Moundridge);
map.removeOverlays(Mt_Hope);
map.removeOverlays(Mullinville);
map.removeOverlays(Mulvane);
map.removeOverlays(Newton);
map.removeOverlays(Pratt);
map.removeOverlays(Stafford);
map.removeOverlays(Topeka);
map.removeOverlays(Tribune);
map.removeOverlays(Valley_Center);
map.removeOverlays(Williamsburg);
map.removeOverlays(Winfield);
map.removeOverlays(Yoder);
map.removeOverlays(Zenda);
setTimeout(function(){map.addOverlays(Chanute)},1000);
setTimeout(function(){map.addOverlays(Colby)},1000);
setTimeout(function(){map.addOverlays(Colwich)},1000);
setTimeout(function(){map.addOverlays(Delia)},1000);
setTimeout(function(){map.addOverlays(El_Dorado)},1000);
setTimeout(function(){map.addOverlays(Elkhart)},1000);
setTimeout(function(){map.addOverlays(Emporia)},1000);
setTimeout(function(){map.addOverlays(Galena)},1000);
setTimeout(function(){map.addOverlays(Galesburg)},1000);
setTimeout(function(){map.addOverlays(Haysville)},1000);
setTimeout(function(){map.addOverlays(Hutchinson)},1000);
setTimeout(function(){map.addOverlays(Lawrence)},1000);
setTimeout(function(){map.addOverlays(Lindsborg)},1000);
setTimeout(function(){map.addOverlays(Moundridge)},1000);
setTimeout(function(){map.addOverlays(Mt_Hope)},1000);
setTimeout(function(){map.addOverlays(Mullinville)},1000);
setTimeout(function(){map.addOverlays(Mulvane)},1000);
setTimeout(function(){map.addOverlays(Newton)},1000);
setTimeout(function(){map.addOverlays(Pratt)},1000);
setTimeout(function(){map.addOverlays(Stafford)},1000);
setTimeout(function(){map.addOverlays(Topeka)},1000);
setTimeout(function(){map.addOverlays(Tribune)},1000);
setTimeout(function(){map.addOverlays(Valley_Center)},1000);
setTimeout(function(){map.addOverlays(Williamsburg)},1000);
setTimeout(function(){map.addOverlays(Winfield)},1000);
setTimeout(function(){map.addOverlays(Yoder)},1000);
setTimeout(function(){map.addOverlays(Zenda)},1000);
} // 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(Chanute);
map.removeOverlays(Colby);
map.removeOverlays(Colwich);
map.removeOverlays(Delia);
map.removeOverlays(El_Dorado);
map.removeOverlays(Elkhart);
map.removeOverlays(Emporia);
map.removeOverlays(Galena);
map.removeOverlays(Galesburg);
map.removeOverlays(Haysville);
map.removeOverlays(Hutchinson);
map.removeOverlays(Lawrence);
map.removeOverlays(Lindsborg);
map.removeOverlays(Moundridge);
map.removeOverlays(Mt_Hope);
map.removeOverlays(Mullinville);
map.removeOverlays(Mulvane);
map.removeOverlays(Newton);
map.removeOverlays(Pratt);
map.removeOverlays(Stafford);
map.removeOverlays(Topeka);
map.removeOverlays(Tribune);
map.removeOverlays(Valley_Center);
map.removeOverlays(Williamsburg);
map.removeOverlays(Winfield);
map.removeOverlays(Yoder);
map.removeOverlays(Zenda);
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(Mullinville);map.removeOverlays(Chanute);
map.removeOverlays(Colby);
map.removeOverlays(Colwich);
map.removeOverlays(Delia);
map.removeOverlays(El_Dorado);
map.removeOverlays(Elkhart);
map.removeOverlays(Emporia);
map.removeOverlays(Galena);
map.removeOverlays(Galesburg);
map.removeOverlays(Haysville);
map.removeOverlays(Hutchinson);
map.removeOverlays(Lawrence);
map.removeOverlays(Lindsborg);
map.removeOverlays(Moundridge);
map.removeOverlays(Mt_Hope);
map.removeOverlays(Mullinville);
map.removeOverlays(Mulvane);
map.removeOverlays(Newton);
map.removeOverlays(Pratt);
map.removeOverlays(Stafford);
map.removeOverlays(Topeka);
map.removeOverlays(Tribune);
map.removeOverlays(Valley_Center);
map.removeOverlays(Williamsburg);
map.removeOverlays(Winfield);
map.removeOverlays(Yoder);
map.removeOverlays(Zenda);
map.addOverlays(Chanute);
centerByArray(Chanute, false, false);
cntMarker += Chanute.length;
map.addOverlays(Colby);
centerByArray(Colby, false, false);
cntMarker += Colby.length;
map.addOverlays(Colwich);
centerByArray(Colwich, false, false);
cntMarker += Colwich.length;
map.addOverlays(Delia);
centerByArray(Delia, false, false);
cntMarker += Delia.length;
map.addOverlays(El_Dorado);
centerByArray(El_Dorado, false, false);
cntMarker += El_Dorado.length;
map.addOverlays(Elkhart);
centerByArray(Elkhart, false, false);
cntMarker += Elkhart.length;
map.addOverlays(Emporia);
centerByArray(Emporia, false, false);
cntMarker += Emporia.length;
map.addOverlays(Galena);
centerByArray(Galena, false, false);
cntMarker += Galena.length;
map.addOverlays(Galesburg);
centerByArray(Galesburg, false, false);
cntMarker += Galesburg.length;
map.addOverlays(Haysville);
centerByArray(Haysville, false, false);
cntMarker += Haysville.length;
map.addOverlays(Hutchinson);
centerByArray(Hutchinson, false, false);
cntMarker += Hutchinson.length;
map.addOverlays(Lawrence);
centerByArray(Lawrence, false, false);
cntMarker += Lawrence.length;
map.addOverlays(Lindsborg);
centerByArray(Lindsborg, false, false);
cntMarker += Lindsborg.length;
map.addOverlays(Moundridge);
centerByArray(Moundridge, false, false);
cntMarker += Moundridge.length;
map.addOverlays(Mt_Hope);
centerByArray(Mt_Hope, false, false);
cntMarker += Mt_Hope.length;
map.addOverlays(Mullinville);
centerByArray(Mullinville, false, false);
cntMarker += Mullinville.length;
map.addOverlays(Mulvane);
centerByArray(Mulvane, false, false);
cntMarker += Mulvane.length;
map.addOverlays(Newton);
centerByArray(Newton, false, false);
cntMarker += Newton.length;
map.addOverlays(Pratt);
centerByArray(Pratt, false, false);
cntMarker += Pratt.length;
map.addOverlays(Stafford);
centerByArray(Stafford, false, false);
cntMarker += Stafford.length;
map.addOverlays(Topeka);
centerByArray(Topeka, false, false);
cntMarker += Topeka.length;
map.addOverlays(Tribune);
centerByArray(Tribune, false, false);
cntMarker += Tribune.length;
map.addOverlays(Valley_Center);
centerByArray(Valley_Center, false, false);
cntMarker += Valley_Center.length;
map.addOverlays(Williamsburg);
centerByArray(Williamsburg, false, false);
cntMarker += Williamsburg.length;
map.addOverlays(Winfield);
centerByArray(Winfield, false, false);
cntMarker += Winfield.length;
map.addOverlays(Yoder);
centerByArray(Yoder, false, false);
cntMarker += Yoder.length;
map.addOverlays(Zenda);
centerByArray(Zenda, false, false);
cntMarker += Zenda.length;
centerByArray(Mullinville,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');
}
}