function addMarkers(){
mySelect = document.getElementById('selection');
Arkansas_City = [];Elbing = [];Ottawa = [];Wichita = [];Hutchinson = [];Great_Bend = [];Chanute = [];Sublette = [];Mcpherson = [];Salina = [];Emporia = [];Topeka = [];Manhattan = [];Colby = [];Hugoton = [];Independence = [];Iola = [];Shawnee = [];Marienthal = [];Kansas_City = [];Newton = [];Overland_Park = [];Paola = [];Olathe = [];Tyro = [];Lawrence = [];Leavenworth = [];mySelect.options[mySelect.options.length] = new Option("Arkansas City schools",'all=Arkansas_City');
mySelect.options[mySelect.options.length] = new Option("Chanute schools",'all=Chanute');
mySelect.options[mySelect.options.length] = new Option("Colby schools",'all=Colby');
mySelect.options[mySelect.options.length] = new Option("Elbing schools",'all=Elbing');
mySelect.options[mySelect.options.length] = new Option("Emporia schools",'all=Emporia');
mySelect.options[mySelect.options.length] = new Option("Great Bend schools",'all=Great_Bend');
mySelect.options[mySelect.options.length] = new Option("Hugoton schools",'all=Hugoton');
mySelect.options[mySelect.options.length] = new Option("Hutchinson schools",'all=Hutchinson');
mySelect.options[mySelect.options.length] = new Option("Independence schools",'all=Independence');
mySelect.options[mySelect.options.length] = new Option("Iola schools",'all=Iola');
mySelect.options[mySelect.options.length] = new Option("Kansas City schools",'all=Kansas_City');
mySelect.options[mySelect.options.length] = new Option("Lawrence schools",'all=Lawrence');
mySelect.options[mySelect.options.length] = new Option("Leavenworth schools",'all=Leavenworth');
mySelect.options[mySelect.options.length] = new Option("Manhattan schools",'all=Manhattan');
mySelect.options[mySelect.options.length] = new Option("Marienthal schools",'all=Marienthal');
mySelect.options[mySelect.options.length] = new Option("Mcpherson schools",'all=Mcpherson');
mySelect.options[mySelect.options.length] = new Option("Newton schools",'all=Newton');
mySelect.options[mySelect.options.length] = new Option("Olathe schools",'all=Olathe');
mySelect.options[mySelect.options.length] = new Option("Ottawa schools",'all=Ottawa');
mySelect.options[mySelect.options.length] = new Option("Overland Park schools",'all=Overland_Park');
mySelect.options[mySelect.options.length] = new Option("Paola schools",'all=Paola');
mySelect.options[mySelect.options.length] = new Option("Salina schools",'all=Salina');
mySelect.options[mySelect.options.length] = new Option("Shawnee schools",'all=Shawnee');
mySelect.options[mySelect.options.length] = new Option("Sublette schools",'all=Sublette');
mySelect.options[mySelect.options.length] = new Option("Topeka schools",'all=Topeka');
mySelect.options[mySelect.options.length] = new Option("Tyro schools",'all=Tyro');
mySelect.options[mySelect.options.length] = new Option("Wichita schools",'all=Wichita');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Arkansas_City[Arkansas_City.length] = createMarker(new GPoint(-97.02020000,37.07040000),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ark City Christian Academy",'Arkansas_City=' + Arkansas_City.length);
Elbing[Elbing.length] = createMarker(new GPoint(-97.12650000,38.05350000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Berean Academy",'Elbing=' + Elbing.length);
Ottawa[Ottawa.length] = createMarker(new GPoint(-95.21146900,38.65594800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bethel Christian Academy",'Ottawa=' + Ottawa.length);
Wichita[Wichita.length] = createMarker(new GPoint(-97.30229900,37.67896300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Calvary Christian School",'Wichita=' + Wichita.length);
Wichita[Wichita.length] = createMarker(new GPoint(-97.24445800,37.73609600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Central Christian Academy",'Wichita=' + Wichita.length);
Hutchinson[Hutchinson.length] = createMarker(new GPoint(-97.88803600,38.08663700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Central Christian Schools",'Hutchinson=' + Hutchinson.length);
Great_Bend[Great_Bend.length] = createMarker(new GPoint(-98.79307400,38.35478700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Central Kansas Christian Academy",'Great_Bend=' + Great_Bend.length);
Chanute[Chanute.length] = createMarker(new GPoint(-95.46657300,37.66753700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Chanute Christian Academy",'Chanute=' + Chanute.length);
Hutchinson[Hutchinson.length] = createMarker(new GPoint(-97.94073300,38.10182600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Community School Of Hutchinson",'Hutchinson=' + Hutchinson.length);
Sublette[Sublette.length] = createMarker(new GPoint(-100.81040000,37.54300000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Crosswalk Christian School",'Sublette=' + Sublette.length);
Mcpherson[Mcpherson.length] = createMarker(new GPoint(-97.61877800,38.28979400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Elyria Christian School",'Mcpherson=' + Mcpherson.length);
Salina[Salina.length] = createMarker(new GPoint(-97.59093300,38.81263700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Emmanuel Christian School",'Salina=' + Salina.length);
Emporia[Emporia.length] = createMarker(new GPoint(-96.19519300,38.41339700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Emporia Christian School",'Emporia=' + Emporia.length);
Topeka[Topeka.length] = createMarker(new GPoint(-95.67190000,39.05410000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Faith Christian School",'Topeka=' + Topeka.length);
Manhattan[Manhattan.length] = createMarker(new GPoint(-96.51042500,39.20026200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Flint Hills Christian School",'Manhattan=' + Manhattan.length);
Colby[Colby.length] = createMarker(new GPoint(-101.07350000,39.39130000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Heartland Christian School",'Colby=' + Colby.length);
Hugoton[Hugoton.length] = createMarker(new GPoint(-101.31670000,37.13510000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Heritage Christian Academy",'Hugoton=' + Hugoton.length);
Topeka[Topeka.length] = createMarker(new GPoint(-95.67855400,39.08538400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Heritage Christian School",'Topeka=' + Topeka.length);
Independence[Independence.length] = createMarker(new GPoint(-95.71031400,37.19637000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Independence Bible School",'Independence=' + Independence.length);
Iola[Iola.length] = createMarker(new GPoint(-95.39720000,37.93030000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Iola Area Community Christian School",'Iola=' + Iola.length);
Shawnee[Shawnee.length] = createMarker(new GPoint(-94.76132000,39.00621400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Maranatha Academy",'Shawnee=' + Shawnee.length);
Marienthal[Marienthal.length] = createMarker(new GPoint(-101.03230000,38.47400000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Marienthal Christian School",'Marienthal=' + Marienthal.length);
Kansas_City[Kansas_City.length] = createMarker(new GPoint(-94.73399300,39.15326000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Muncie Christian School",'Kansas_City=' + Kansas_City.length);
Newton[Newton.length] = createMarker(new GPoint(-97.34575200,38.11543700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Newton Christian High School",'Newton=' + Newton.length);
Kansas_City[Kansas_City.length] = createMarker(new GPoint(-94.81444700,39.14132300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Open Door Christian School",'Kansas_City=' + Kansas_City.length);
Overland_Park[Overland_Park.length] = createMarker(new GPoint(-94.66752200,38.99494500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Overland Christian Schools",'Overland_Park=' + Overland_Park.length);
Paola[Paola.length] = createMarker(new GPoint(-94.87427300,38.58171400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Paola Christian Academy",'Paola=' + Paola.length);
Olathe[Olathe.length] = createMarker(new GPoint(-94.78852200,38.88437200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pioneer Christian Academy",'Olathe=' + Olathe.length);
Wichita[Wichita.length] = createMarker(new GPoint(-97.37192900,37.76153800),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Riverlawn Christian Academy",'Wichita=' + Wichita.length);
Salina[Salina.length] = createMarker(new GPoint(-97.61121800,38.81966900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Salina Christian Academy",'Salina=' + Salina.length);
Wichita[Wichita.length] = createMarker(new GPoint(-97.19527400,37.72296300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Trinity Academy",'Wichita=' + Wichita.length);
Tyro[Tyro.length] = createMarker(new GPoint(-95.82410000,37.03620000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Tyro Community Christian School",'Tyro=' + Tyro.length);
Lawrence[Lawrence.length] = createMarker(new GPoint(-95.23230000,38.97810000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Veritas Christian School",'Lawrence=' + Lawrence.length);
Hutchinson[Hutchinson.length] = createMarker(new GPoint(-97.92978900,38.06075000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Victory Village Christian Academy",'Hutchinson=' + Hutchinson.length);
Leavenworth[Leavenworth.length] = createMarker(new GPoint(-94.90056900,39.20552700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Wallula Christian Preschool",'Leavenworth=' + Leavenworth.length);
Overland_Park[Overland_Park.length] = createMarker(new GPoint(-94.69326800,38.83991100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Westminster Christian Academy",'Overland_Park=' + Overland_Park.length);
Overland_Park[Overland_Park.length] = createMarker(new GPoint(-94.69326800,38.83991100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Westminster Christian Academy",'Overland_Park=' + Overland_Park.length);
map.removeOverlays(Arkansas_City);
map.removeOverlays(Chanute);
map.removeOverlays(Colby);
map.removeOverlays(Elbing);
map.removeOverlays(Emporia);
map.removeOverlays(Great_Bend);
map.removeOverlays(Hugoton);
map.removeOverlays(Hutchinson);
map.removeOverlays(Independence);
map.removeOverlays(Iola);
map.removeOverlays(Kansas_City);
map.removeOverlays(Lawrence);
map.removeOverlays(Leavenworth);
map.removeOverlays(Manhattan);
map.removeOverlays(Marienthal);
map.removeOverlays(Mcpherson);
map.removeOverlays(Newton);
map.removeOverlays(Olathe);
map.removeOverlays(Ottawa);
map.removeOverlays(Overland_Park);
map.removeOverlays(Paola);
map.removeOverlays(Salina);
map.removeOverlays(Shawnee);
map.removeOverlays(Sublette);
map.removeOverlays(Topeka);
map.removeOverlays(Tyro);
map.removeOverlays(Wichita);
setTimeout(function(){map.addOverlays(Arkansas_City)},1000);
setTimeout(function(){map.addOverlays(Chanute)},1000);
setTimeout(function(){map.addOverlays(Colby)},1000);
setTimeout(function(){map.addOverlays(Elbing)},1000);
setTimeout(function(){map.addOverlays(Emporia)},1000);
setTimeout(function(){map.addOverlays(Great_Bend)},1000);
setTimeout(function(){map.addOverlays(Hugoton)},1000);
setTimeout(function(){map.addOverlays(Hutchinson)},1000);
setTimeout(function(){map.addOverlays(Independence)},1000);
setTimeout(function(){map.addOverlays(Iola)},1000);
setTimeout(function(){map.addOverlays(Kansas_City)},1000);
setTimeout(function(){map.addOverlays(Lawrence)},1000);
setTimeout(function(){map.addOverlays(Leavenworth)},1000);
setTimeout(function(){map.addOverlays(Manhattan)},1000);
setTimeout(function(){map.addOverlays(Marienthal)},1000);
setTimeout(function(){map.addOverlays(Mcpherson)},1000);
setTimeout(function(){map.addOverlays(Newton)},1000);
setTimeout(function(){map.addOverlays(Olathe)},1000);
setTimeout(function(){map.addOverlays(Ottawa)},1000);
setTimeout(function(){map.addOverlays(Overland_Park)},1000);
setTimeout(function(){map.addOverlays(Paola)},1000);
setTimeout(function(){map.addOverlays(Salina)},1000);
setTimeout(function(){map.addOverlays(Shawnee)},1000);
setTimeout(function(){map.addOverlays(Sublette)},1000);
setTimeout(function(){map.addOverlays(Topeka)},1000);
setTimeout(function(){map.addOverlays(Tyro)},1000);
setTimeout(function(){map.addOverlays(Wichita)},1000);
maxLng = -94.66752200;
maxLat = 39.39130000;
minLng = -101.31670000;
minLat = 37.03620000;
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(Arkansas_City);
map.removeOverlays(Chanute);
map.removeOverlays(Colby);
map.removeOverlays(Elbing);
map.removeOverlays(Emporia);
map.removeOverlays(Great_Bend);
map.removeOverlays(Hugoton);
map.removeOverlays(Hutchinson);
map.removeOverlays(Independence);
map.removeOverlays(Iola);
map.removeOverlays(Kansas_City);
map.removeOverlays(Lawrence);
map.removeOverlays(Leavenworth);
map.removeOverlays(Manhattan);
map.removeOverlays(Marienthal);
map.removeOverlays(Mcpherson);
map.removeOverlays(Newton);
map.removeOverlays(Olathe);
map.removeOverlays(Ottawa);
map.removeOverlays(Overland_Park);
map.removeOverlays(Paola);
map.removeOverlays(Salina);
map.removeOverlays(Shawnee);
map.removeOverlays(Sublette);
map.removeOverlays(Topeka);
map.removeOverlays(Tyro);
map.removeOverlays(Wichita);
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(Arkansas_City);map.removeOverlays(Arkansas_City);
map.removeOverlays(Chanute);
map.removeOverlays(Colby);
map.removeOverlays(Elbing);
map.removeOverlays(Emporia);
map.removeOverlays(Great_Bend);
map.removeOverlays(Hugoton);
map.removeOverlays(Hutchinson);
map.removeOverlays(Independence);
map.removeOverlays(Iola);
map.removeOverlays(Kansas_City);
map.removeOverlays(Lawrence);
map.removeOverlays(Leavenworth);
map.removeOverlays(Manhattan);
map.removeOverlays(Marienthal);
map.removeOverlays(Mcpherson);
map.removeOverlays(Newton);
map.removeOverlays(Olathe);
map.removeOverlays(Ottawa);
map.removeOverlays(Overland_Park);
map.removeOverlays(Paola);
map.removeOverlays(Salina);
map.removeOverlays(Shawnee);
map.removeOverlays(Sublette);
map.removeOverlays(Topeka);
map.removeOverlays(Tyro);
map.removeOverlays(Wichita);
map.addOverlays(Arkansas_City);
centerByArray(Arkansas_City, false, false);
cntMarker += Arkansas_City.length;
map.addOverlays(Chanute);
centerByArray(Chanute, false, false);
cntMarker += Chanute.length;
map.addOverlays(Colby);
centerByArray(Colby, false, false);
cntMarker += Colby.length;
map.addOverlays(Elbing);
centerByArray(Elbing, false, false);
cntMarker += Elbing.length;
map.addOverlays(Emporia);
centerByArray(Emporia, false, false);
cntMarker += Emporia.length;
map.addOverlays(Great_Bend);
centerByArray(Great_Bend, false, false);
cntMarker += Great_Bend.length;
map.addOverlays(Hugoton);
centerByArray(Hugoton, false, false);
cntMarker += Hugoton.length;
map.addOverlays(Hutchinson);
centerByArray(Hutchinson, false, false);
cntMarker += Hutchinson.length;
map.addOverlays(Independence);
centerByArray(Independence, false, false);
cntMarker += Independence.length;
map.addOverlays(Iola);
centerByArray(Iola, false, false);
cntMarker += Iola.length;
map.addOverlays(Kansas_City);
centerByArray(Kansas_City, false, false);
cntMarker += Kansas_City.length;
map.addOverlays(Lawrence);
centerByArray(Lawrence, false, false);
cntMarker += Lawrence.length;
map.addOverlays(Leavenworth);
centerByArray(Leavenworth, false, false);
cntMarker += Leavenworth.length;
map.addOverlays(Manhattan);
centerByArray(Manhattan, false, false);
cntMarker += Manhattan.length;
map.addOverlays(Marienthal);
centerByArray(Marienthal, false, false);
cntMarker += Marienthal.length;
map.addOverlays(Mcpherson);
centerByArray(Mcpherson, false, false);
cntMarker += Mcpherson.length;
map.addOverlays(Newton);
centerByArray(Newton, false, false);
cntMarker += Newton.length;
map.addOverlays(Olathe);
centerByArray(Olathe, false, false);
cntMarker += Olathe.length;
map.addOverlays(Ottawa);
centerByArray(Ottawa, false, false);
cntMarker += Ottawa.length;
map.addOverlays(Overland_Park);
centerByArray(Overland_Park, false, false);
cntMarker += Overland_Park.length;
map.addOverlays(Paola);
centerByArray(Paola, false, false);
cntMarker += Paola.length;
map.addOverlays(Salina);
centerByArray(Salina, false, false);
cntMarker += Salina.length;
map.addOverlays(Shawnee);
centerByArray(Shawnee, false, false);
cntMarker += Shawnee.length;
map.addOverlays(Sublette);
centerByArray(Sublette, false, false);
cntMarker += Sublette.length;
map.addOverlays(Topeka);
centerByArray(Topeka, false, false);
cntMarker += Topeka.length;
map.addOverlays(Tyro);
centerByArray(Tyro, false, false);
cntMarker += Tyro.length;
map.addOverlays(Wichita);
centerByArray(Wichita, false, false);
cntMarker += Wichita.length;
centerByArray(Arkansas_City,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///10872,10894,10918,10877,10893,11068,10943,10964,10968,10902,10911,10903,10967,10975,10880,10971,34348,10946,10955,10900,10909,10921,11066,10889,11060,10872,10894,10918,10877,33536,10915,10920,10893,33539,11068,10943,10899,10964,10968,10902,33540,10911,10957,10903,10975,10880,10971,34348,10946,10973,10904,33538,10955,10900,10909,10921,11066,10889,10892,33537,/all');
//window.open('/map.php?type=2&schools=10872,10894,10918,10877,10893,11068,10943,10964,10968,10902,10911,10903,10967,10975,10880,10971,34348,10946,10955,10900,10909,10921,11066,10889,11060,10872,10894,10918,10877,33536,10915,10920,10893,33539,11068,10943,10899,10964,10968,10902,33540,10911,10957,10903,10975,10880,10971,34348,10946,10973,10904,33538,10955,10900,10909,10921,11066,10889,10892,33537,&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;
}