// Event Calendar
// copyright Stephen Chapman, 10th June 2006, 22nd January 2010

// window.onload = event;

var tb = 't'; // top or bottom (t or b)
var headbg = '#ffff33';  // table heading background colour
var todaybg = '#99cccc'; // current selected date background colour
var textclr = '#000000'; // text colour
var linkclr = '#ff0000'; // link text colour
var noMessage =  'No event messages to display for today'; // 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++] = "20100328 T6 Event Calendar Started today";
dA[x++] = "00000623 Mr. Hagemann's Birthday <br /> Mr. Sawyer's Birthday";
dA[x++] = "20100405 Prepare Menus For LGC Campout <br /> Rocking Chair Patrol Meeting";
dA[x++] = "20100406 Committee Meeting";
dA[x++] = "20100410 Spring Cleaning";
dA[x++] = "20100412 Safety Training For LGC Campout";
dA[x++] = "20100417 Clean LGC Campsite <br /> 9:00 AM - Noon";
dA[x++] = "20100419 Repeat Safety Training For LGC Campout";
dA[x++] = "20100423 Depart LGC Campout 5:30 PM";
dA[x++] = "20100424 LGC Campout";
dA[x++] = "20100425 LGC Campout";
dA[x++] = "20100426 Dodge Ball Tournament <br /> PLC";
dA[x++] = "20100503 Prepare Menus For Gettysburg Campout <br /> Rocking Chair Patrol Meeting";
dA[x++] = "20100504 Committee Meeting";
dA[x++] = "20100510 Summer Camp Physicals (free)";
dA[x++] = "20100514 Depart For Gettysburg 5:00 PM";
dA[x++] = "20100515 Gettysburg Campout";
dA[x++] = "20100516 Gettysburg Campout";
dA[x++] = "20100517 PLC Meeting";
dA[x++] = "20100524 Ice Cream Floats";
dA[x++] = "20100529 Adopt-A-Spot 9:00 AM";
dA[x++] = "20100601 Committee Meeting";
dA[x++] = "20100605 Mystery Activity";
dA[x++] = "20100607 Court of Honor";
dA[x++] = "20100614 Prepare Menus For Buffalo Hunt Campout <br /> Rocking Chair Patrol Meeting";
dA[x++] = "20100618 Depart For Buffalo Hunt Campout 5:30 PM";
dA[x++] = "20100619 Buffalo Hunt Campout";
dA[x++] = "20100620 Buffalo Hunt Campout";
dA[x++] = "20100621 PLC Meeting";
dA[x++] = "20100628 Collect Troop Dues <br /> Depart For C&O Canal Hike";
dA[x++] = "20100629 C&O Canal Hike";
dA[x++] = "20100630 C&O Canal Hike";
dA[x++] = "20100701 C&O Canal Hike";
dA[x++] = "20100702 C&O Canal Hike";
dA[x++] = "20100705 Plan For Summer Camp";
dA[x++] = "20100712 Plan For Summer Camp <br /> Rocking Chair Patrol Meeting";
dA[x++] = "20100717 Pack For Camp 5:00 PM";
dA[x++] = "20100718 Depart For Brady Saunders 11:00 AM";
dA[x++] = "20100719 Brady Saunders";
dA[x++] = "20100720 Brady Saunders";
dA[x++] = "20100721 Brady Saunders";
dA[x++] = "20100722 Brady Saunders";
dA[x++] = "20100723 Brady Saunders";
dA[x++] = "20100724 Brady Saunders";
dA[x++] = "20100726 PLC Meeting";
dA[x++] = "20100726 Adopt-A-Spot 7:00 PM";
dA[x++] = "20100730 Day Trip To National Scout Jamboree";
dA[x++] = "20100802 Troop Elections";
dA[x++] = "20100803 Committee Meeting";
dA[x++] = "20100809 Rocking Chair Patrol Meeting <br /> Depart For Philmont";
dA[x++] = "20100816 Prepare Menus For Great Summer Adventure Campout";
dA[x++] = "20100823 Plan For Great Summer Adventure Campout";
dA[x++] = "20100819 Return From Philmont <br /> Adopt-A-Spot";
dA[x++] = "20100825 Depart For Great Summer Adventure Campout";
dA[x++] = "20100826 Great Summer Adventure Campout";
dA[x++] = "20100827 Great Summer Adventure Campout";
dA[x++] = "20100828 Great Summer Adventure Campout";
dA[x++] = "20100829 Return From Great Summer Adventure Campout";
dA[x++] = "20100830 Plan Menus For AT Hike <br /> PLC Meeting";
dA[x++] = "20100826 Great Summer Adventure Campout";
dA[x++] = "20100906 Collect Troop Dues <br /> Court of Honor <br /> Return To Wearing Class A Uniforms";
dA[x++] = "20100907 Committee Meeting";
dA[x++] = "20100911 Mystery Activity";
dA[x++] = "20100913 Prepare For AT Hike <br /> Rocking Chair Patrol Meeting";
dA[x++] = "20100917 Depart For AT Hike 5:00 PM";
dA[x++] = "20100918 AT Hike";
dA[x++] = "20100919 Return From AT Hike";
dA[x++] = "20100920 MB Counselor Training";
dA[x++] = "20100927 PLC Meeting";
dA[x++] = "20101001 Depart For Leadership Training Campout 5:30 PM";
dA[x++] = "20101002 Leadership Training Campout";
dA[x++] = "20101003 Return From Leadership Training Campout";
dA[x++] = "20101004 Rocking Chair Patrol Meeting";
dA[x++] = "20101005 Committee Meeting";
dA[x++] = "20101011 Prepare Menus For Camp Finley-Albright Campout";
dA[x++] = "20101015 Depart For Camp Finley-Albright 5:30 PM";
dA[x++] = "20101016 Camp Finley-Albright Campout";
dA[x++] = "20101017 Return From Camp Finley-Albright";
dA[x++] = "20101018 WEBELOS Night";
dA[x++] = "20101025 PLC Meeting";
dA[x++] = "20101101 Prepare Patrol Menus For TIW Campout";
dA[x++] = "20101102 Committee Meeting";
dA[x++] = "20101108 Rocking Chair Patrol Meeting";
dA[x++] = "20101115 Plan for TITW Campout";
dA[x++] = "20101119 Depart For Thanksgiving In The Woods 5:30 PM";
dA[x++] = "20101120 Thanksgiving In The Woods <br /> Meal Served At 4:00 PM";
dA[x++] = "20101121 Return From TITW";
dA[x++] = "20101122 Troop Meeting";
dA[x++] = "20101127 Troop 6 Alumni Reunion <br /> Begin Christmas Tree Sales";
dA[x++] = "20101129 PLC Meeting";
dA[x++] = "20101206 Court of Honor <br /> T6 Christmas Party";
dA[x++] = "20101207 Committee Meeting";
dA[x++] = "20101210 Depart For Moonyah Campout 5:30 PM";
dA[x++] = "20101211 Moonyah Campout";
dA[x++] = "20101212 Return From Moonyah Campout";
dA[x++] = "20101213 Troop Meeting";
dA[x++] = "20101220 Troop Meeting";
dA[x++] = "20101227 PLC Meeting";
dA[x++] = "20110104 Committee Meeting";
dA[x++] = "20110110 Rocking Chair Patrol Meeting";
dA[x++] = "20110114 Lumberjack Camporee - Depart 5:30 PM";
dA[x++] = "20110115 Lumberjack Camporee";
dA[x++] = "20110116 Lumberjack Camporee - Return ~1:00 PM";
dA[x++] = "20110120 Roundtable Meeting";
dA[x++] = "20110131 PLC Meeting";
dA[x++] = "20110201 Committee Meeting 7:00 PM";
dA[x++] = "20110207 MB Counselor Meeting";
dA[x++] = "20110213 Scout Sunday 11:00 AM @ WMUMC";
dA[x++] = "20110214 Rocking Chair Patrol Meeting";
dA[x++] = "20110217 Roundtable Meeting";
dA[x++] = "20110218 Klondike Derby - Depart 5:30 PM";
dA[x++] = "20110219 Klondike Derby";
dA[x++] = "20110220 Klondike Derby - Return ~1:00 PM";
dA[x++] = "20110221 BP Party";
dA[x++] = "20110222 BP's Birthday";
dA[x++] = "20110225 OA Service Weekend";
dA[x++] = "20110226 OA Service Weekend";
dA[x++] = "20110227 OA Service Weekend";
dA[x++] = "20110228 Troop Elections";
dA[x++] = "20110301 Committee Meeting - 7:00 PM";
dA[x++] = "20110307 Spring CoH - Pay Troop Dues";
dA[x++] = "20110312 MB Saturday";
dA[x++] = "20110314 MB Madness";
dA[x++] = "20110317 Roundtable Meeting";
dA[x++] = "20110318 Wilderness Survival - Depart 5:30 PM";
dA[x++] = "20110319 Wilderness Survival";
dA[x++] = "20110320 Wilderness Survival - Return ~ 1:00 PM";
dA[x++] = "20110321 Dodge Ball Tournament";
dA[x++] = "20110328 PLC Meeting";
dA[x++] = "20110403 Adopt-a-Spot";
dA[x++] = "20110404 Swim Checks";
dA[x++] = "20110405 Committee Meeting - 7:00 PM";
dA[x++] = "20110408 Canoe Trip - Depart 5:30 PM";
dA[x++] = "20110409 Canoe Trip";
dA[x++] = "20110410 Canoe Trip - Return ~1:00 PM";
dA[x++] = "20110411 Rocking Chair Patrol Meeting";
dA[x++] = "20110415 Shooting Sports - Depart 5:30 PM";
dA[x++] = "20110416 Shooting Sports";
dA[x++] = "20110417 Shooting Sports - Return ~ 1:00 PM";
dA[x++] = "20110421 Roundtable Meeting";
dA[x++] = "20110424 Easter Sunday";
dA[x++] = "20110425 PLC Meeting";
dA[x++] = "20110430 QM Spring Cleaning";
dA[x++] = "20110507 Family Cookout";
dA[x++] = "20110510 Commitee Meeting - 7:00 PM";
dA[x++] = "20110514 MB Saturday";
dA[x++] = "20110515 Adopt-a-Spot";
dA[x++] = "20110516 Rocking Chair Patrol Meeting";
dA[x++] = "20110520 Camp Chef Campout - Depart 5:30 PM";
dA[x++] = "20110521 Camp Chef Campout";
dA[x++] = "20110522 Camp Chef Campout - Return ~1:00 PM";
dA[x++] = "20110523 Physical Exams";
dA[x++] = "20110526 Roundtable Meeting";
dA[x++] = "20110530 Memorial Day - No Scout Meeting";
dA[x++] = "20110606 Summer CoH - Pay Troop Dues";
dA[x++] = "20110607 Committee Meeting - 7:00 PM";
dA[x++] = "20110611 Adopt-a-Spot";
dA[x++] = "20110613 Rocking Chair Patrol Meeting";
dA[x++] = "20110616 Roundtable Meeting";
dA[x++] = "20110617 T6 Olympics - Depart 5:30 PM";
dA[x++] = "20110618 T6 Olympics";
dA[x++] = "20110619 T6 Olympics - Return ~1:00 PM";
dA[x++] = "20110620 Swim Checks";
dA[x++] = "20110627 Kickball Tournament <br />Begin C&O Canal Hike";
dA[x++] = "20110701 End C&O Canal Hike";
dA[x++] = "20110704 No Scout Meeting";
dA[x++] = "20110715 Pack Trucks For Summer Camp";
dA[x++] = "20110716 Leave For Summer Camp";
dA[x++] = "20110723 Return From Summer Camp";
dA[x++] = "20110801 Ice Cream Floats";
dA[x++] = "20110815 Rocking Chair Patrol Meeting";
dA[x++] = "20110824 Depart For Eagle Point";
dA[x++] = "20110828 Return From Eagle Point";
dA[x++] = "20110829 Troop Elections";
dA[x++] = "20110903 MB Saturday";
dA[x++] = "20110905 Labor Day - No Scout Meeting";
dA[x++] = "20110906 Committee Meeting - 7:00 PM";
dA[x++] = "20110909 AT Hike - Depart 5:30 PM";
dA[x++] = "20110910 AT Hike";
dA[x++] = "20110911 AT Hike - Return ~1:00 PM";
dA[x++] = "20110912 Fall CoH";
dA[x++] = "20110915 Roundtable Meeting";
dA[x++] = "20110916 OA Service Weekend";
dA[x++] = "20110917 OA Service Weekend";
dA[x++] = "20110918 OA Service Weekend";
dA[x++] = "20110923 Wolverine Patrol Hike - Depart 5:30 PM";
dA[x++] = "20110924 Wolverine Patrol Hike";
dA[x++] = "20110925 Wolverine Patrol Hike - return ~ 1:00 PM";
dA[x++] = "20110926 PLC Meeting";
dA[x++] = "20111004 Committee Meeting - 7:00 PM";
dA[x++] = "20111007 Leadership Training - Depart 5:30 PM";
dA[x++] = "20111008 Leadership Training";
dA[x++] = "20111009 Leadership Training - Return ~1:00 PM";
dA[x++] = "20111010 Rocking Chair Patrol Meeting";
dA[x++] = "20111020 Roundtable Meeting";
dA[x++] = "20111021 OSC Campout - Depart 5:30 PM";
dA[x++] = "20111022 OSC Campout";
dA[x++] = "20111023 OSC Campout - Return ~1:00 PM";
dA[x++] = "20111031 Halloween Party";
dA[x++] = "20111101 Committee Meeting - 7:00 PM";
dA[x++] = "20111114 Rocking Chair Patrol Meeting";
dA[x++] = "20111117 Roundtable Meeting";
dA[x++] = "20111118 Thanksgiving in the Woods - Depart 5:30 PM";
dA[x++] = "20111119 Thanksgiving in the Woods";
dA[x++] = "20111120 Thanksgiving in the Woods - Return ~1:00 PM";
dA[x++] = "20111124 Thanksgiving Day";
dA[x++] = "20111125 Begin Christmas Tree Sales";
dA[x++] = "20111128 PLC Meeting";
dA[x++] = "20111203 MB Saturday";
dA[x++] = "20111205 Winter CoH";
dA[x++] = "20111206 Committee Meeting - 7:00 PM";
dA[x++] = "20111209 GeoCashe Campout - Depart 5:30 PM";
dA[x++] = "20111210 GeoCashe Campout";
dA[x++] = "20111211 GeoCashe Campout - Return ~1:00 PM";
dA[x++] = "20111212 OA Election";
dA[x++] = "20111219 PLC Meeting";
dA[x++] = "20111225 Christmas";
dA[x++] = "20111226 No Scout Meeting";

// dA[x++] = "20060610 New Event Calendar Started today";
// This entry uses the ccyymmdd format to specify that the event "New Event Calendar Started" is to be displayed only on the 10th June 2006. A 00000610 event message will display in other years on that date. 

// Note that when setting up these entries everything for an entry has to go on the same line. If you want to put line breaks inside of the event text you should specify them as <br> (the text is output to the page as HTML so you need to use HTML like breaks). Also if you are going to use a quote (") in the event text you need to precede it with a \ so that the Javascript code knows that it is a part of the text and not the end of the entry. 


// permission is granted to use this javascript provided that the below code is not altered
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">'; var cal = '<div id="cal"><div style="border:1pt solid #cccccc;width:238px"><table border="0" cellspacing="0" cellpadding="2" align="center"><tr><td colspan="7" style="background:' + headbg + '" 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; var ya = yy +1; cal += '<table border="0" cellspacing="0" cellpadding="2" width="210"><tr><td><a href="#" onclick="if (cala = dispCal('+yb+','+mm+')) {document.getElementById(\'cal\').innerHTML = cala; return false;}"><<</a></td><td><a href="#" onclick="if (cala = dispCal('+yyb+','+mmb+')) {document.getElementById(\'cal\').innerHTML = cala; return false;}"><</a></td><td align="right"><a href="#" onclick="if (cala = dispCal('+yya+','+mma+')) {document.getElementById(\'cal\').innerHTML = cala; return false;}">></a></td><td align="right"><a href="#" onclick="if (cala = dispCal('+ya+','+mm+')) {document.getElementById(\'cal\').innerHTML = cala; return false;}">>></a></td></tr></table>';} else {cal += '<div> </div>';} cal += '</div>'; return cal;}
function start() {var x = '<div id="calDate" style="border:1pt solid #cccccc;width:238px"><\/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 = selDate + ':<br \/>' +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 = selDate + ':<br \/> ' +ct;}


