﻿function addGMapOverlays(map) {

var gpoints = new Array(); 
var gpoly = new Array(); 
var gtext = new Array();
var poly;

//map.centerAndZoom ( new GPoint(-87.61330604553223,41.872500859307735),3);
map.setCenter(new GLatLng(41.87578262, -87.62049470),14,G_HYBRID_MAP)
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.addControl(new GScaleControl());

// Mark Start/Stop point
var icon_lr = new GIcon();
icon_lr.image = "startstop.gif";   
icon_lr.iconAnchor = new GPoint(31,34);
icon_lr.infoWindowAnchor= new GPoint(31,34);
var point = new GLatLng(41.87578262, -87.62049470);
map.addOverlay(createMarker(point,'<b>The L.A.T.E Ride start and stop point</b>:<br/>Buckingham Fountain<br/><br/>Port-o-lets, First Aid, Refreshments, and Lost & Found.',icon_lr)); 
//<IMG SRC="lr.gif" BORDER=0>

// Rest Stop
var icon_rs = new GIcon();
icon_rs.image = "picn_ico.gif";   
icon_rs.iconAnchor = new GPoint(15,50);
icon_rs.infoWindowAnchor= new GPoint(15,50);
var point = new GLatLng(41.97359391, -87.70317077);
map.addOverlay(createMarker(point,'<b>River Park Rest Stop</b><br/><br/>Port-o-lets, first aid, refreshments, cycle repair, and Lost & Found. ',icon_rs)); 
 
// Repair
var icon_rp = new GIcon();
icon_rp.image = "mech_ico.gif";  
icon_rp.iconAnchor = new GPoint(15,50);
icon_rp.infoWindowAnchor= new GPoint(15,50);
var rp_txt = 'Village Cycle Center<br/>Repair Point';
map.addOverlay(createMarker(new GLatLng(41.93203934, -87.68789291),rp_txt,icon_rp)); // Diversey & Western
map.addOverlay(createMarker(new GLatLng(41.95368173, -87.71930694),rp_txt,icon_rp)); 
map.addOverlay(createMarker(new GLatLng(41.96925460, -87.64798164),rp_txt,icon_rp)); 
map.addOverlay(createMarker(new GLatLng(41.94008427, -87.63828277),rp_txt,icon_rp)); // Belmont Harbor
map.addOverlay(createMarker(new GLatLng(41.89684679, -87.61708259),rp_txt,icon_rp)); 
map.addOverlay(createMarker(new GLatLng(41.86725983, -87.64703750),rp_txt,icon_rp)); // Roosevelt & Halsted
map.addOverlay(createMarker(new GLatLng(41.90355467, -87.65828132),rp_txt,icon_rp)); 
map.addOverlay(createMarker(new GLatLng(41.93216704, -87.68797874),rp_txt,icon_rp)); 
  
//Now, the ride...
gpoly [0]= new Array();
gpoly[0][0]= new GLatLng(41.87578262, -87.62049470);
gpoly[0][1]= new GLatLng(41.86798156, -87.62042627);
gpoly[0][2]= new GLatLng(41.86722882, -87.61987883);
gpoly[0][3]= new GLatLng(41.86695510, -87.64684039);
gpoly[0][4]= new GLatLng(41.86914487, -87.64704568);
gpoly[0][5]= new GLatLng(41.87797239, -87.64704568);
gpoly[0][6]= new GLatLng(41.88563659, -87.64752470);
gpoly[0][7]= new GLatLng(41.88946869, -87.64752470);
gpoly[0][8]= new GLatLng(41.89042672, -87.64779842);
gpoly[0][9]= new GLatLng(41.89121184, -87.64769355);
gpoly[0][10]= new GLatLng(41.89635100, -87.65566386);
gpoly[0][11]= new GLatLng(41.89694177, -87.65651601);
gpoly[0][12]= new GLatLng(41.89704419, -87.65664916);
gpoly[0][13]= new GLatLng(41.90044453, -87.65674133);
gpoly[0][14]= new GLatLng(41.90130486, -87.65674133);
gpoly[0][15]= new GLatLng(41.90251342, -87.65772457);
gpoly[0][16]= new GLatLng(41.90360931, -87.65848247);
gpoly[0][17]= new GLatLng(41.90360931, -87.65886143);
gpoly[0][18]= new GLatLng(41.90545287, -87.65966030);
gpoly[0][19]= new GLatLng(41.90704038, -87.66003926);
gpoly[0][20]= new GLatLng(41.91068653, -87.66254855);
gpoly[0][21]= new GLatLng(41.91071726, -87.66255879);
gpoly[0][22]= new GLatLng(41.91620697, -87.66631760);
gpoly[0][23]= new GLatLng(41.91794811, -87.66750568);
gpoly[0][24]= new GLatLng(41.91829634, -87.66797681);
gpoly[0][25]= new GLatLng(41.91935127, -87.66968722);
gpoly[0][26]= new GLatLng(41.92156354, -87.67248329);
gpoly[0][27]= new GLatLng(41.92254677, -87.67400935);
gpoly[0][28]= new GLatLng(41.92309984, -87.67481846);
gpoly[0][29]= new GLatLng(41.92506630, -87.67764526);
gpoly[0][30]= new GLatLng(41.92720688, -87.68073834);
gpoly[0][31]= new GLatLng(41.92783164, -87.68154746);
gpoly[0][32]= new GLatLng(41.92905044, -87.68330908);
gpoly[0][33]= new GLatLng(41.93053553, -87.68545990);
gpoly[0][34]= new GLatLng(41.93214352, -87.68793847);
gpoly[0][35]= new GLatLng(41.93401781, -87.69051945);
gpoly[0][36]= new GLatLng(41.93462209, -87.69147196);
gpoly[0][37]= new GLatLng(41.93569750, -87.69304923);
gpoly[0][38]= new GLatLng(41.93731573, -87.69541513);
gpoly[0][39]= new GLatLng(41.93983527, -87.69907152);
gpoly[0][40]= new GLatLng(41.94247770, -87.70291227);
gpoly[0][41]= new GLatLng(41.94525328, -87.70696810);
gpoly[0][42]= new GLatLng(41.94760894, -87.71040942);
gpoly[0][43]= new GLatLng(41.94841806, -87.71142337);
gpoly[0][44]= new GLatLng(41.94930912, -87.71284701);
gpoly[0][45]= new GLatLng(41.95013872, -87.71400436);
gpoly[0][46]= new GLatLng(41.95100929, -87.71536654);
gpoly[0][47]= new GLatLng(41.95266849, -87.71777342);
gpoly[0][48]= new GLatLng(41.95456326, -87.72058997);
gpoly[0][49]= new GLatLng(41.95518803, -87.72159368);
gpoly[0][50]= new GLatLng(41.95615077, -87.72266909);
gpoly[0][51]= new GLatLng(41.95704183, -87.72396983);
gpoly[0][52]= new GLatLng(41.95961257, -87.72771840);
gpoly[0][53]= new GLatLng(41.96177363, -87.72777985);
gpoly[0][54]= new GLatLng(41.96349429, -87.72784130);
gpoly[0][55]= new GLatLng(41.96419074, -87.72786179);
gpoly[0][56]= new GLatLng(41.96664882, -87.72787203);
gpoly[0][57]= new GLatLng(41.96859480, -87.72791300);
gpoly[0][58]= new GLatLng(41.97024377, -87.72796421);
gpoly[0][59]= new GLatLng(41.97226144, -87.72799493);
gpoly[0][60]= new GLatLng(41.97450444, -87.72804614);
gpoly[0][61]= new GLatLng(41.97536477, -87.72805638);
gpoly[0][62]= new GLatLng(41.97555936, -87.72133763);
gpoly[0][63]= new GLatLng(41.97558437, -87.72047435);
gpoly[0][64]= new GLatLng(41.97563106, -87.71840842);
gpoly[0][65]= new GLatLng(41.97566178, -87.71415799);
gpoly[0][66]= new GLatLng(41.97570275, -87.71276508);
gpoly[0][67]= new GLatLng(41.97572324, -87.70894481);
gpoly[0][68]= new GLatLng(41.97571299, -87.70733682);
gpoly[0][69]= new GLatLng(41.97541598, -87.70623068);
gpoly[0][70]= new GLatLng(41.97541598, -87.70464317);
gpoly[0][71]= new GLatLng(41.97583590, -87.70291227);
gpoly[0][72]= new GLatLng(41.97587687, -87.69805756);
gpoly[0][73]= new GLatLng(41.97592808, -87.69244495);
gpoly[0][74]= new GLatLng(41.97595880, -87.68994590);
gpoly[0][75]= new GLatLng(41.97605098, -87.68346271);
gpoly[0][76]= new GLatLng(41.97609195, -87.68206980);
gpoly[0][77]= new GLatLng(41.97622509, -87.67852607);
gpoly[0][78]= new GLatLng(41.97622509, -87.67485943);
gpoly[0][79]= new GLatLng(41.97628655, -87.67460338);
gpoly[0][80]= new GLatLng(41.97629679, -87.67408104);
gpoly[0][81]= new GLatLng(41.97634800, -87.67110062);
gpoly[0][82]= new GLatLng(41.97645042, -87.66662486);
gpoly[0][83]= new GLatLng(41.97661429, -87.65823667);
gpoly[0][84]= new GLatLng(41.97666550, -87.65450858);
gpoly[0][85]= new GLatLng(41.97672695, -87.65229631);
gpoly[0][86]= new GLatLng(41.97672695, -87.65148719);
gpoly[0][87]= new GLatLng(41.97681913, -87.65084194);
gpoly[0][88]= new GLatLng(41.97683961, -87.65082146);
gpoly[0][89]= new GLatLng(41.97690107, -87.65057565);
gpoly[0][90]= new GLatLng(41.97469904, -87.64955145);
gpoly[0][91]= new GLatLng(41.97369532, -87.64910080);
gpoly[0][92]= new GLatLng(41.97106313, -87.64836338);
gpoly[0][93]= new GLatLng(41.96459018, -87.64684756);
gpoly[0][94]= new GLatLng(41.96028854, -87.64620232);
gpoly[0][95]= new GLatLng(41.95855764, -87.64589506);
gpoly[0][96]= new GLatLng(41.95726715, -87.64543417);
gpoly[0][97]= new GLatLng(41.95594593, -87.64489134);
gpoly[0][98]= new GLatLng(41.95477835, -87.64481965);
gpoly[0][99]= new GLatLng(41.95262753, -87.64475819);
gpoly[0][100]= new GLatLng(41.94942178, -87.64323214);
gpoly[0][101]= new GLatLng(41.94610337, -87.64149100);
gpoly[0][102]= new GLatLng(41.94302053, -87.63981131);
gpoly[0][103]= new GLatLng(41.94076729, -87.63844912);
gpoly[0][104]= new GLatLng(41.93906712, -87.63636999);
gpoly[0][105]= new GLatLng(41.93702896, -87.63386070);
gpoly[0][106]= new GLatLng(41.93535951, -87.63248828);
gpoly[0][107]= new GLatLng(41.93340329, -87.63191472);
gpoly[0][108]= new GLatLng(41.93224594, -87.63185327);
gpoly[0][109]= new GLatLng(41.93223570, -87.63184303);
gpoly[0][110]= new GLatLng(41.92815939, -87.63167916);
gpoly[0][111]= new GLatLng(41.92597784, -87.63110561);
gpoly[0][112]= new GLatLng(41.91967901, -87.62934398);
gpoly[0][113]= new GLatLng(41.91873675, -87.62912890);
gpoly[0][114]= new GLatLng(41.91331873, -87.62633283);
gpoly[0][115]= new GLatLng(41.90918096, -87.62561589);
gpoly[0][116]= new GLatLng(41.90650780, -87.62496041);
gpoly[0][117]= new GLatLng(41.90412141, -87.62442782);
gpoly[0][118]= new GLatLng(41.90232906, -87.62379282);
gpoly[0][119]= new GLatLng(41.90183744, -87.62337290);
gpoly[0][120]= new GLatLng(41.90138680, -87.61976771);
gpoly[0][121]= new GLatLng(41.89483192, -87.61526123);
gpoly[0][122]= new GLatLng(41.89277327, -87.61410389);
gpoly[0][123]= new GLatLng(41.88843067, -87.61412437);
gpoly[0][124]= new GLatLng(41.88771373, -87.61443163);
gpoly[0][125]= new GLatLng(41.88689437, -87.61415510);
gpoly[0][126]= new GLatLng(41.88502008, -87.61388880);
gpoly[0][127]= new GLatLng(41.88410854, -87.61474913);
gpoly[0][128]= new GLatLng(41.88352475, -87.61660293);
gpoly[0][129]= new GLatLng(41.88301265, -87.61734036);
gpoly[0][130]= new GLatLng(41.87982739, -87.61730963);
gpoly[0][131]= new GLatLng(41.87412259, -87.61699213);
gpoly[0][132]= new GLatLng(41.86867385, -87.61693068);
gpoly[0][133]= new GLatLng(41.86752674, -87.61788318);
gpoly[0][134]= new GLatLng(41.86722972, -87.61887666);
gpoly[0][135]= new GLatLng(41.86720924, -87.61984965);

gpoly [1]= null;
//for (i=0; i<136; i++) 
map.addOverlay(new GPolyline(gpoly[0],'#FF0000'));
}

function createMarker(point,html,icon) {
	var marker = new GMarker(point,icon);
	GEvent.addListener(marker, "click", function() {
	  marker.openInfoWindowHtml(html);
	});     
	return marker;
}