function addMarkers(){
mySelect = document.getElementById('selection');
Bartlesville = [];Norman = [];Purcell = [];Del_City = [];Oilton = [];Corn = [];Ponca_City = [];Oklahoma_City = [];Sapulpa = [];Enid = [];Sulphur = [];Shawnee = [];Tulsa = [];Miami = [];Hillsdale = [];Lawton = [];Claremore = [];Tahlequah = [];Sand_Springs = [];Edmond = [];Moore = [];Owasso = [];Spencer = [];Stillwater = [];Clinton = [];mySelect.options[mySelect.options.length] = new Option("Bartlesville schools",'all=Bartlesville');
mySelect.options[mySelect.options.length] = new Option("Claremore schools",'all=Claremore');
mySelect.options[mySelect.options.length] = new Option("Clinton schools",'all=Clinton');
mySelect.options[mySelect.options.length] = new Option("Corn schools",'all=Corn');
mySelect.options[mySelect.options.length] = new Option("Del City schools",'all=Del_City');
mySelect.options[mySelect.options.length] = new Option("Edmond schools",'all=Edmond');
mySelect.options[mySelect.options.length] = new Option("Enid schools",'all=Enid');
mySelect.options[mySelect.options.length] = new Option("Hillsdale schools",'all=Hillsdale');
mySelect.options[mySelect.options.length] = new Option("Lawton schools",'all=Lawton');
mySelect.options[mySelect.options.length] = new Option("Miami schools",'all=Miami');
mySelect.options[mySelect.options.length] = new Option("Moore schools",'all=Moore');
mySelect.options[mySelect.options.length] = new Option("Norman schools",'all=Norman');
mySelect.options[mySelect.options.length] = new Option("Oilton schools",'all=Oilton');
mySelect.options[mySelect.options.length] = new Option("Oklahoma City schools",'all=Oklahoma_City');
mySelect.options[mySelect.options.length] = new Option("Owasso schools",'all=Owasso');
mySelect.options[mySelect.options.length] = new Option("Ponca City schools",'all=Ponca_City');
mySelect.options[mySelect.options.length] = new Option("Purcell schools",'all=Purcell');
mySelect.options[mySelect.options.length] = new Option("Sand Springs schools",'all=Sand_Springs');
mySelect.options[mySelect.options.length] = new Option("Sapulpa schools",'all=Sapulpa');
mySelect.options[mySelect.options.length] = new Option("Shawnee schools",'all=Shawnee');
mySelect.options[mySelect.options.length] = new Option("Spencer schools",'all=Spencer');
mySelect.options[mySelect.options.length] = new Option("Stillwater schools",'all=Stillwater');
mySelect.options[mySelect.options.length] = new Option("Sulphur schools",'all=Sulphur');
mySelect.options[mySelect.options.length] = new Option("Tahlequah schools",'all=Tahlequah');
mySelect.options[mySelect.options.length] = new Option("Tulsa schools",'all=Tulsa');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Bartlesville[Bartlesville.length] = createMarker(new GPoint(-95.93128800,36.67013700),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("American Christian/bartlesvill",'Bartlesville=' + Bartlesville.length);
Norman[Norman.length] = createMarker(new GPoint(-97.42662700,35.19667400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Blue Eagle Christian Academy",'Norman=' + Norman.length);
Purcell[Purcell.length] = createMarker(new GPoint(-97.40635000,35.00791000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Christian Crusaders Academy",'Purcell=' + Purcell.length);
Del_City[Del_City.length] = createMarker(new GPoint(-97.43848100,35.43707100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Christian Heritage Academy",'Del_City=' + Del_City.length);
Oilton[Oilton.length] = createMarker(new GPoint(-96.50820000,35.97530000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cimarron Christian Academy",'Oilton=' + Oilton.length);
Norman[Norman.length] = createMarker(new GPoint(-97.48609000,35.25365700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Community Christian School",'Norman=' + Norman.length);
Corn[Corn.length] = createMarker(new GPoint(-98.80007900,35.39977000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Corn Bible Academy",'Corn=' + Corn.length);
Ponca_City[Ponca_City.length] = createMarker(new GPoint(-97.08512800,36.74311300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cornerstone Community Christia",'Ponca_City=' + Ponca_City.length);
Oklahoma_City[Oklahoma_City.length] = createMarker(new GPoint(-97.58490100,35.62012000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Crossings Christian School",'Oklahoma_City=' + Oklahoma_City.length);
Sapulpa[Sapulpa.length] = createMarker(new GPoint(-96.11671200,35.99146700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Eagle Point Christian Academy",'Sapulpa=' + Sapulpa.length);
Enid[Enid.length] = createMarker(new GPoint(-97.90923900,36.39066300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Emmanuel Christian School",'Enid=' + Enid.length);
Sulphur[Sulphur.length] = createMarker(new GPoint(-96.98594400,34.49626600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Faith Christian School",'Sulphur=' + Sulphur.length);
Shawnee[Shawnee.length] = createMarker(new GPoint(-96.92280000,35.32870000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Family Of Faith Christian School",'Shawnee=' + Shawnee.length);
Tulsa[Tulsa.length] = createMarker(new GPoint(-95.85108900,36.02305600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Grace Christian School",'Tulsa=' + Tulsa.length);
Miami[Miami.length] = createMarker(new GPoint(-94.87961000,36.87441500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Green Country Christian School",'Miami=' + Miami.length);
Tulsa[Tulsa.length] = createMarker(new GPoint(-95.91316100,36.11790200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Happy Hands Early Childhood",'Tulsa=' + Tulsa.length);
Hillsdale[Hillsdale.length] = createMarker(new GPoint(-97.99190000,36.56350000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hillsdale Christian School",'Hillsdale=' + Hillsdale.length);
Oklahoma_City[Oklahoma_City.length] = createMarker(new GPoint(-97.58484300,35.58479300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("King's Gate Christian School",'Oklahoma_City=' + Oklahoma_City.length);
Lawton[Lawton.length] = createMarker(new GPoint(-98.53410000,34.61250000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lawton Christian School Pk-12",'Lawton=' + Lawton.length);
Claremore[Claremore.length] = createMarker(new GPoint(-95.61026200,36.31008900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Legacy Christian School",'Claremore=' + Claremore.length);
Oklahoma_City[Oklahoma_City.length] = createMarker(new GPoint(-97.31791400,35.39931200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Life Christian Academy",'Oklahoma_City=' + Oklahoma_City.length);
Tahlequah[Tahlequah.length] = createMarker(new GPoint(-94.98540000,35.89540000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Markoma Christian School",'Tahlequah=' + Tahlequah.length);
Tulsa[Tulsa.length] = createMarker(new GPoint(-95.87960100,36.07526300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mingo Valley Christian School",'Tulsa=' + Tulsa.length);
Sand_Springs[Sand_Springs.length] = createMarker(new GPoint(-96.10618400,36.10448300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Moriah Christian Academy",'Sand_Springs=' + Sand_Springs.length);
Oklahoma_City[Oklahoma_City.length] = createMarker(new GPoint(-97.65423000,35.54864100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Northwest Christian School",'Oklahoma_City=' + Oklahoma_City.length);
Enid[Enid.length] = createMarker(new GPoint(-97.94511500,36.40516300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Oklahoma Bible Academy",'Enid=' + Enid.length);
Edmond[Edmond.length] = createMarker(new GPoint(-97.47795800,35.65447100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Oklahoma Christian School",'Edmond=' + Edmond.length);
Moore[Moore.length] = createMarker(new GPoint(-97.48118500,35.34457000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Oklahoma City Christian Academy",'Moore=' + Moore.length);
Tulsa[Tulsa.length] = createMarker(new GPoint(-95.98869200,36.16845600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Paradise Christian Academy",'Tulsa=' + Tulsa.length);
Ponca_City[Ponca_City.length] = createMarker(new GPoint(-97.06171700,36.71625300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ponca City Christian Academy",'Ponca_City=' + Ponca_City.length);
Owasso[Owasso.length] = createMarker(new GPoint(-95.82418500,36.30769900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Rejoice Christian School",'Owasso=' + Owasso.length);
Tahlequah[Tahlequah.length] = createMarker(new GPoint(-94.98003700,35.87863600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Shiloh Christian School",'Tahlequah=' + Tahlequah.length);
Spencer[Spencer.length] = createMarker(new GPoint(-97.37941500,35.49563700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Spencer Road Christian School",'Spencer=' + Spencer.length);
Stillwater[Stillwater.length] = createMarker(new GPoint(-97.05447300,36.17390900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sunnybrook Christian School",'Stillwater=' + Stillwater.length);
Stillwater[Stillwater.length] = createMarker(new GPoint(-97.06956900,36.13184900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Trinity Christian School",'Stillwater=' + Stillwater.length);
Lawton[Lawton.length] = createMarker(new GPoint(-98.41133100,34.59053700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Union Baptist Christian School",'Lawton=' + Lawton.length);
Bartlesville[Bartlesville.length] = createMarker(new GPoint(-95.95304000,36.72599700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Wesleyan Christian School",'Bartlesville=' + Bartlesville.length);
Clinton[Clinton.length] = createMarker(new GPoint(-98.99135200,35.46533700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Western Oklahoma Christian School",'Clinton=' + Clinton.length);
Tulsa[Tulsa.length] = createMarker(new GPoint(-96.00364500,36.09216300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Winnetka Heights Christian School",'Tulsa=' + Tulsa.length);
Tulsa[Tulsa.length] = createMarker(new GPoint(-95.84882100,36.16079400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Wright Christian Academy",'Tulsa=' + Tulsa.length);
map.removeOverlays(Bartlesville);
map.removeOverlays(Claremore);
map.removeOverlays(Clinton);
map.removeOverlays(Corn);
map.removeOverlays(Del_City);
map.removeOverlays(Edmond);
map.removeOverlays(Enid);
map.removeOverlays(Hillsdale);
map.removeOverlays(Lawton);
map.removeOverlays(Miami);
map.removeOverlays(Moore);
map.removeOverlays(Norman);
map.removeOverlays(Oilton);
map.removeOverlays(Oklahoma_City);
map.removeOverlays(Owasso);
map.removeOverlays(Ponca_City);
map.removeOverlays(Purcell);
map.removeOverlays(Sand_Springs);
map.removeOverlays(Sapulpa);
map.removeOverlays(Shawnee);
map.removeOverlays(Spencer);
map.removeOverlays(Stillwater);
map.removeOverlays(Sulphur);
map.removeOverlays(Tahlequah);
map.removeOverlays(Tulsa);
setTimeout(function(){map.addOverlays(Bartlesville)},1000);
setTimeout(function(){map.addOverlays(Claremore)},1000);
setTimeout(function(){map.addOverlays(Clinton)},1000);
setTimeout(function(){map.addOverlays(Corn)},1000);
setTimeout(function(){map.addOverlays(Del_City)},1000);
setTimeout(function(){map.addOverlays(Edmond)},1000);
setTimeout(function(){map.addOverlays(Enid)},1000);
setTimeout(function(){map.addOverlays(Hillsdale)},1000);
setTimeout(function(){map.addOverlays(Lawton)},1000);
setTimeout(function(){map.addOverlays(Miami)},1000);
setTimeout(function(){map.addOverlays(Moore)},1000);
setTimeout(function(){map.addOverlays(Norman)},1000);
setTimeout(function(){map.addOverlays(Oilton)},1000);
setTimeout(function(){map.addOverlays(Oklahoma_City)},1000);
setTimeout(function(){map.addOverlays(Owasso)},1000);
setTimeout(function(){map.addOverlays(Ponca_City)},1000);
setTimeout(function(){map.addOverlays(Purcell)},1000);
setTimeout(function(){map.addOverlays(Sand_Springs)},1000);
setTimeout(function(){map.addOverlays(Sapulpa)},1000);
setTimeout(function(){map.addOverlays(Shawnee)},1000);
setTimeout(function(){map.addOverlays(Spencer)},1000);
setTimeout(function(){map.addOverlays(Stillwater)},1000);
setTimeout(function(){map.addOverlays(Sulphur)},1000);
setTimeout(function(){map.addOverlays(Tahlequah)},1000);
setTimeout(function(){map.addOverlays(Tulsa)},1000);
maxLng = -94.87961000;
maxLat = 36.87441500;
minLng = -98.99135200;
minLat = 34.49626600;
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(Bartlesville);
map.removeOverlays(Claremore);
map.removeOverlays(Clinton);
map.removeOverlays(Corn);
map.removeOverlays(Del_City);
map.removeOverlays(Edmond);
map.removeOverlays(Enid);
map.removeOverlays(Hillsdale);
map.removeOverlays(Lawton);
map.removeOverlays(Miami);
map.removeOverlays(Moore);
map.removeOverlays(Norman);
map.removeOverlays(Oilton);
map.removeOverlays(Oklahoma_City);
map.removeOverlays(Owasso);
map.removeOverlays(Ponca_City);
map.removeOverlays(Purcell);
map.removeOverlays(Sand_Springs);
map.removeOverlays(Sapulpa);
map.removeOverlays(Shawnee);
map.removeOverlays(Spencer);
map.removeOverlays(Stillwater);
map.removeOverlays(Sulphur);
map.removeOverlays(Tahlequah);
map.removeOverlays(Tulsa);
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(Bartlesville);map.removeOverlays(Bartlesville);
map.removeOverlays(Claremore);
map.removeOverlays(Clinton);
map.removeOverlays(Corn);
map.removeOverlays(Del_City);
map.removeOverlays(Edmond);
map.removeOverlays(Enid);
map.removeOverlays(Hillsdale);
map.removeOverlays(Lawton);
map.removeOverlays(Miami);
map.removeOverlays(Moore);
map.removeOverlays(Norman);
map.removeOverlays(Oilton);
map.removeOverlays(Oklahoma_City);
map.removeOverlays(Owasso);
map.removeOverlays(Ponca_City);
map.removeOverlays(Purcell);
map.removeOverlays(Sand_Springs);
map.removeOverlays(Sapulpa);
map.removeOverlays(Shawnee);
map.removeOverlays(Spencer);
map.removeOverlays(Stillwater);
map.removeOverlays(Sulphur);
map.removeOverlays(Tahlequah);
map.removeOverlays(Tulsa);
map.addOverlays(Bartlesville);
centerByArray(Bartlesville, false, false);
cntMarker += Bartlesville.length;
map.addOverlays(Claremore);
centerByArray(Claremore, false, false);
cntMarker += Claremore.length;
map.addOverlays(Clinton);
centerByArray(Clinton, false, false);
cntMarker += Clinton.length;
map.addOverlays(Corn);
centerByArray(Corn, false, false);
cntMarker += Corn.length;
map.addOverlays(Del_City);
centerByArray(Del_City, false, false);
cntMarker += Del_City.length;
map.addOverlays(Edmond);
centerByArray(Edmond, false, false);
cntMarker += Edmond.length;
map.addOverlays(Enid);
centerByArray(Enid, false, false);
cntMarker += Enid.length;
map.addOverlays(Hillsdale);
centerByArray(Hillsdale, false, false);
cntMarker += Hillsdale.length;
map.addOverlays(Lawton);
centerByArray(Lawton, false, false);
cntMarker += Lawton.length;
map.addOverlays(Miami);
centerByArray(Miami, false, false);
cntMarker += Miami.length;
map.addOverlays(Moore);
centerByArray(Moore, false, false);
cntMarker += Moore.length;
map.addOverlays(Norman);
centerByArray(Norman, false, false);
cntMarker += Norman.length;
map.addOverlays(Oilton);
centerByArray(Oilton, false, false);
cntMarker += Oilton.length;
map.addOverlays(Oklahoma_City);
centerByArray(Oklahoma_City, false, false);
cntMarker += Oklahoma_City.length;
map.addOverlays(Owasso);
centerByArray(Owasso, false, false);
cntMarker += Owasso.length;
map.addOverlays(Ponca_City);
centerByArray(Ponca_City, false, false);
cntMarker += Ponca_City.length;
map.addOverlays(Purcell);
centerByArray(Purcell, false, false);
cntMarker += Purcell.length;
map.addOverlays(Sand_Springs);
centerByArray(Sand_Springs, false, false);
cntMarker += Sand_Springs.length;
map.addOverlays(Sapulpa);
centerByArray(Sapulpa, false, false);
cntMarker += Sapulpa.length;
map.addOverlays(Shawnee);
centerByArray(Shawnee, false, false);
cntMarker += Shawnee.length;
map.addOverlays(Spencer);
centerByArray(Spencer, false, false);
cntMarker += Spencer.length;
map.addOverlays(Stillwater);
centerByArray(Stillwater, false, false);
cntMarker += Stillwater.length;
map.addOverlays(Sulphur);
centerByArray(Sulphur, false, false);
cntMarker += Sulphur.length;
map.addOverlays(Tahlequah);
centerByArray(Tahlequah, false, false);
cntMarker += Tahlequah.length;
map.addOverlays(Tulsa);
centerByArray(Tulsa, false, false);
cntMarker += Tulsa.length;
centerByArray(Bartlesville,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///22443,22591,22469,22462,22532,22530,22504,22533,22451,22467,22472,22506,22538,22470,33656,33659,22544,22478,22574,22579,22486,22515,22596,22443,22591,22479,22592,22462,22532,22474,22493,22504,22585,33657,22533,22451,22467,22463,22472,36050,22506,22527,22538,22470,22537,33656,33659,22544,22478,22551,22574,22579,33661,22510,22546,22486,33658,22515,33660,22594,22596,/all');
//window.open('/map.php?type=2&schools=22443,22591,22469,22462,22532,22530,22504,22533,22451,22467,22472,22506,22538,22470,33656,33659,22544,22478,22574,22579,22486,22515,22596,22443,22591,22479,22592,22462,22532,22474,22493,22504,22585,33657,22533,22451,22467,22463,22472,36050,22506,22527,22538,22470,22537,33656,33659,22544,22478,22551,22574,22579,33661,22510,22546,22486,33658,22515,33660,22594,22596,&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;
}