function addMarkers(){
mySelect = document.getElementById('selection');
Boise = [];Coeur_Dalene = [];Meridian = [];Mountain_Home = [];Sun_Valley = [];Sandpoint = [];Eagle = [];Clark_Fork = [];Kuna = [];Driggs = [];Idaho_Falls = [];Caldwell = [];Donnelly = [];Mccall = [];Bonners_Ferry = [];Lewiston = [];Burley = [];Arco = [];mySelect.options[mySelect.options.length] = new Option("Arco schools",'all=Arco');
mySelect.options[mySelect.options.length] = new Option("Boise schools",'all=Boise');
mySelect.options[mySelect.options.length] = new Option("Bonners Ferry schools",'all=Bonners_Ferry');
mySelect.options[mySelect.options.length] = new Option("Burley schools",'all=Burley');
mySelect.options[mySelect.options.length] = new Option("Caldwell schools",'all=Caldwell');
mySelect.options[mySelect.options.length] = new Option("Clark Fork schools",'all=Clark_Fork');
mySelect.options[mySelect.options.length] = new Option("Coeur Dalene schools",'all=Coeur_Dalene');
mySelect.options[mySelect.options.length] = new Option("Donnelly schools",'all=Donnelly');
mySelect.options[mySelect.options.length] = new Option("Driggs schools",'all=Driggs');
mySelect.options[mySelect.options.length] = new Option("Eagle schools",'all=Eagle');
mySelect.options[mySelect.options.length] = new Option("Idaho Falls schools",'all=Idaho_Falls');
mySelect.options[mySelect.options.length] = new Option("Kuna schools",'all=Kuna');
mySelect.options[mySelect.options.length] = new Option("Lewiston schools",'all=Lewiston');
mySelect.options[mySelect.options.length] = new Option("Mccall schools",'all=Mccall');
mySelect.options[mySelect.options.length] = new Option("Meridian schools",'all=Meridian');
mySelect.options[mySelect.options.length] = new Option("Mountain Home schools",'all=Mountain_Home');
mySelect.options[mySelect.options.length] = new Option("Sandpoint schools",'all=Sandpoint');
mySelect.options[mySelect.options.length] = new Option("Sun Valley schools",'all=Sun_Valley');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Boise[Boise.length] = createMarker(new GPoint(-116.22318200,43.64629300),"
",iconGr);
mySelect.options[mySelect.options.length] = new Option("A Learning Tree Inc",'Boise=' + Boise.length);
Coeur_Dalene[Coeur_Dalene.length] = createMarker(new GPoint(-116.78959500,47.68561300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Abcd Day Care Center",'Coeur_Dalene=' + Coeur_Dalene.length);
Boise[Boise.length] = createMarker(new GPoint(-116.18749200,43.60242900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Arrowrock International School",'Boise=' + Boise.length);
Boise[Boise.length] = createMarker(new GPoint(-116.25819200,43.65798400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Challenger School-Boise Bloom",'Boise=' + Boise.length);
Meridian[Meridian.length] = createMarker(new GPoint(-116.41888100,43.66221400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Challenger School-Everest",'Meridian=' + Meridian.length);
Boise[Boise.length] = createMarker(new GPoint(-116.25819200,43.65798400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Challenger School—Boise",'Boise=' + Boise.length);
Meridian[Meridian.length] = createMarker(new GPoint(-116.41857700,43.66188600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Challenger School—Meridian",'Meridian=' + Meridian.length);
Mountain_Home[Mountain_Home.length] = createMarker(new GPoint(-115.68627500,43.13386100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Children S House Montessori",'Mountain_Home=' + Mountain_Home.length);
Boise[Boise.length] = createMarker(new GPoint(-116.19775300,43.62325000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Children's School Of Boise",'Boise=' + Boise.length);
Coeur_Dalene[Coeur_Dalene.length] = createMarker(new GPoint(-116.79043700,47.72023000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Children's Village Academy",'Coeur_Dalene=' + Coeur_Dalene.length);
Coeur_Dalene[Coeur_Dalene.length] = createMarker(new GPoint(-116.80390900,47.72986300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Children's Village Inc",'Coeur_Dalene=' + Coeur_Dalene.length);
Mountain_Home[Mountain_Home.length] = createMarker(new GPoint(-115.68604500,43.13393700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Childrens House",'Mountain_Home=' + Mountain_Home.length);
Boise[Boise.length] = createMarker(new GPoint(-116.33544800,43.64466300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cloverdale Montessori",'Boise=' + Boise.length);
Sun_Valley[Sun_Valley.length] = createMarker(new GPoint(-114.33428300,43.67955100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Community School",'Sun_Valley=' + Sun_Valley.length);
Boise[Boise.length] = createMarker(new GPoint(-116.24371400,43.60003400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Creative Childrens Center",'Boise=' + Boise.length);
Sandpoint[Sandpoint.length] = createMarker(new GPoint(-116.56006600,48.27196300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Cynthia S Preschool & Kindergarten",'Sandpoint=' + Sandpoint.length);
Eagle[Eagle.length] = createMarker(new GPoint(-116.35483200,43.68776300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Eagle Montessori Center",'Eagle=' + Eagle.length);
Clark_Fork[Clark_Fork.length] = createMarker(new GPoint(-116.22560000,48.08430000),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Elk Mountain Academy",'Clark_Fork=' + Clark_Fork.length);
Boise[Boise.length] = createMarker(new GPoint(-116.20715600,43.61145900),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Foothills School of Arts and Sciences",'Boise=' + Boise.length);
Boise[Boise.length] = createMarker(new GPoint(-116.23703900,43.65760700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hillside Academy",'Boise=' + Boise.length);
Kuna[Kuna.length] = createMarker(new GPoint(-116.39522000,43.51745200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Independent Child Montessori School",'Kuna=' + Kuna.length);
Boise[Boise.length] = createMarker(new GPoint(-116.22108900,43.64013700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Keystone Montessori Center",'Boise=' + Boise.length);
Boise[Boise.length] = createMarker(new GPoint(-116.20851000,43.58128500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Kids Connection Montessori",'Boise=' + Boise.length);
Coeur_Dalene[Coeur_Dalene.length] = createMarker(new GPoint(-116.79865100,47.69686700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Kootenai Academy",'Coeur_Dalene=' + Coeur_Dalene.length);
Driggs[Driggs.length] = createMarker(new GPoint(-111.11311100,43.72657300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("The Learning Academy Of Teton Valley",'Driggs=' + Driggs.length);
Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-112.03424500,43.49243500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Little Peoples Academy",'Idaho_Falls=' + Idaho_Falls.length);
Coeur_Dalene[Coeur_Dalene.length] = createMarker(new GPoint(-116.78337900,47.68256300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Montessori,messes&magic",'Coeur_Dalene=' + Coeur_Dalene.length);
Caldwell[Caldwell.length] = createMarker(new GPoint(-116.69540900,43.65495600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("New Horizon",'Caldwell=' + Caldwell.length);
Boise[Boise.length] = createMarker(new GPoint(-116.18229300,43.58509100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("New Horizon Child Care",'Boise=' + Boise.length);
Donnelly[Donnelly.length] = createMarker(new GPoint(-116.09874100,44.69414100),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("North Fork School",'Donnelly=' + Donnelly.length);
Mccall[Mccall.length] = createMarker(new GPoint(-116.04339000,44.87728000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("North Fork School",'Mccall=' + Mccall.length);
Boise[Boise.length] = createMarker(new GPoint(-116.27805100,43.62681600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Northview Montessori School",'Boise=' + Boise.length);
Bonners_Ferry[Bonners_Ferry.length] = createMarker(new GPoint(-116.47180000,48.75710000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Northwest Academy",'Bonners_Ferry=' + Bonners_Ferry.length);
Lewiston[Lewiston.length] = createMarker(new GPoint(-117.01427700,46.41423500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Northwest Children's Home Educ",'Lewiston=' + Lewiston.length);
Boise[Boise.length] = createMarker(new GPoint(-116.27913300,43.67355200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ol Mcdonalds Montessori Plus Child Care Inc",'Boise=' + Boise.length);
Coeur_Dalene[Coeur_Dalene.length] = createMarker(new GPoint(-116.78000000,47.67000000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Project Y.e.s.",'Coeur_Dalene=' + Coeur_Dalene.length);
Burley[Burley.length] = createMarker(new GPoint(-113.79739500,42.52676300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Reach Me Teach Me",'Burley=' + Burley.length);
Boise[Boise.length] = createMarker(new GPoint(-116.11600400,43.56620500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Riverstone International School",'Boise=' + Boise.length);
Boise[Boise.length] = createMarker(new GPoint(-116.23880600,43.59856300),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Rose Hill Montessori",'Boise=' + Boise.length);
Sandpoint[Sandpoint.length] = createMarker(new GPoint(-116.47396900,48.45924700),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sandpoint Waldorf School",'Sandpoint=' + Sandpoint.length);
Sandpoint[Sandpoint.length] = createMarker(new GPoint(-116.60017300,48.27352500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Selkirk School",'Sandpoint=' + Sandpoint.length);
Boise[Boise.length] = createMarker(new GPoint(-116.22837900,43.59671500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Sheridan Academy",'Boise=' + Boise.length);
Meridian[Meridian.length] = createMarker(new GPoint(-116.41998600,43.61936200),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Smaller Scholar Montessori School",'Meridian=' + Meridian.length);
Idaho_Falls[Idaho_Falls.length] = createMarker(new GPoint(-111.97684600,43.49626500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Snake River Montessori School",'Idaho_Falls=' + Idaho_Falls.length);
Coeur_Dalene[Coeur_Dalene.length] = createMarker(new GPoint(-116.79193000,47.67720000),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Stepping Stones Learning Center",'Coeur_Dalene=' + Coeur_Dalene.length);
Arco[Arco.length] = createMarker(new GPoint(-113.28656100,43.58429000),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Wisdom Ranch School",'Arco=' + Arco.length);
map.removeOverlays(Arco);
map.removeOverlays(Boise);
map.removeOverlays(Bonners_Ferry);
map.removeOverlays(Burley);
map.removeOverlays(Caldwell);
map.removeOverlays(Clark_Fork);
map.removeOverlays(Coeur_Dalene);
map.removeOverlays(Donnelly);
map.removeOverlays(Driggs);
map.removeOverlays(Eagle);
map.removeOverlays(Idaho_Falls);
map.removeOverlays(Kuna);
map.removeOverlays(Lewiston);
map.removeOverlays(Mccall);
map.removeOverlays(Meridian);
map.removeOverlays(Mountain_Home);
map.removeOverlays(Sandpoint);
map.removeOverlays(Sun_Valley);
setTimeout(function(){map.addOverlays(Arco)},1000);
setTimeout(function(){map.addOverlays(Boise)},1000);
setTimeout(function(){map.addOverlays(Bonners_Ferry)},1000);
setTimeout(function(){map.addOverlays(Burley)},1000);
setTimeout(function(){map.addOverlays(Caldwell)},1000);
setTimeout(function(){map.addOverlays(Clark_Fork)},1000);
setTimeout(function(){map.addOverlays(Coeur_Dalene)},1000);
setTimeout(function(){map.addOverlays(Donnelly)},1000);
setTimeout(function(){map.addOverlays(Driggs)},1000);
setTimeout(function(){map.addOverlays(Eagle)},1000);
setTimeout(function(){map.addOverlays(Idaho_Falls)},1000);
setTimeout(function(){map.addOverlays(Kuna)},1000);
setTimeout(function(){map.addOverlays(Lewiston)},1000);
setTimeout(function(){map.addOverlays(Mccall)},1000);
setTimeout(function(){map.addOverlays(Meridian)},1000);
setTimeout(function(){map.addOverlays(Mountain_Home)},1000);
setTimeout(function(){map.addOverlays(Sandpoint)},1000);
setTimeout(function(){map.addOverlays(Sun_Valley)},1000);
maxLng = -111.11311100;
maxLat = 48.75710000;
minLng = -117.01427700;
minLat = 42.52676300;
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(Arco);
map.removeOverlays(Boise);
map.removeOverlays(Bonners_Ferry);
map.removeOverlays(Burley);
map.removeOverlays(Caldwell);
map.removeOverlays(Clark_Fork);
map.removeOverlays(Coeur_Dalene);
map.removeOverlays(Donnelly);
map.removeOverlays(Driggs);
map.removeOverlays(Eagle);
map.removeOverlays(Idaho_Falls);
map.removeOverlays(Kuna);
map.removeOverlays(Lewiston);
map.removeOverlays(Mccall);
map.removeOverlays(Meridian);
map.removeOverlays(Mountain_Home);
map.removeOverlays(Sandpoint);
map.removeOverlays(Sun_Valley);
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(Boise);map.removeOverlays(Arco);
map.removeOverlays(Boise);
map.removeOverlays(Bonners_Ferry);
map.removeOverlays(Burley);
map.removeOverlays(Caldwell);
map.removeOverlays(Clark_Fork);
map.removeOverlays(Coeur_Dalene);
map.removeOverlays(Donnelly);
map.removeOverlays(Driggs);
map.removeOverlays(Eagle);
map.removeOverlays(Idaho_Falls);
map.removeOverlays(Kuna);
map.removeOverlays(Lewiston);
map.removeOverlays(Mccall);
map.removeOverlays(Meridian);
map.removeOverlays(Mountain_Home);
map.removeOverlays(Sandpoint);
map.removeOverlays(Sun_Valley);
map.addOverlays(Arco);
centerByArray(Arco, false, false);
cntMarker += Arco.length;
map.addOverlays(Boise);
centerByArray(Boise, false, false);
cntMarker += Boise.length;
map.addOverlays(Bonners_Ferry);
centerByArray(Bonners_Ferry, false, false);
cntMarker += Bonners_Ferry.length;
map.addOverlays(Burley);
centerByArray(Burley, false, false);
cntMarker += Burley.length;
map.addOverlays(Caldwell);
centerByArray(Caldwell, false, false);
cntMarker += Caldwell.length;
map.addOverlays(Clark_Fork);
centerByArray(Clark_Fork, false, false);
cntMarker += Clark_Fork.length;
map.addOverlays(Coeur_Dalene);
centerByArray(Coeur_Dalene, false, false);
cntMarker += Coeur_Dalene.length;
map.addOverlays(Donnelly);
centerByArray(Donnelly, false, false);
cntMarker += Donnelly.length;
map.addOverlays(Driggs);
centerByArray(Driggs, false, false);
cntMarker += Driggs.length;
map.addOverlays(Eagle);
centerByArray(Eagle, false, false);
cntMarker += Eagle.length;
map.addOverlays(Idaho_Falls);
centerByArray(Idaho_Falls, false, false);
cntMarker += Idaho_Falls.length;
map.addOverlays(Kuna);
centerByArray(Kuna, false, false);
cntMarker += Kuna.length;
map.addOverlays(Lewiston);
centerByArray(Lewiston, false, false);
cntMarker += Lewiston.length;
map.addOverlays(Mccall);
centerByArray(Mccall, false, false);
cntMarker += Mccall.length;
map.addOverlays(Meridian);
centerByArray(Meridian, false, false);
cntMarker += Meridian.length;
map.addOverlays(Mountain_Home);
centerByArray(Mountain_Home, false, false);
cntMarker += Mountain_Home.length;
map.addOverlays(Sandpoint);
centerByArray(Sandpoint, false, false);
cntMarker += Sandpoint.length;
map.addOverlays(Sun_Valley);
centerByArray(Sun_Valley, false, false);
cntMarker += Sun_Valley.length;
centerByArray(Boise,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///31177,31170,8277,8286,8278,8268,8238,8276,8225,8259,35635,8270,8302,31169,32346,36246,27785,8301,8229,8315,8242,31170,8319,8311,35022,31171,34749,8277,8324,8286,8323,8312,31175,8225,8259,8230,8299,35635,35557,8317,8322,8304,8318,8272,8270,36247,27784,31168,31174,8226,8316,8284,8285,8302,/all');
//window.open('/map.php?type=2&schools=31177,31170,8277,8286,8278,8268,8238,8276,8225,8259,35635,8270,8302,31169,32346,36246,27785,8301,8229,8315,8242,31170,8319,8311,35022,31171,34749,8277,8324,8286,8323,8312,31175,8225,8259,8230,8299,35635,35557,8317,8322,8304,8318,8272,8270,36247,27784,31168,31174,8226,8316,8284,8285,8302,&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;
}