function addMarkers()
{
mySelect = document.getElementById('selection');
Vancouver = [];Vancouver[Vancouver.length] = createMarker(new GPoint(-122.69298553,45.72369766),"
",iconBl);
mySelect.options[mySelect.options.length] = new Option("Alki Middle School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.67749786,45.66045761),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Benjamin Franklin Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.52210236,45.65726471),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Burnt Bridge Creek Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.52788544,45.64286423),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Burton Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.52960205,45.63583755),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Cascade Middle School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.69334412,45.72397614),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Chinook Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.67619324,45.62973785),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Clark Co Detention Center",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.54777527,45.64303589),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Clark County Vocational Skills Center",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.67859650,45.69303513),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Columbia River High School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-10.00000000,10.00000000),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Columbia Valley Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.55800629,45.66743469),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Covington Middle School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.53968048,45.61606216),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Crestline Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.66400146,45.65123749),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Discovery Middle School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.67930603,45.68864059),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Dwight D Eisenhower Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.52445221,45.64286423),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Early Childhood Center",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.67288208,45.62435913),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Early Childhood Education Center",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.56120300,45.61795044),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Ellsworth Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.52573395,45.63583755),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Evergreen High School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.52573395,45.63583755),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Evergreen Internet Academy",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.69926453,45.70738602),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Felida Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.62879944,45.64252090),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Fir Grove Childrens Center",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.54959106,45.62816238),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Fircrest Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.48624420,45.59416962),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Fishers Landing Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.61498260,45.63527679),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Fort Vancouver High School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.50209808,45.67778397),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Frontier Middle School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.69223785,45.64559555),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Fruit Valley Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.63959503,45.69333649),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Gaiser Middle School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.62652588,45.64237595),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Gate Work Study Program High School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.62597400,45.64314600),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Ged/re-entry Program",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.60552216,45.62177277),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("George C Marshall Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.57283020,45.71883011),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Glenwood Heights Prim Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.49370575,45.63589478),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Harmony Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.63686371,45.62604904),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Harney Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.62859344,45.65465546),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Harry S Truman Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.66622925,45.67256165),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hazel Dell Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.52750397,45.62784576),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hearthwood Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.53913879,45.67953873),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Heritage High School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.67288208,45.62435913),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Home Choice Academy",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.67499542,45.63573837),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hough Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.64768400,45.64152500),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Hudson's Bay High School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.54779816,45.65383911),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Image Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.67979431,45.68383789),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Jason Lee Middle School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.70252500,45.70722200),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Jefferson Middle School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.69290924,45.68879700),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lake Shore Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.57300568,45.71968079),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Laurin Middle School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.53050232,45.63887024),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Legacy High School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.53050232,45.63887024),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Legacy Home School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.62176514,45.64268112),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Lewis And Clark High School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.67499542,45.65224838),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Lincoln Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.56919861,45.63176346),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Marrion Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.62054443,45.63076782),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Martin Luther King Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.61122131,45.62345886),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Mcloughlin Middle School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.50449371,45.61916351),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mill Plain Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.63769531,45.63599014),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Minnehaha Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.51721954,45.61117554),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Mountain View High School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.58425800,45.62044800),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Nierenberg Center",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.55279541,45.67346191),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Orchards Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.49550629,45.63762665),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Pacific Middle School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.59191132,45.64280701),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Peter S Ogden Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.50209808,45.67509460),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pioneer Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.62069702,45.72595978),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Pleasant Valley Middle School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.54154968,45.60711670),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Riverview Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.62844086,45.64263153),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Roosevelt Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.66480255,45.70209885),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sacajawea Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.65559387,45.71446228),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Salmon Creek Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.64865875,45.69656372),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sarah J Anderson Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.47578430,45.61797333),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Shahala Middle School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.53140259,45.67585373),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sifton Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.56600189,45.68443680),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Silver Star Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.68465424,45.72183990),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Skyview High School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.52210236,45.65726471),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Special Services School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.58097839,45.69022751),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sunset Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.62586900,45.64240400),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Vancouver Home Connection",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.66934967,45.64398956),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Vancouver School Of Arts And Academics",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.59920502,45.66653442),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Walnut Grove Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.64809418,45.63040924),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Wash State School For Blind",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.65179443,45.64227295),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Washington Elementary School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.64040375,45.62504959),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Washington State School For Deaf",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.53269196,45.61195755),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Wyeast Middle School",'Vancouver=' + Vancouver.length);
Vancouver[Vancouver.length] = createMarker(new GPoint(-122.67288208,45.62435913),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("York Elementary School",'Vancouver=' + Vancouver.length);
maxLng = -10.00000000;
maxLat = 45.72595978;
minLng = -122.70252500;
minLat = 10.00000000;
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,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(Vancouver);
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(Vancouver);map.removeOverlays(Vancouver);
map.addOverlays(Vancouver);
centerByArray(Vancouver, false, false);
cntMarker += Vancouver.length;
centerByArray(Vancouver,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');
}
}