function addMarkers(){
mySelect = document.getElementById('selection');
Arkansas_City = [];Elbing = [];Olathe = [];Ottawa = [];Garden_City = [];Topeka = [];Wichita = [];Hutchinson = [];Great_Bend = [];Chanute = [];Halstead = [];Mcpherson = [];Salina = [];Emporia = [];Manhattan = [];Colby = [];Hugoton = [];Iola = [];Columbus = [];Marienthal = [];Kansas_City = [];Newton = [];Lawrence = [];Tipton = [];Tyro = [];Leavenworth = [];Overland_Park = [];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("Columbus schools",'all=Columbus');
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("Garden City schools",'all=Garden_City');
mySelect.options[mySelect.options.length] = new Option("Great Bend schools",'all=Great_Bend');
mySelect.options[mySelect.options.length] = new Option("Halstead schools",'all=Halstead');
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("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("Salina schools",'all=Salina');
mySelect.options[mySelect.options.length] = new Option("Tipton schools",'all=Tipton');
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);
Olathe[Olathe.length] = createMarker(new GPoint(-94.76118900,38.84026000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Berean Christian School",'Olathe=' + Olathe.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);
Garden_City[Garden_City.length] = createMarker(new GPoint(-100.85631400,37.98935600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bible Christian Academy",'Garden_City=' + Garden_City.length);
Topeka[Topeka.length] = createMarker(new GPoint(-95.68799500,39.05497100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cair Paravel Latin School",'Topeka=' + Topeka.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);
Halstead[Halstead.length] = createMarker(new GPoint(-97.53705100,38.08450600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Countryside Christian School",'Halstead=' + Halstead.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);
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);
Olathe[Olathe.length] = createMarker(new GPoint(-94.80416300,38.89083400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Kedesh Academy",'Olathe=' + Olathe.length);
Columbus[Columbus.length] = createMarker(new GPoint(-94.83073100,37.16486200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Life Christian School",'Columbus=' + Columbus.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.34562500,38.03306300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Newton Bible Christian School",'Newton=' + Newton.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);
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);
Lawrence[Lawrence.length] = createMarker(new GPoint(-95.21677500,38.94575400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sunshine Acres Montessori School",'Lawrence=' + Lawrence.length);
Tipton[Tipton.length] = createMarker(new GPoint(-98.46633900,39.33983000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Tipton Christian School",'Tipton=' + Tipton.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);
map.removeOverlays(Arkansas_City);
map.removeOverlays(Chanute);
map.removeOverlays(Colby);
map.removeOverlays(Columbus);
map.removeOverlays(Elbing);
map.removeOverlays(Emporia);
map.removeOverlays(Garden_City);
map.removeOverlays(Great_Bend);
map.removeOverlays(Halstead);
map.removeOverlays(Hugoton);
map.removeOverlays(Hutchinson);
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(Salina);
map.removeOverlays(Tipton);
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(Columbus)},1000);
setTimeout(function(){map.addOverlays(Elbing)},1000);
setTimeout(function(){map.addOverlays(Emporia)},1000);
setTimeout(function(){map.addOverlays(Garden_City)},1000);
setTimeout(function(){map.addOverlays(Great_Bend)},1000);
setTimeout(function(){map.addOverlays(Halstead)},1000);
setTimeout(function(){map.addOverlays(Hugoton)},1000);
setTimeout(function(){map.addOverlays(Hutchinson)},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(Salina)},1000);
setTimeout(function(){map.addOverlays(Tipton)},1000);
setTimeout(function(){map.addOverlays(Topeka)},1000);
setTimeout(function(){map.addOverlays(Tyro)},1000);
setTimeout(function(){map.addOverlays(Wichita)},1000);
maxLng = -94.69326800;
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(Columbus);
map.removeOverlays(Elbing);
map.removeOverlays(Emporia);
map.removeOverlays(Garden_City);
map.removeOverlays(Great_Bend);
map.removeOverlays(Halstead);
map.removeOverlays(Hugoton);
map.removeOverlays(Hutchinson);
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(Salina);
map.removeOverlays(Tipton);
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(Columbus);
map.removeOverlays(Elbing);
map.removeOverlays(Emporia);
map.removeOverlays(Garden_City);
map.removeOverlays(Great_Bend);
map.removeOverlays(Halstead);
map.removeOverlays(Hugoton);
map.removeOverlays(Hutchinson);
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(Salina);
map.removeOverlays(Tipton);
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(Columbus);
centerByArray(Columbus, false, false);
cntMarker += Columbus.length;
map.addOverlays(Elbing);
centerByArray(Elbing, false, false);
cntMarker += Elbing.length;
map.addOverlays(Emporia);
centerByArray(Emporia, false, false);
cntMarker += Emporia.length;
map.addOverlays(Garden_City);
centerByArray(Garden_City, false, false);
cntMarker += Garden_City.length;
map.addOverlays(Great_Bend);
centerByArray(Great_Bend, false, false);
cntMarker += Great_Bend.length;
map.addOverlays(Halstead);
centerByArray(Halstead, false, false);
cntMarker += Halstead.length;
map.addOverlays(Hugoton);
centerByArray(Hugoton, false, false);
cntMarker += Hugoton.length;
map.addOverlays(Hutchinson);
centerByArray(Hutchinson, false, false);
cntMarker += Hutchinson.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(Salina);
centerByArray(Salina, false, false);
cntMarker += Salina.length;
map.addOverlays(Tipton);
centerByArray(Tipton, false, false);
cntMarker += Tipton.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,33159,10877,10893,11068,10964,10902,10911,10903,10967,10878,10948,10975,10880,10946,10888,10909,11066,10889,11060,10872,10894,10918,33159,10877,33536,30672,10915,31306,10920,10893,33539,11068,10899,10964,11053,10902,33540,10911,10957,10903,10966,10878,10948,10975,10880,10946,10904,33538,32433,10888,10909,11066,10889,10892,33537,/all');
//window.open('/map.php?type=2&schools=10872,10894,10918,33159,10877,10893,11068,10964,10902,10911,10903,10967,10878,10948,10975,10880,10946,10888,10909,11066,10889,11060,10872,10894,10918,33159,10877,33536,30672,10915,31306,10920,10893,33539,11068,10899,10964,11053,10902,33540,10911,10957,10903,10966,10878,10948,10975,10880,10946,10904,33538,32433,10888,10909,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;
}