var tb = 'b'; // top or bottom (t or b)
var headbg = '#02025c';  // table heading background colour
var todaybg = '#9D9FCC'; // current selected date background colour
var textclr = '#999999'; // text colour
var linkclr = '#FF7000'; // link text colour
var noMessage =  'No Current Evets.'; // message to display when no entry in array

var dA = new Array(); var x = 0;
// first 8 characters in ccyymmdd format for single date events
// first 8 characters in 0000mmdd format for every year events
dA[x++] = "00000101 New Year";
dA[x++] = "00000214 Valentine's day";
dA[x++] = "00001224 Christmas Eve";
dA[x++] = "00001225 Christmas Day";

//Monday weekly rides (through August 2009)
dA[x++] = "20090921 <b>Time:</b> 6:00pm <br> <b>Pace:</b> Moderate <br> <b>Meet at:</b>Bike World: Urbandale (6600 Douglas Avenue in Urbandale 515-255-7047) <br> <b>Description:</b> Ride leaves at 6pm sharp, a loop out the InterUrban Trail to the Neal Smith Trail and back again. 25 miles. As daylight allows, we will head over the mile long bridge at Polk City and back either North West Beaver or back through Granger and the Raccoon river Trail. 40 miles. Parking is a challenge here so please avoid the shops parking lot. <br> <b>Length:</b> 25 miles / 40 miles";
dA[x++] = "20090928 <b>Time:</b> 6:00pm <br> <b>Pace:</b> Moderate <br> <b>Meet at:</b>Bike World: Urbandale (6600 Douglas Avenue in Urbandale 515-255-7047) <br> <b>Description:</b> Ride leaves at 6pm sharp, a loop out the InterUrban Trail to the Neal Smith Trail and back again. 25 miles. As daylight allows, we will head over the mile long bridge at Polk City and back either North West Beaver or back through Granger and the Raccoon river Trail. 40 miles. Parking is a challenge here so please avoid the shops parking lot. <br> <b>Length:</b> 25 miles / 40 miles";
dA[x++] = "20091005 <b>Time:</b> 6:00pm <br> <b>Pace:</b> Moderate <br> <b>Meet at:</b>Bike World: Urbandale (6600 Douglas Avenue in Urbandale 515-255-7047) <br> <b>Description:</b> Ride leaves at 6pm sharp, a loop out the InterUrban Trail to the Neal Smith Trail and back again. 25 miles. As daylight allows, we will head over the mile long bridge at Polk City and back either North West Beaver or back through Granger and the Raccoon river Trail. 40 miles. Parking is a challenge here so please avoid the shops parking lot. <br> <b>Length:</b> 25 miles / 40 miles";
dA[x++] = "20091012 <b>Time:</b> 6:00pm <br> <b>Pace:</b> Moderate <br> <b>Meet at:</b>Bike World: Urbandale (6600 Douglas Avenue in Urbandale 515-255-7047) <br> <b>Description:</b> Ride leaves at 6pm sharp, a loop out the InterUrban Trail to the Neal Smith Trail and back again. 25 miles. As daylight allows, we will head over the mile long bridge at Polk City and back either North West Beaver or back through Granger and the Raccoon river Trail. 40 miles. Parking is a challenge here so please avoid the shops parking lot. <br> <b>Length:</b> 25 miles / 40 miles";
dA[x++] = "20091019 <b>Time:</b> 6:00pm <br> <b>Pace:</b> Moderate <br> <b>Meet at:</b>Bike World: Urbandale (6600 Douglas Avenue in Urbandale 515-255-7047) <br> <b>Description:</b> Ride leaves at 6pm sharp, a loop out the InterUrban Trail to the Neal Smith Trail and back again. 25 miles. As daylight allows, we will head over the mile long bridge at Polk City and back either North West Beaver or back through Granger and the Raccoon river Trail. 40 miles. Parking is a challenge here so please avoid the shops parking lot. <br> <b>Length:</b> 25 miles / 40 miles";
dA[x++] = "20091026 <b>Time:</b> 6:00pm <br> <b>Pace:</b> Moderate <br> <b>Meet at:</b>Bike World: Urbandale (6600 Douglas Avenue in Urbandale 515-255-7047) <br> <b>Description:</b> Ride leaves at 6pm sharp, a loop out the InterUrban Trail to the Neal Smith Trail and back again. 25 miles. As daylight allows, we will head over the mile long bridge at Polk City and back either North West Beaver or back through Granger and the Raccoon river Trail. 40 miles. Parking is a challenge here so please avoid the shops parking lot. <br> <b>Length:</b> 25 miles / 40 miles";

//Tuesday weekly rides
dA[x++] = "20090922 <b>Time:</b> 6:00pm <br> <b>Pace:</b> Mixed <br> <b>Type/Trail:</b> DMCC Ride East! <br> <b>Meet at:</b> Burger King/Slumberland parking lot (E25th and Euclid) <br> <b>Description:</b> 1.5-2 hours of RAGBRAI training, hills and great company. <br> <b>Contact:</b> Roberta at milhalovich_1@yahoo.com";
dA[x++] = "20090929 <b>Time:</b> 6:00pm <br> <b>Pace:</b> Mixed <br> <b>Type/Trail:</b> DMCC Ride East! <br> <b>Meet at:</b> Burger King/Slumberland parking lot (E25th and Euclid) <br> <b>Description:</b> 1.5-2 hours of RAGBRAI training, hills and great company. <br> <b>Contact:</b> Roberta at milhalovich_1@yahoo.com";
dA[x++] = "20091006 <b>Time:</b> 6:00pm <br> <b>Pace:</b> Mixed <br> <b>Type/Trail:</b> DMCC Ride East! <br> <b>Meet at:</b> Burger King/Slumberland parking lot (E25th and Euclid) <br> <b>Description:</b> 1.5-2 hours of RAGBRAI training, hills and great company. <br> <b>Contact:</b> Roberta at milhalovich_1@yahoo.com";
dA[x++] = "20091013 <b>Time:</b> 6:00pm <br> <b>Pace:</b> Mixed <br> <b>Type/Trail:</b> DMCC Ride East! <br> <b>Meet at:</b> Burger King/Slumberland parking lot (E25th and Euclid) <br> <b>Description:</b> 1.5-2 hours of RAGBRAI training, hills and great company. <br> <b>Contact:</b> Roberta at milhalovich_1@yahoo.com";
dA[x++] = "20091020 <b>Time:</b> 6:00pm <br> <b>Pace:</b> Mixed <br> <b>Type/Trail:</b> DMCC Ride East! <br> <b>Meet at:</b> Burger King/Slumberland parking lot (E25th and Euclid) <br> <b>Description:</b> 1.5-2 hours of RAGBRAI training, hills and great company. <br> <b>Contact:</b> Roberta at milhalovich_1@yahoo.com";
dA[x++] = "20091027 <b>Time:</b> 6:00pm <br> <b>Pace:</b> Mixed <br> <b>Type/Trail:</b> DMCC Ride East! <br> <b>Meet at:</b> Burger King/Slumberland parking lot (E25th and Euclid) <br> <b>Description:</b> 1.5-2 hours of RAGBRAI training, hills and great company. <br> <b>Contact:</b> Roberta at milhalovich_1@yahoo.com";

//Wednesday weekly rides
dA[x++] = "20090923 <b>Time:</b> 5:30pm <br> <b>Pace:</b> Mixed <br> <b>Type/Trail:</b> Irwin's Bike and Sport <br> <b>Meet at:</b> Irwin's Bike and Sport (5500 Merle Hay Road 515-270-8304) <br> <b>Description:</b> We have several groups at different speeds and distances. Everyone is welcome, and no one gets left behind. <br> <br> -OR- <br><br> <b>Time:</b> 5:30pm - 8:00pm <br> <b>Pace:</b> Mixed <br> <b>Type/Trail:</b> Punk Rock Cycling - Papa John's Ride <br> <b>Meet at:</b> Rasmussen's Bike Shop <br> <b>Description:</b> A 'no-drop' ride with the women of PRC for either 24 or 31 miles- your choice. Riders of all abilities are welcome. The women of PRC will ensure that no one is left behind. The first 6 miles of the ride are flat, after that, we'll hit a few hills. If you are driving to the event please park west of Charlie's Filling Station.";
dA[x++] = "20090930 <b>Time:</b> 5:30pm <br> <b>Pace:</b> Mixed <br> <b>Type/Trail:</b> Irwin's Bike and Sport <br> <b>Meet at:</b> Irwin's Bike and Sport (5500 Merle Hay Road 515-270-8304) <br> <b>Description:</b> We have several groups at different speeds and distances. Everyone is welcome, and no one gets left behind. <br> <br> -OR- <br><br> <b>Time:</b> 5:30pm - 8:00pm <br> <b>Pace:</b> Mixed <br> <b>Type/Trail:</b> Punk Rock Cycling - Papa John's Ride <br> <b>Meet at:</b> Rasmussen's Bike Shop <br> <b>Description:</b> A 'no-drop' ride with the women of PRC for either 24 or 31 miles- your choice. Riders of all abilities are welcome. The women of PRC will ensure that no one is left behind. The first 6 miles of the ride are flat, after that, we'll hit a few hills. If you are driving to the event please park west of Charlie's Filling Station.";
dA[x++] = "20091007 <b>Time:</b> 5:30pm <br> <b>Pace:</b> Mixed <br> <b>Type/Trail:</b> Irwin's Bike and Sport <br> <b>Meet at:</b> Irwin's Bike and Sport (5500 Merle Hay Road 515-270-8304) <br> <b>Description:</b> We have several groups at different speeds and distances. Everyone is welcome, and no one gets left behind. <br> <br> -OR- <br><br> <b>Time:</b> 5:30pm - 8:00pm <br> <b>Pace:</b> Mixed <br> <b>Type/Trail:</b> Punk Rock Cycling - Papa John's Ride <br> <b>Meet at:</b> Rasmussen's Bike Shop <br> <b>Description:</b> A 'no-drop' ride with the women of PRC for either 24 or 31 miles- your choice. Riders of all abilities are welcome. The women of PRC will ensure that no one is left behind. The first 6 miles of the ride are flat, after that, we'll hit a few hills. If you are driving to the event please park west of Charlie's Filling Station.";
dA[x++] = "20091014 <b>Time:</b> 5:30pm <br> <b>Pace:</b> Mixed <br> <b>Type/Trail:</b> Irwin's Bike and Sport <br> <b>Meet at:</b> Irwin's Bike and Sport (5500 Merle Hay Road 515-270-8304) <br> <b>Description:</b> We have several groups at different speeds and distances. Everyone is welcome, and no one gets left behind. <br> <br> -OR- <br><br> <b>Time:</b> 5:30pm - 8:00pm <br> <b>Pace:</b> Mixed <br> <b>Type/Trail:</b> Punk Rock Cycling - Papa John's Ride <br> <b>Meet at:</b> Rasmussen's Bike Shop <br> <b>Description:</b> A 'no-drop' ride with the women of PRC for either 24 or 31 miles- your choice. Riders of all abilities are welcome. The women of PRC will ensure that no one is left behind. The first 6 miles of the ride are flat, after that, we'll hit a few hills. If you are driving to the event please park west of Charlie's Filling Station.";
dA[x++] = "20091021 <b>Time:</b> 5:30pm <br> <b>Pace:</b> Mixed <br> <b>Type/Trail:</b> Irwin's Bike and Sport <br> <b>Meet at:</b> Irwin's Bike and Sport (5500 Merle Hay Road 515-270-8304) <br> <b>Description:</b> We have several groups at different speeds and distances. Everyone is welcome, and no one gets left behind. <br> <br> -OR- <br><br> <b>Time:</b> 5:30pm - 8:00pm <br> <b>Pace:</b> Mixed <br> <b>Type/Trail:</b> Punk Rock Cycling - Papa John's Ride <br> <b>Meet at:</b> Rasmussen's Bike Shop <br> <b>Description:</b> A 'no-drop' ride with the women of PRC for either 24 or 31 miles- your choice. Riders of all abilities are welcome. The women of PRC will ensure that no one is left behind. The first 6 miles of the ride are flat, after that, we'll hit a few hills. If you are driving to the event please park west of Charlie's Filling Station.";
dA[x++] = "20091028 <b>Time:</b> 5:30pm <br> <b>Pace:</b> Mixed <br> <b>Type/Trail:</b> Irwin's Bike and Sport <br> <b>Meet at:</b> Irwin's Bike and Sport (5500 Merle Hay Road 515-270-8304) <br> <b>Description:</b> We have several groups at different speeds and distances. Everyone is welcome, and no one gets left behind. <br> <br> -OR- <br><br> <b>Time:</b> 5:30pm - 8:00pm <br> <b>Pace:</b> Mixed <br> <b>Type/Trail:</b> Punk Rock Cycling - Papa John's Ride <br> <b>Meet at:</b> Rasmussen's Bike Shop <br> <b>Description:</b> A 'no-drop' ride with the women of PRC for either 24 or 31 miles- your choice. Riders of all abilities are welcome. The women of PRC will ensure that no one is left behind. The first 6 miles of the ride are flat, after that, we'll hit a few hills. If you are driving to the event please park west of Charlie's Filling Station.";

//Saturday weekly rides
dA[x++] = "20090905 <b>Time:</b> 8:00am <br> <b>Pace:</b> Mixed <br> <b>Type/Trail:</b> Ride'n GREEN to the Farmer's Market <br> <b>Meet at:</b> Clive Aquatic Center parking lot (1801 N.W. 114th St.) <br> <b>Description:</b> The Des Moines Cycle Club and the City of Clive are happy to announce a new event for all levels of cyclists. Ride'n Green to the Farmers Market is a weekly ride starting at the Clive Aquatic Center parking lot at 1801 N.W. 114th St., pedaling down the trail system to the very popular Des Moines Farmer's Market. A relaxed pace will take us the 12 miles to downtown. We'll start promptly at 8:00am so please be ready to ride. The leader will spend one to two hours at the market and will lead those who want to return, or if you'd like, return on your own. We plan to park our bikes around the Polk County building on Court Avenue, there are lots of posts and trees to lock your bike. <br> <b>Length:</b> 12 miles";

// dA[x++] = "20060610 New Event Calendar Started today";

var pageLoaded = 0; window.onload = function() {pageLoaded = 1;}
	function loaded(i,f) 
		{if (document.getElementById && document.getElementById(i) != null) f(); else if (!pageLoaded) setTimeout('loaded(\''+i+'\','+f+')',100);
	}
	function monthlength(month,year) 
		{
		var dd = new Date(year, month, 0);return dd.getDate();}
		var moy = ['January','February','March','April','May','June','July','August','September','October','November','December'];
		var today = new Date();
		var selDate = today.getFullYear()+getmmdd(today.getMonth()+1,today.getDate());
	function dispCal(yy,mm) 
	{
		if (mm < 0 || mm > 12) 
			{alert('month must be between 1 and 12'); 
			return false;} 
		if (yy != 0 && (yy < 1901 || yy > 2100)) 
			{alert('year must be after 1900 and before 2101'); 
			return false;} 
		var dow = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']; 
		var calendar = new Date();  
		var today = calendar.getDate(); calendar.setDate(1); 
			if (yy > 1900) calendar.setFullYear(yy); 
			if (mm > 0) calendar.setMonth(mm - 1); 
		var yy = year = calendar.getFullYear(); 
		var month = calendar.getMonth(); calendar.setDate(today); 
		var weekday = calendar.getDay(); 
		var daysInMonth = monthlength(month+1,year); 
		var hilite_start = '<td width="30" style="background:' + todaybg + '"align="center"><b>'; 
		var td_start = '<td width="30" align="center">'; 

//Start of main calendar box size and styles   *******************************************************************************		
		var cal = '<div id="cal"><div style="height:150px;width:290px"><table border="0" cellspacing="0" cellpadding="2" align="center" width="290"><tr><td colspan="7" style="background:' + headbg + ';color:#ffffff;" align="center"><b>' + moy[month]  + ' ' + year + '<\/b><\/td><\/tr><tr>'; 
			for(dex=0; dex < 7; dex++) {cal += td_start + dow[dex] + '</td>';} cal += '<\/tr><tr>'; 
		var day2 = today; 
			for (dex = today; dex > 6; dex -=7) day2 = dex; weekday -= day2 - 1; 
			while (weekday < 0) weekday += 7; 
			for(dex=0; dex < weekday; dex++) cal += td_start + ' <\/td>'; 
			for(dex=1; dex <= daysInMonth; dex++) 
			{
				if(weekday == 7) {cal += '</tr><tr>'; weekday = 0;} 
				if(selDate==year+getmmdd(month+1,dex)) cal += hilite_start +'<span'+clickDate(dex,month,year) + '>'+ dex + '<\/span><\/b><\/td>'; 
					else cal += td_start + '<span '+clickDate(dex,month,year) + '>' + dex + '<\/span><\/td>'; weekday += 1;} 
			for(dex=weekday; dex < 7; dex++) cal += td_start + ' <\/td>'; cal += '<\/tr><\/table><\/div>';
				if (document.getElementById) {var mmb = month;  mm = month + 1; var yya = yyb = yy; 
				if (mmb <1) {mmb += 12; yyb--;} var mma = month + 2; 
				if (mma > 12) {mma -= 12; yya++;} 
		var yb = yy -1; 

//Start of bottom month scroll bars for previous month and next month   ********************************************************
var ya = yy +1; cal += '<table border="0" cellspacing="0" cellpadding="2" width="290"><tr><td colspan="4" align="center"><a href="#" onclick="if (cala = dispCal('+yyb+','+mmb+')) {document.getElementById(\'cal\').innerHTML = cala; return false;}"><<</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" onclick="if (cala = dispCal('+yya+','+mma+')) {document.getElementById(\'cal\').innerHTML = cala; return false;}">>></a><br></td></tr></table>';} 
			else {cal += '<div> </div>';} cal += '</div>'; 
			return cal;}

//Start of bottom description display box for events content  ******************************************************************
function start() 
	{
		var x = '<div id="calDate" style="width:290px; margin-top: 10px; padding:3px; background-color:#ffffff; border:2px solid #677DB0"><\/div>'; 
		var y = ''; if (tb == 't') y = x + dispCal(0,0); 
			else y = dispCal(0,0) + x; document.getElementById('calendar').innerHTML = y; ev();}
			loaded('calendar',start);
function clickDate(day, month, year) 
	{
		var ct = nextDate(year + getmmdd(month+1,day));
			if (ct == '') ct = nextDate('0000' + getmmdd(month+1,day));
			if (ct == '') return 'style="color:'+textclr+'"'; 
			else return 'style="cursor:pointer;color:'+linkclr+'" onclick="selDate = '+year+ getmmdd(month+1,day)+'; isDate(' + day + ',' + month + ',' + year + ');return false;"';}
function isDate(dayVal,monthVal,yearVal) 
	{
		var ct = nextDate(yearVal + getmmdd(monthVal+1,dayVal));
			if (ct == '') ct = nextDate('0000' + getmmdd(monthVal+1,dayVal));
			if (ct == '') ct = noMessage;document.getElementById('calDate').innerHTML = ct; 
			return false;}
function nextDate(yymmdd) 
	{
		var x = dA.length;
		for (var i = 0; i < x; i++) 
		{
			if (dA[i].substr(0,8) == yymmdd) return dA[i].substr(8);}
				return '';}
function getmmdd(mm,dd) 
	{
		return (mm > 9 ? '' + mm : '0' + mm) + (dd > 9 ? dd : '0' + dd);}
function ev() 
	{
		var ct = nextDate(selDate);
		var ct = nextDate(selDate);
			if (ct == '') ct = nextDate('0000' + selDate.substr(4));
			if (ct == '') ct = noMessage; document.getElementById('calDate').innerHTML = ct;}