function addMarkers(){
mySelect = document.getElementById('selection');
Janesville = [];Milwaukee = [];Eau_Claire = [];Appleton = [];Kenosha = [];Cleveland = [];Madison = [];Wisconsin_Rapids = [];Fond_Du_Lac = [];Rhinelander = [];Wausau = [];Green_Bay = [];Fennimore = [];Pewaukee = [];La_Crosse = [];Shell_Lake = [];mySelect.options[mySelect.options.length] = new Option("Appleton Schools",'all=Appleton');
mySelect.options[mySelect.options.length] = new Option("Cleveland Schools",'all=Cleveland');
mySelect.options[mySelect.options.length] = new Option("Eau Claire Schools",'all=Eau_Claire');
mySelect.options[mySelect.options.length] = new Option("Fennimore Schools",'all=Fennimore');
mySelect.options[mySelect.options.length] = new Option("Fond Du Lac Schools",'all=Fond_Du_Lac');
mySelect.options[mySelect.options.length] = new Option("Green Bay Schools",'all=Green_Bay');
mySelect.options[mySelect.options.length] = new Option("Janesville Schools",'all=Janesville');
mySelect.options[mySelect.options.length] = new Option("Kenosha Schools",'all=Kenosha');
mySelect.options[mySelect.options.length] = new Option("La Crosse Schools",'all=La_Crosse');
mySelect.options[mySelect.options.length] = new Option("Madison Schools",'all=Madison');
mySelect.options[mySelect.options.length] = new Option("Milwaukee Schools",'all=Milwaukee');
mySelect.options[mySelect.options.length] = new Option("Pewaukee Schools",'all=Pewaukee');
mySelect.options[mySelect.options.length] = new Option("Rhinelander Schools",'all=Rhinelander');
mySelect.options[mySelect.options.length] = new Option("Shell Lake Schools",'all=Shell_Lake');
mySelect.options[mySelect.options.length] = new Option("Wausau Schools",'all=Wausau');
mySelect.options[mySelect.options.length] = new Option("Wisconsin Rapids Schools",'all=Wisconsin_Rapids');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
var tmpLatLng=0;
var tmpLen=0;
tmpLatLng=new GLatLng(42.69950399999999746,-89.0175080000000065);
tmpLen=Janesville.length;
Janesville[tmpLen] = createMarker(tmpLatLng,"
",iconGr);
Janesville[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Blackhawk Technical College",'Janesville=' + Janesville.length);
tmpLatLng=new GLatLng(43.03862300000000118,-87.9148370000000056);
tmpLen=Milwaukee.length;
Milwaukee[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Milwaukee[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Bryant And Stratton College-milwaukee",'Milwaukee=' + Milwaukee.length);
tmpLatLng=new GLatLng(44.79305999999999699,-91.5082179999999993);
tmpLen=Eau_Claire.length;
Eau_Claire[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Eau_Claire[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Chippewa Valley Technical College",'Eau_Claire=' + Eau_Claire.length);
tmpLatLng=new GLatLng(44.27228600000000113,-88.4559059999999988);
tmpLen=Appleton.length;
Appleton[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Appleton[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Fox Valley Technical College",'Appleton=' + Appleton.length);
tmpLatLng=new GLatLng(42.66811899999999724,-87.8458760000000040);
tmpLen=Kenosha.length;
Kenosha[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Kenosha[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Gateway Technical College",'Kenosha=' + Kenosha.length);
tmpLatLng=new GLatLng(43.92195799999999650,-87.7309379999999947);
tmpLen=Cleveland.length;
Cleveland[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Cleveland[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Lakeshore Technical College",'Cleveland=' + Cleveland.length);
tmpLatLng=new GLatLng(43.12065599999999676,-89.3267340000000018);
tmpLen=Madison.length;
Madison[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Madison[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Madison Area Technical College",'Madison=' + Madison.length);
tmpLatLng=new GLatLng(44.39257299999999872,-89.7869960000000020);
tmpLen=Wisconsin_Rapids.length;
Wisconsin_Rapids[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Wisconsin_Rapids[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Mid-state Technical College",'Wisconsin_Rapids=' + Wisconsin_Rapids.length);
tmpLatLng=new GLatLng(43.04291299999999864,-87.9203849999999960);
tmpLen=Milwaukee.length;
Milwaukee[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Milwaukee[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Milwaukee Area Technical College",'Milwaukee=' + Milwaukee.length);
tmpLatLng=new GLatLng(43.78564699999999732,-88.4218299999999999);
tmpLen=Fond_Du_Lac.length;
Fond_Du_Lac[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Fond_Du_Lac[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Moraine Park Technical College",'Fond_Du_Lac=' + Fond_Du_Lac.length);
tmpLatLng=new GLatLng(45.63665000000000304,-89.4113310000000041);
tmpLen=Rhinelander.length;
Rhinelander[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Rhinelander[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Nicolet Area Technical College",'Rhinelander=' + Rhinelander.length);
tmpLatLng=new GLatLng(44.98796800000000217,-89.6481220000000007);
tmpLen=Wausau.length;
Wausau[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Wausau[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Northcentral Technical College",'Wausau=' + Wausau.length);
tmpLatLng=new GLatLng(44.52391999999999683,-88.1065439999999995);
tmpLen=Green_Bay.length;
Green_Bay[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Green_Bay[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Northeast Wisconsin Technical College",'Green_Bay=' + Green_Bay.length);
tmpLatLng=new GLatLng(42.97956099999999679,-90.6358869999999967);
tmpLen=Fennimore.length;
Fennimore[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Fennimore[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Southwest Wisconsin Technical College",'Fennimore=' + Fennimore.length);
tmpLatLng=new GLatLng(43.06759199999999765,-89.3989679999999964);
tmpLen=Madison.length;
Madison[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Madison[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("University Of Wisconsin Colleges",'Madison=' + Madison.length);
tmpLatLng=new GLatLng(43.07200999999999879,-88.2522689999999983);
tmpLen=Pewaukee.length;
Pewaukee[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Pewaukee[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Waukesha County Technical College",'Pewaukee=' + Pewaukee.length);
tmpLatLng=new GLatLng(43.81381100000000117,-91.2478360000000066);
tmpLen=La_Crosse.length;
La_Crosse[tmpLen] = createMarker(tmpLatLng,"",iconGr);
La_Crosse[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Western Technical College",'La_Crosse=' + La_Crosse.length);
tmpLatLng=new GLatLng(45.74757400000000018,-91.9161320000000046);
tmpLen=Shell_Lake.length;
Shell_Lake[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Shell_Lake[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Wisconsin Indianhead Technical College",'Shell_Lake=' + Shell_Lake.length);
map.removeOverlays(Appleton);
map.removeOverlays(Cleveland);
map.removeOverlays(Eau_Claire);
map.removeOverlays(Fennimore);
map.removeOverlays(Fond_Du_Lac);
map.removeOverlays(Green_Bay);
map.removeOverlays(Janesville);
map.removeOverlays(Kenosha);
map.removeOverlays(La_Crosse);
map.removeOverlays(Madison);
map.removeOverlays(Milwaukee);
map.removeOverlays(Pewaukee);
map.removeOverlays(Rhinelander);
map.removeOverlays(Shell_Lake);
map.removeOverlays(Wausau);
map.removeOverlays(Wisconsin_Rapids);
setTimeout(function(){map.addOverlays(Appleton)},1000);
setTimeout(function(){map.addOverlays(Cleveland)},1000);
setTimeout(function(){map.addOverlays(Eau_Claire)},1000);
setTimeout(function(){map.addOverlays(Fennimore)},1000);
setTimeout(function(){map.addOverlays(Fond_Du_Lac)},1000);
setTimeout(function(){map.addOverlays(Green_Bay)},1000);
setTimeout(function(){map.addOverlays(Janesville)},1000);
setTimeout(function(){map.addOverlays(Kenosha)},1000);
setTimeout(function(){map.addOverlays(La_Crosse)},1000);
setTimeout(function(){map.addOverlays(Madison)},1000);
setTimeout(function(){map.addOverlays(Milwaukee)},1000);
setTimeout(function(){map.addOverlays(Pewaukee)},1000);
setTimeout(function(){map.addOverlays(Rhinelander)},1000);
setTimeout(function(){map.addOverlays(Shell_Lake)},1000);
setTimeout(function(){map.addOverlays(Wausau)},1000);
setTimeout(function(){map.addOverlays(Wisconsin_Rapids)},1000);
getPoly("","state","","WI");}
// End addStateMarkers JavaScript Function
//open all when map is defined
function openAll() {
if (map) {
selectChange("all");
} else {
setTimeout("openAll()",200);
}
}
// 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].point.x;
var markLat = myArray[i].point.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].point.x;
maxLat = myArray[0].point.y;
minLng = myArray[0].point.x;
minLat = myArray[0].point.y;
}
// Recenter map based on global max/mins
function reCenterMap(){
//alert('#' + minLat + '#' + minLng + '#' + maxLat + '#' + maxLng);
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) {
if (selection.options) {
var _openNewWindow=true;
var myVal = selection.options[selection.selectedIndex].value;
} else {
var _openNewWindow=false;
var myVal=selection;
}
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('schools-by-distance') == -1)
window.open(location.href + '/map/all');
else
window.open('/search////all');
map.removeOverlays(Appleton);
map.removeOverlays(Cleveland);
map.removeOverlays(Eau_Claire);
map.removeOverlays(Fennimore);
map.removeOverlays(Fond_Du_Lac);
map.removeOverlays(Green_Bay);
map.removeOverlays(Janesville);
map.removeOverlays(Kenosha);
map.removeOverlays(La_Crosse);
map.removeOverlays(Madison);
map.removeOverlays(Milwaukee);
map.removeOverlays(Pewaukee);
map.removeOverlays(Rhinelander);
map.removeOverlays(Shell_Lake);
map.removeOverlays(Wausau);
map.removeOverlays(Wisconsin_Rapids);
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(Janesville);map.removeOverlays(Appleton);
map.removeOverlays(Cleveland);
map.removeOverlays(Eau_Claire);
map.removeOverlays(Fennimore);
map.removeOverlays(Fond_Du_Lac);
map.removeOverlays(Green_Bay);
map.removeOverlays(Janesville);
map.removeOverlays(Kenosha);
map.removeOverlays(La_Crosse);
map.removeOverlays(Madison);
map.removeOverlays(Milwaukee);
map.removeOverlays(Pewaukee);
map.removeOverlays(Rhinelander);
map.removeOverlays(Shell_Lake);
map.removeOverlays(Wausau);
map.removeOverlays(Wisconsin_Rapids);
map.addOverlays(Appleton);
centerByArray(Appleton, false, false);
cntMarker += Appleton.length;
map.addOverlays(Cleveland);
centerByArray(Cleveland, false, false);
cntMarker += Cleveland.length;
map.addOverlays(Eau_Claire);
centerByArray(Eau_Claire, false, false);
cntMarker += Eau_Claire.length;
map.addOverlays(Fennimore);
centerByArray(Fennimore, false, false);
cntMarker += Fennimore.length;
map.addOverlays(Fond_Du_Lac);
centerByArray(Fond_Du_Lac, false, false);
cntMarker += Fond_Du_Lac.length;
map.addOverlays(Green_Bay);
centerByArray(Green_Bay, false, false);
cntMarker += Green_Bay.length;
map.addOverlays(Janesville);
centerByArray(Janesville, false, false);
cntMarker += Janesville.length;
map.addOverlays(Kenosha);
centerByArray(Kenosha, false, false);
cntMarker += Kenosha.length;
map.addOverlays(La_Crosse);
centerByArray(La_Crosse, false, false);
cntMarker += La_Crosse.length;
map.addOverlays(Madison);
centerByArray(Madison, false, false);
cntMarker += Madison.length;
map.addOverlays(Milwaukee);
centerByArray(Milwaukee, false, false);
cntMarker += Milwaukee.length;
map.addOverlays(Pewaukee);
centerByArray(Pewaukee, false, false);
cntMarker += Pewaukee.length;
map.addOverlays(Rhinelander);
centerByArray(Rhinelander, false, false);
cntMarker += Rhinelander.length;
map.addOverlays(Shell_Lake);
centerByArray(Shell_Lake, false, false);
cntMarker += Shell_Lake.length;
map.addOverlays(Wausau);
centerByArray(Wausau, false, false);
cntMarker += Wausau.length;
map.addOverlays(Wisconsin_Rapids);
centerByArray(Wisconsin_Rapids, false, false);
cntMarker += Wisconsin_Rapids.length;
reCenterMap();
//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');
}
}
function createMarker(point, label, icon){
var marker = new GMarker(point, icon);
var html = label;
GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); });
return marker;
}