function addMarkers()
{
mySelect = document.getElementById('selection');
Bremerton = [];Silverdale = [];Bainbridge_Island = [];Poulsbo = [];Port_Orchard = [];Bainbridge_Isl = [];Kingston = [];_W_Kingston_Rd = [];_Silverdale_Way = [];_Ne_West_Kingston_Rd = [];Suquamish = [];Bremeron = [];mySelect.options[mySelect.options.length] = new Option("Bainbridge Isl schools",'all=Bainbridge_Isl');
mySelect.options[mySelect.options.length] = new Option("Bainbridge Island schools",'all=Bainbridge_Island');
mySelect.options[mySelect.options.length] = new Option("Bremeron schools",'all=Bremeron');
mySelect.options[mySelect.options.length] = new Option("Bremerton schools",'all=Bremerton');
mySelect.options[mySelect.options.length] = new Option("Kingston schools",'all=Kingston');
mySelect.options[mySelect.options.length] = new Option("Port Orchard schools",'all=Port_Orchard');
mySelect.options[mySelect.options.length] = new Option("Poulsbo schools",'all=Poulsbo');
mySelect.options[mySelect.options.length] = new Option("Silverdale schools",'all=Silverdale');
mySelect.options[mySelect.options.length] = new Option("Suquamish schools",'all=Suquamish');
mySelect.options[mySelect.options.length] = new Option(" Ne West Kingston Rd schools",'all=_Ne_West_Kingston_Rd');
mySelect.options[mySelect.options.length] = new Option(" Silverdale Way schools",'all=_Silverdale_Way');
mySelect.options[mySelect.options.length] = new Option(" W Kingston Rd schools",'all=_W_Kingston_Rd');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
Bremerton[Bremerton.length] = createMarker(new GPoint(-122.66220856,47.56447220),"
",iconRd);
mySelect.options[mySelect.options.length] = new Option("Alliance Academy",'Bremerton=' + Bremerton.length);
Silverdale[Silverdale.length] = createMarker(new GPoint(-122.70323944,47.65391541),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Alternative High School",'Silverdale=' + Silverdale.length);
Bremerton[Bremerton.length] = createMarker(new GPoint(-122.63484192,47.59243774),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Armin Jahr Elementary School",'Bremerton=' + Bremerton.length);
Bainbridge_Island[Bainbridge_Island.length] = createMarker(new GPoint(-122.52526093,47.63595963),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bainbridge High School",'Bainbridge_Island=' + Bainbridge_Island.length);
Bainbridge_Island[Bainbridge_Island.length] = createMarker(new GPoint(-122.34683990,47.61613846),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bainbridge Special Education Services",'Bainbridge_Island=' + Bainbridge_Island.length);
Poulsbo[Poulsbo.length] = createMarker(new GPoint(-122.65969849,47.78940964),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Breidablik Elementary School",'Poulsbo=' + Poulsbo.length);
Bremerton[Bremerton.length] = createMarker(new GPoint(-122.63909912,47.57293701),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Bremerton High School",'Bremerton=' + Bremerton.length);
Bremerton[Bremerton.length] = createMarker(new GPoint(-122.62700653,47.59038162),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Bremerton Jr High School",'Bremerton=' + Bremerton.length);
Bremerton[Bremerton.length] = createMarker(new GPoint(-122.69355774,47.64448929),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Brownsville Elementary School",'Bremerton=' + Bremerton.length);
Port_Orchard[Port_Orchard.length] = createMarker(new GPoint(-122.64875031,47.43946457),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Burley Glenwood Elementary School",'Port_Orchard=' + Port_Orchard.length);
Bainbridge_Island[Bainbridge_Island.length] = createMarker(new GPoint(-122.53653717,47.60608673),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Capt Johnston Blakely Elementary School",'Bainbridge_Island=' + Bainbridge_Island.length);
Bainbridge_Island[Bainbridge_Island.length] = createMarker(new GPoint(-122.52130127,47.67891693),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Capt. Charles Wilkes Elementary School",'Bainbridge_Island=' + Bainbridge_Island.length);
Port_Orchard[Port_Orchard.length] = createMarker(new GPoint(-122.65280151,47.51139450),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Cedar Heights Junior High School",'Port_Orchard=' + Port_Orchard.length);
Silverdale[Silverdale.length] = createMarker(new GPoint(-122.70005035,47.65129471),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Central Kitsap High School",'Silverdale=' + Silverdale.length);
Silverdale[Silverdale.length] = createMarker(new GPoint(-122.70320129,47.65408707),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Central Kitsap Junior High School",'Silverdale=' + Silverdale.length);
Silverdale[Silverdale.length] = createMarker(new GPoint(-122.70014954,47.68291473),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Clear Creek Elementary School",'Silverdale=' + Silverdale.length);
Bainbridge_Isl[Bainbridge_Isl.length] = createMarker(new GPoint(-122.52228546,47.63593674),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Contract Studies Program High School",'Bainbridge_Isl=' + Bainbridge_Isl.length);
Bremerton[Bremerton.length] = createMarker(new GPoint(-122.69355774,47.64448929),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Cottonwood Elementary School",'Bremerton=' + Bremerton.length);
Silverdale[Silverdale.length] = createMarker(new GPoint(-122.72669220,47.68296051),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Cougar Valley Elementary School",'Silverdale=' + Silverdale.length);
Bremerton[Bremerton.length] = createMarker(new GPoint(-122.66759491,47.57559204),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Crownhill Elementary School",'Bremerton=' + Bremerton.length);
Kingston[Kingston.length] = createMarker(new GPoint(-122.55255127,47.80842972),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("David Wolfle Elementary School",'Kingston=' + Kingston.length);
Port_Orchard[Port_Orchard.length] = createMarker(new GPoint(-122.59909821,47.52881622),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Discovery High School",'Port_Orchard=' + Port_Orchard.length);
Bainbridge_Island[Bainbridge_Island.length] = createMarker(new GPoint(-122.52228546,47.63593674),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Eagle Harbor High School",'Bainbridge_Island=' + Bainbridge_Island.length);
Port_Orchard[Port_Orchard.length] = createMarker(new GPoint(-122.62710571,47.52568436),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("East Port Orchard Elementary School",'Port_Orchard=' + Port_Orchard.length);
Bremerton[Bremerton.length] = createMarker(new GPoint(-122.66636658,47.62726974),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Eastside Alternative High School",'Bremerton=' + Bremerton.length);
Silverdale[Silverdale.length] = createMarker(new GPoint(-122.66625977,47.67509460),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Emerald Heights Elementary School",'Silverdale=' + Silverdale.length);
Bremerton[Bremerton.length] = createMarker(new GPoint(-122.63619995,47.56930161),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Esquire Hills Elementary School",'Bremerton=' + Bremerton.length);
Port_Orchard[Port_Orchard.length] = createMarker(new GPoint(-122.59909821,47.52881622),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Explorer Academy",'Port_Orchard=' + Port_Orchard.length);
Bremerton[Bremerton.length] = createMarker(new GPoint(-122.69355774,47.64448929),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Fairview Junior High School",'Bremerton=' + Bremerton.length);
Bremerton[Bremerton.length] = createMarker(new GPoint(-122.69355774,47.64448929),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Green Mountain Elementary School",'Bremerton=' + Bremerton.length);
Port_Orchard[Port_Orchard.length] = createMarker(new GPoint(-122.62110138,47.49925232),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hidden Creek Elementary School",'Port_Orchard=' + Port_Orchard.length);
Poulsbo[Poulsbo.length] = createMarker(new GPoint(-122.65439606,47.70392227),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Hilder Pearson Elementary School",'Poulsbo=' + Poulsbo.length);
Port_Orchard[Port_Orchard.length] = createMarker(new GPoint(-122.62710571,47.52569199),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Homebound",'Port_Orchard=' + Port_Orchard.length);
Bainbridge_Island[Bainbridge_Island.length] = createMarker(new GPoint(-122.52098400,47.62693500),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Homeschool Support Program",'Bainbridge_Island=' + Bainbridge_Island.length);
Bainbridge_Island[Bainbridge_Island.length] = createMarker(new GPoint(-122.52228546,47.63593674),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Homeschool Support Program Elementary School",'Bainbridge_Island=' + Bainbridge_Island.length);
Bremerton[Bremerton.length] = createMarker(new GPoint(-122.69757080,47.59617615),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Jackson Park Elementary School",'Bremerton=' + Bremerton.length);
Kingston[Kingston.length] = createMarker(new GPoint(-122.51381300,47.80090800),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Jhop Program",'Kingston=' + Kingston.length);
Port_Orchard[Port_Orchard.length] = createMarker(new GPoint(-122.53422546,47.50508881),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("John Sedgwick Junior High School",'Port_Orchard=' + Port_Orchard.length);
_W_Kingston_Rd[_W_Kingston_Rd.length] = createMarker(new GPoint(-122.52867889,47.79503632),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Kingston Junior High School",'_W_Kingston_Rd=' + _W_Kingston_Rd.length);
Port_Orchard[Port_Orchard.length] = createMarker(new GPoint(-122.66980743,47.51634979),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Kitsap Co Detention Center",'Port_Orchard=' + Port_Orchard.length);
Bremerton[Bremerton.length] = createMarker(new GPoint(-122.69418335,47.57113647),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Kitsap Lake Elementary School",'Bremerton=' + Bremerton.length);
Silverdale[Silverdale.length] = createMarker(new GPoint(-122.75164795,47.63566208),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Klahowya Secondary",'Silverdale=' + Silverdale.length);
Port_Orchard[Port_Orchard.length] = createMarker(new GPoint(-122.59909821,47.52881622),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Madrona Heights School",'Port_Orchard=' + Port_Orchard.length);
Port_Orchard[Port_Orchard.length] = createMarker(new GPoint(-122.55649567,47.55116272),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Manchester Elementary School",'Port_Orchard=' + Port_Orchard.length);
Port_Orchard[Port_Orchard.length] = createMarker(new GPoint(-122.60241699,47.53152466),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Marcus Whitman Junior High School",'Port_Orchard=' + Port_Orchard.length);
Bremerton[Bremerton.length] = createMarker(new GPoint(-122.66220856,47.56447220),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Morgan Center School",'Bremerton=' + Bremerton.length);
Bremerton[Bremerton.length] = createMarker(new GPoint(-122.61348724,47.58163452),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Mountain View Middle School",'Bremerton=' + Bremerton.length);
Port_Orchard[Port_Orchard.length] = createMarker(new GPoint(-122.60109711,47.46856308),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Mullenix Ridge Elementary School",'Port_Orchard=' + Port_Orchard.length);
Bremerton[Bremerton.length] = createMarker(new GPoint(-122.64879608,47.56964111),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Naval Avenue Elementary School",'Bremerton=' + Bremerton.length);
Silverdale[Silverdale.length] = createMarker(new GPoint(-122.70320129,47.65427017),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("New Frontiers Junior High School",'Silverdale=' + Silverdale.length);
Poulsbo[Poulsbo.length] = createMarker(new GPoint(-122.62524414,47.73373795),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("North Kitsap High School",'Poulsbo=' + Poulsbo.length);
Bainbridge_Island[Bainbridge_Island.length] = createMarker(new GPoint(-122.52228546,47.63593674),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Odyssey Multiage Program Elementary School",'Bainbridge_Island=' + Bainbridge_Island.length);
_Silverdale_Way[_Silverdale_Way.length] = createMarker(new GPoint(-122.69808960,47.64663696),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Off Campus",'_Silverdale_Way=' + _Silverdale_Way.length);
Port_Orchard[Port_Orchard.length] = createMarker(new GPoint(-122.57269287,47.43236160),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Olalla Elementary School",'Port_Orchard=' + Port_Orchard.length);
Bremerton[Bremerton.length] = createMarker(new GPoint(-122.69355774,47.64448929),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Olympic High School",'Bremerton=' + Bremerton.length);
Bremerton[Bremerton.length] = createMarker(new GPoint(-122.61344910,47.58249283),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Olympic View Elementary School",'Bremerton=' + Bremerton.length);
Port_Orchard[Port_Orchard.length] = createMarker(new GPoint(-122.59860229,47.52756500),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Orchard Heights Elementary School",'Port_Orchard=' + Port_Orchard.length);
Bainbridge_Island[Bainbridge_Island.length] = createMarker(new GPoint(-122.52120209,47.64085770),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Ordway Elementary School",'Bainbridge_Island=' + Bainbridge_Island.length);
Poulsbo[Poulsbo.length] = createMarker(new GPoint(-122.64556885,47.73477173),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Pal Program",'Poulsbo=' + Poulsbo.length);
Bremerton[Bremerton.length] = createMarker(new GPoint(-122.63919830,47.61283112),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Pinecrest Elementary School",'Bremerton=' + Bremerton.length);
Poulsbo[Poulsbo.length] = createMarker(new GPoint(-122.61756897,47.73102188),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Poulsbo Elementary School",'Poulsbo=' + Poulsbo.length);
Poulsbo[Poulsbo.length] = createMarker(new GPoint(-122.62207794,47.73346329),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Poulsbo Junior High School",'Poulsbo=' + Poulsbo.length);
Bainbridge_Island[Bainbridge_Island.length] = createMarker(new GPoint(-122.52228546,47.63593674),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Renaissance",'Bainbridge_Island=' + Bainbridge_Island.length);
Bremerton[Bremerton.length] = createMarker(new GPoint(-122.66039276,47.56393814),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Renaissance High School",'Bremerton=' + Bremerton.length);
Kingston[Kingston.length] = createMarker(new GPoint(-122.51399994,47.80151367),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Richard Gordon Elementary School",'Kingston=' + Kingston.length);
Silverdale[Silverdale.length] = createMarker(new GPoint(-122.66999054,47.65980530),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Ridgetop Junior High School",'Silverdale=' + Silverdale.length);
Bainbridge_Island[Bainbridge_Island.length] = createMarker(new GPoint(-122.52648926,47.64673233),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Sakai Intermediate",'Bainbridge_Island=' + Bainbridge_Island.length);
Port_Orchard[Port_Orchard.length] = createMarker(new GPoint(-122.65418243,47.50656128),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sidney Glen Elementary School",'Port_Orchard=' + Port_Orchard.length);
Silverdale[Silverdale.length] = createMarker(new GPoint(-122.66858673,47.65943527),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Silver Ridge Elementary School",'Silverdale=' + Silverdale.length);
Silverdale[Silverdale.length] = createMarker(new GPoint(-122.71909332,47.64311600),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Silverdale Elementary School",'Silverdale=' + Silverdale.length);
Port_Orchard[Port_Orchard.length] = createMarker(new GPoint(-122.54579926,47.52000046),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("South Colby Elementary School",'Port_Orchard=' + Port_Orchard.length);
Port_Orchard[Port_Orchard.length] = createMarker(new GPoint(-122.62549591,47.53902817),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("South Kitsap High School",'Port_Orchard=' + Port_Orchard.length);
Poulsbo[Poulsbo.length] = createMarker(new GPoint(-122.62787628,47.73017120),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Special Programs",'Poulsbo=' + Poulsbo.length);
_Ne_West_Kingston_Rd[_Ne_West_Kingston_Rd.length] = createMarker(new GPoint(-122.51522827,47.79503632),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("Spectrum Community School",'_Ne_West_Kingston_Rd=' + _Ne_West_Kingston_Rd.length);
Port_Orchard[Port_Orchard.length] = createMarker(new GPoint(-122.73434448,47.51174164),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Sunnyslope Elementary School",'Port_Orchard=' + Port_Orchard.length);
Suquamish[Suquamish.length] = createMarker(new GPoint(-122.55679321,47.73478699),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Suquamish Elementary School",'Suquamish=' + Suquamish.length);
Bremerton[Bremerton.length] = createMarker(new GPoint(-122.65520477,47.61415863),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Tracyton Elementary School",'Bremerton=' + Bremerton.length);
Bremerton[Bremerton.length] = createMarker(new GPoint(-122.62745667,47.59494019),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("View Ridge Elementary School",'Bremerton=' + Bremerton.length);
Poulsbo[Poulsbo.length] = createMarker(new GPoint(-122.67559052,47.76242447),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Vinland Elementary School",'Poulsbo=' + Poulsbo.length);
Bremerton[Bremerton.length] = createMarker(new GPoint(-122.66759491,47.55743790),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("West Hills Elementary School",'Bremerton=' + Bremerton.length);
Bremeron[Bremeron.length] = createMarker(new GPoint(-122.66799164,47.56375885),"",iconGr);
mySelect.options[mySelect.options.length] = new Option("West Sound Technical Skills Center",'Bremeron=' + Bremeron.length);
Bremerton[Bremerton.length] = createMarker(new GPoint(-122.69355774,47.64448929),"",iconRd);
mySelect.options[mySelect.options.length] = new Option("Woodlands Elementary School",'Bremerton=' + Bremerton.length);
Bainbridge_Island[Bainbridge_Island.length] = createMarker(new GPoint(-122.52847290,47.64417648),"",iconBl);
mySelect.options[mySelect.options.length] = new Option("Woodward Middle School",'Bainbridge_Island=' + Bainbridge_Island.length);
} // 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(Bainbridge_Isl);
map.removeOverlays(Bainbridge_Island);
map.removeOverlays(Bremeron);
map.removeOverlays(Bremerton);
map.removeOverlays(Kingston);
map.removeOverlays(Port_Orchard);
map.removeOverlays(Poulsbo);
map.removeOverlays(Silverdale);
map.removeOverlays(Suquamish);
map.removeOverlays(_Ne_West_Kingston_Rd);
map.removeOverlays(_Silverdale_Way);
map.removeOverlays(_W_Kingston_Rd);
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(Bremerton);map.removeOverlays(Bainbridge_Isl);
map.removeOverlays(Bainbridge_Island);
map.removeOverlays(Bremeron);
map.removeOverlays(Bremerton);
map.removeOverlays(Kingston);
map.removeOverlays(Port_Orchard);
map.removeOverlays(Poulsbo);
map.removeOverlays(Silverdale);
map.removeOverlays(Suquamish);
map.removeOverlays(_Ne_West_Kingston_Rd);
map.removeOverlays(_Silverdale_Way);
map.removeOverlays(_W_Kingston_Rd);
map.addOverlays(Bainbridge_Isl);
centerByArray(Bainbridge_Isl, false, false);
cntMarker += Bainbridge_Isl.length;
map.addOverlays(Bainbridge_Island);
centerByArray(Bainbridge_Island, false, false);
cntMarker += Bainbridge_Island.length;
map.addOverlays(Bremeron);
centerByArray(Bremeron, false, false);
cntMarker += Bremeron.length;
map.addOverlays(Bremerton);
centerByArray(Bremerton, false, false);
cntMarker += Bremerton.length;
map.addOverlays(Kingston);
centerByArray(Kingston, false, false);
cntMarker += Kingston.length;
map.addOverlays(Port_Orchard);
centerByArray(Port_Orchard, false, false);
cntMarker += Port_Orchard.length;
map.addOverlays(Poulsbo);
centerByArray(Poulsbo, false, false);
cntMarker += Poulsbo.length;
map.addOverlays(Silverdale);
centerByArray(Silverdale, false, false);
cntMarker += Silverdale.length;
map.addOverlays(Suquamish);
centerByArray(Suquamish, false, false);
cntMarker += Suquamish.length;
map.addOverlays(_Ne_West_Kingston_Rd);
centerByArray(_Ne_West_Kingston_Rd, false, false);
cntMarker += _Ne_West_Kingston_Rd.length;
map.addOverlays(_Silverdale_Way);
centerByArray(_Silverdale_Way, false, false);
cntMarker += _Silverdale_Way.length;
map.addOverlays(_W_Kingston_Rd);
centerByArray(_W_Kingston_Rd, false, false);
cntMarker += _W_Kingston_Rd.length;
centerByArray(Bremerton,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');
}
}