function addMarkers(){
mySelect = document.getElementById('selection');
Greeley = [];Littleton = [];Denver = [];Aurora = [];Glenwood_Springs = [];Rangely = [];Lakewood = [];Westminster = [];Colorado_Springs = [];Thornton = [];Fort_Collins = [];Grand_Junction = [];Lamar = [];Fort__Morgan = [];Sterling = [];La_Junta = [];Pueblo = [];Broomfield = [];Trinidad = [];mySelect.options[mySelect.options.length] = new Option("Aurora Schools",'all=Aurora');
mySelect.options[mySelect.options.length] = new Option("Broomfield Schools",'all=Broomfield');
mySelect.options[mySelect.options.length] = new Option("Colorado Springs Schools",'all=Colorado_Springs');
mySelect.options[mySelect.options.length] = new Option("Denver Schools",'all=Denver');
mySelect.options[mySelect.options.length] = new Option("Fort Collins Schools",'all=Fort_Collins');
mySelect.options[mySelect.options.length] = new Option("Fort Morgan Schools",'all=Fort__Morgan');
mySelect.options[mySelect.options.length] = new Option("Glenwood Springs Schools",'all=Glenwood_Springs');
mySelect.options[mySelect.options.length] = new Option("Grand Junction Schools",'all=Grand_Junction');
mySelect.options[mySelect.options.length] = new Option("Greeley Schools",'all=Greeley');
mySelect.options[mySelect.options.length] = new Option("La Junta Schools",'all=La_Junta');
mySelect.options[mySelect.options.length] = new Option("Lakewood Schools",'all=Lakewood');
mySelect.options[mySelect.options.length] = new Option("Lamar Schools",'all=Lamar');
mySelect.options[mySelect.options.length] = new Option("Littleton Schools",'all=Littleton');
mySelect.options[mySelect.options.length] = new Option("Pueblo Schools",'all=Pueblo');
mySelect.options[mySelect.options.length] = new Option("Rangely Schools",'all=Rangely');
mySelect.options[mySelect.options.length] = new Option("Sterling Schools",'all=Sterling');
mySelect.options[mySelect.options.length] = new Option("Thornton Schools",'all=Thornton');
mySelect.options[mySelect.options.length] = new Option("Trinidad Schools",'all=Trinidad');
mySelect.options[mySelect.options.length] = new Option("Westminster Schools",'all=Westminster');
mySelect.options[mySelect.options.length] = new Option("---------------------------",'');
var tmpLatLng=0;
var tmpLen=0;
tmpLatLng=new GLatLng(40.40690599999999932,-104.767928999999995);
tmpLen=Greeley.length;
Greeley[tmpLen] = createMarker(tmpLatLng,"
",iconGr);
Greeley[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Aims Community College",'Greeley=' + Greeley.length);
tmpLatLng=new GLatLng(39.61048699999999911,-105.021137999999993);
tmpLen=Littleton.length;
Littleton[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Littleton[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Arapahoe Community College",'Littleton=' + Littleton.length);
tmpLatLng=new GLatLng(39.69798699999999769,-104.875631999999995);
tmpLen=Denver.length;
Denver[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Denver[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Bel-rea Institute Of Animal Technology",'Denver=' + Denver.length);
tmpLatLng=new GLatLng(39.67495499999999708,-104.844182000000003);
tmpLen=Aurora.length;
Aurora[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Aurora[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Cambridge College",'Aurora=' + Aurora.length);
tmpLatLng=new GLatLng(39.69145300000000276,-104.940776999999997);
tmpLen=Denver.length;
Denver[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Denver[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("College America-denver",'Denver=' + Denver.length);
tmpLatLng=new GLatLng(39.54629800000000017,-107.324640000000002);
tmpLen=Glenwood_Springs.length;
Glenwood_Springs[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Glenwood_Springs[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Colorado Mountain College",'Glenwood_Springs=' + Glenwood_Springs.length);
tmpLatLng=new GLatLng(40.07799899999999837,-108.786928000000003);
tmpLen=Rangely.length;
Rangely[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Rangely[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Colorado Northwestern Community College",'Rangely=' + Rangely.length);
tmpLatLng=new GLatLng(39.74106900000000308,-105.103815999999994);
tmpLen=Lakewood.length;
Lakewood[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Lakewood[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Colorado School Of Trades",'Lakewood=' + Lakewood.length);
tmpLatLng=new GLatLng(39.71952000000000282,-104.802441999999999);
tmpLen=Aurora.length;
Aurora[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Aurora[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Community College Of Aurora",'Aurora=' + Aurora.length);
tmpLatLng=new GLatLng(39.74008599999999802,-105.001720000000005);
tmpLen=Denver.length;
Denver[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Denver[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Community College Of Denver",'Denver=' + Denver.length);
tmpLatLng=new GLatLng(39.86034699999999730,-105.063834999999997);
tmpLen=Westminster.length;
Westminster[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Westminster[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Denver Academy Of Court Reporting-main Campus",'Westminster=' + Westminster.length);
tmpLatLng=new GLatLng(39.70825200000000165,-105.001836999999994);
tmpLen=Denver.length;
Denver[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Denver[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Denver Automotive And Diesel College",'Denver=' + Denver.length);
tmpLatLng=new GLatLng(39.68202300000000093,-104.821684000000004);
tmpLen=Aurora.length;
Aurora[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Aurora[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Everest College-aurora",'Aurora=' + Aurora.length);
tmpLatLng=new GLatLng(38.80677800000000132,-104.743375999999997);
tmpLen=Colorado_Springs.length;
Colorado_Springs[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Colorado_Springs[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Everest College-colorado Springs",'Colorado_Springs=' + Colorado_Springs.length);
tmpLatLng=new GLatLng(39.86020599999999802,-104.982794999999995);
tmpLen=Thornton.length;
Thornton[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Thornton[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Everest College-thornton",'Thornton=' + Thornton.length);
tmpLatLng=new GLatLng(39.89988499999999760,-105.033741000000006);
tmpLen=Westminster.length;
Westminster[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Westminster[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Front Range Community College",'Westminster=' + Westminster.length);
tmpLatLng=new GLatLng(40.52248000000000161,-105.048174000000003);
tmpLen=Fort_Collins.length;
Fort_Collins[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Fort_Collins[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Institute Of Business And Medical Careers",'Fort_Collins=' + Fort_Collins.length);
tmpLatLng=new GLatLng(38.83252699999999890,-104.787413999999998);
tmpLen=Colorado_Springs.length;
Colorado_Springs[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Colorado_Springs[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Intellitec College-colorado Springs",'Colorado_Springs=' + Colorado_Springs.length);
tmpLatLng=new GLatLng(39.11702199999999862,-108.530465000000006);
tmpLen=Grand_Junction.length;
Grand_Junction[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Grand_Junction[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Intellitec College-grand Junction",'Grand_Junction=' + Grand_Junction.length);
tmpLatLng=new GLatLng(38.06340600000000051,-102.617202000000006);
tmpLen=Lamar.length;
Lamar[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Lamar[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Lamar Community College",'Lamar=' + Lamar.length);
tmpLatLng=new GLatLng(40.25710200000000327,-103.772718999999995);
tmpLen=Fort__Morgan.length;
Fort__Morgan[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Fort__Morgan[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Morgan Community College",'Fort__Morgan=' + Fort__Morgan.length);
tmpLatLng=new GLatLng(40.63674100000000066,-103.197506000000004);
tmpLen=Sterling.length;
Sterling[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Sterling[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Northeastern Junior College",'Sterling=' + Sterling.length);
tmpLatLng=new GLatLng(37.97161899999999690,-103.543018000000003);
tmpLen=La_Junta.length;
La_Junta[tmpLen] = createMarker(tmpLatLng,"",iconGr);
La_Junta[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Otero Junior College",'La_Junta=' + La_Junta.length);
tmpLatLng=new GLatLng(38.78809400000000096,-104.756928000000002);
tmpLen=Colorado_Springs.length;
Colorado_Springs[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Colorado_Springs[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Pikes Peak Community College",'Colorado_Springs=' + Colorado_Springs.length);
tmpLatLng=new GLatLng(39.66058699999999959,-104.855131999999997);
tmpLen=Aurora.length;
Aurora[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Aurora[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Platt College",'Aurora=' + Aurora.length);
tmpLatLng=new GLatLng(38.26224700000000211,-104.637484999999998);
tmpLen=Pueblo.length;
Pueblo[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Pueblo[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Pueblo Community College",'Pueblo=' + Pueblo.length);
tmpLatLng=new GLatLng(39.72533200000000164,-105.148137000000005);
tmpLen=Lakewood.length;
Lakewood[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Lakewood[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Red Rocks Community College",'Lakewood=' + Lakewood.length);
tmpLatLng=new GLatLng(39.91403900000000248,-105.139970000000005);
tmpLen=Broomfield.length;
Broomfield[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Broomfield[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Redstone College",'Broomfield=' + Broomfield.length);
tmpLatLng=new GLatLng(39.72545300000000168,-105.119704999999996);
tmpLen=Colorado_Springs.length;
Colorado_Springs[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Colorado_Springs[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Remington College - Colorado Springs Campus",'Colorado_Springs=' + Colorado_Springs.length);
tmpLatLng=new GLatLng(37.17271000000000214,-104.513801000000000);
tmpLen=Trinidad.length;
Trinidad[tmpLen] = createMarker(tmpLatLng,"",iconGr);
Trinidad[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Trinidad State Junior College",'Trinidad=' + Trinidad.length);
tmpLatLng=new GLatLng(39.67258700000000004,-105.053139000000001);
tmpLen=Denver.length;
Denver[tmpLen] = createMarker(tmpLatLng,"",iconRd);
Denver[tmpLen].point = tmpLatLng;
mySelect.options[mySelect.options.length] = new Option("Westwood College-denver South",'Denver=' + Denver.length);
map.removeOverlays(Aurora);
map.removeOverlays(Broomfield);
map.removeOverlays(Colorado_Springs);
map.removeOverlays(Denver);
map.removeOverlays(Fort_Collins);
map.removeOverlays(Fort__Morgan);
map.removeOverlays(Glenwood_Springs);
map.removeOverlays(Grand_Junction);
map.removeOverlays(Greeley);
map.removeOverlays(La_Junta);
map.removeOverlays(Lakewood);
map.removeOverlays(Lamar);
map.removeOverlays(Littleton);
map.removeOverlays(Pueblo);
map.removeOverlays(Rangely);
map.removeOverlays(Sterling);
map.removeOverlays(Thornton);
map.removeOverlays(Trinidad);
map.removeOverlays(Westminster);
setTimeout(function(){map.addOverlays(Aurora)},1000);
setTimeout(function(){map.addOverlays(Broomfield)},1000);
setTimeout(function(){map.addOverlays(Colorado_Springs)},1000);
setTimeout(function(){map.addOverlays(Denver)},1000);
setTimeout(function(){map.addOverlays(Fort_Collins)},1000);
setTimeout(function(){map.addOverlays(Fort__Morgan)},1000);
setTimeout(function(){map.addOverlays(Glenwood_Springs)},1000);
setTimeout(function(){map.addOverlays(Grand_Junction)},1000);
setTimeout(function(){map.addOverlays(Greeley)},1000);
setTimeout(function(){map.addOverlays(La_Junta)},1000);
setTimeout(function(){map.addOverlays(Lakewood)},1000);
setTimeout(function(){map.addOverlays(Lamar)},1000);
setTimeout(function(){map.addOverlays(Littleton)},1000);
setTimeout(function(){map.addOverlays(Pueblo)},1000);
setTimeout(function(){map.addOverlays(Rangely)},1000);
setTimeout(function(){map.addOverlays(Sterling)},1000);
setTimeout(function(){map.addOverlays(Thornton)},1000);
setTimeout(function(){map.addOverlays(Trinidad)},1000);
setTimeout(function(){map.addOverlays(Westminster)},1000);
getPoly("","state","","CO");}
// 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(Aurora);
map.removeOverlays(Broomfield);
map.removeOverlays(Colorado_Springs);
map.removeOverlays(Denver);
map.removeOverlays(Fort_Collins);
map.removeOverlays(Fort__Morgan);
map.removeOverlays(Glenwood_Springs);
map.removeOverlays(Grand_Junction);
map.removeOverlays(Greeley);
map.removeOverlays(La_Junta);
map.removeOverlays(Lakewood);
map.removeOverlays(Lamar);
map.removeOverlays(Littleton);
map.removeOverlays(Pueblo);
map.removeOverlays(Rangely);
map.removeOverlays(Sterling);
map.removeOverlays(Thornton);
map.removeOverlays(Trinidad);
map.removeOverlays(Westminster);
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(Greeley);map.removeOverlays(Aurora);
map.removeOverlays(Broomfield);
map.removeOverlays(Colorado_Springs);
map.removeOverlays(Denver);
map.removeOverlays(Fort_Collins);
map.removeOverlays(Fort__Morgan);
map.removeOverlays(Glenwood_Springs);
map.removeOverlays(Grand_Junction);
map.removeOverlays(Greeley);
map.removeOverlays(La_Junta);
map.removeOverlays(Lakewood);
map.removeOverlays(Lamar);
map.removeOverlays(Littleton);
map.removeOverlays(Pueblo);
map.removeOverlays(Rangely);
map.removeOverlays(Sterling);
map.removeOverlays(Thornton);
map.removeOverlays(Trinidad);
map.removeOverlays(Westminster);
map.addOverlays(Aurora);
centerByArray(Aurora, false, false);
cntMarker += Aurora.length;
map.addOverlays(Broomfield);
centerByArray(Broomfield, false, false);
cntMarker += Broomfield.length;
map.addOverlays(Colorado_Springs);
centerByArray(Colorado_Springs, false, false);
cntMarker += Colorado_Springs.length;
map.addOverlays(Denver);
centerByArray(Denver, false, false);
cntMarker += Denver.length;
map.addOverlays(Fort_Collins);
centerByArray(Fort_Collins, false, false);
cntMarker += Fort_Collins.length;
map.addOverlays(Fort__Morgan);
centerByArray(Fort__Morgan, false, false);
cntMarker += Fort__Morgan.length;
map.addOverlays(Glenwood_Springs);
centerByArray(Glenwood_Springs, false, false);
cntMarker += Glenwood_Springs.length;
map.addOverlays(Grand_Junction);
centerByArray(Grand_Junction, false, false);
cntMarker += Grand_Junction.length;
map.addOverlays(Greeley);
centerByArray(Greeley, false, false);
cntMarker += Greeley.length;
map.addOverlays(La_Junta);
centerByArray(La_Junta, false, false);
cntMarker += La_Junta.length;
map.addOverlays(Lakewood);
centerByArray(Lakewood, false, false);
cntMarker += Lakewood.length;
map.addOverlays(Lamar);
centerByArray(Lamar, false, false);
cntMarker += Lamar.length;
map.addOverlays(Littleton);
centerByArray(Littleton, false, false);
cntMarker += Littleton.length;
map.addOverlays(Pueblo);
centerByArray(Pueblo, false, false);
cntMarker += Pueblo.length;
map.addOverlays(Rangely);
centerByArray(Rangely, false, false);
cntMarker += Rangely.length;
map.addOverlays(Sterling);
centerByArray(Sterling, false, false);
cntMarker += Sterling.length;
map.addOverlays(Thornton);
centerByArray(Thornton, false, false);
cntMarker += Thornton.length;
map.addOverlays(Trinidad);
centerByArray(Trinidad, false, false);
cntMarker += Trinidad.length;
map.addOverlays(Westminster);
centerByArray(Westminster, false, false);
cntMarker += Westminster.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;
}