var tb = 't'; // top or bottom (t or b)

var headbg = '#cccccc';  // table heading background colour

var evColor = '#FDBE72';  // events font colour

var todaybg = '#99cccA'; // current selected date background colour

var textclr = '#FFFFFF'; // text colour

var linkclr = '#FDBE72'; // link text colour

var noMessage =  ''; // 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++] = "20090605 80's Weekend! Dress 80's for fun";
dA[x++] = "20090606 80's Weekend! Dress 80's for fun";
dA[x++] = "20090619 6:30pm class cancelled";
dA[x++] = "20090620 Rajashree's seminar!  9:00am & 4:30pm classes cancelled";
dA[x++] = "20090703 6:30pm class closed";
dA[x++] = "20090704 4:30pm class closed";
dA[x++] = "20090705 9:00am class closed";
dA[x++] = "20090709 All classes closed in honor of Bishnu Ghosh";
dA[x++] = "20090828 Last day for noon classes on Fridays";
dA[x++] = "20090904 noon & 6:30pm classes closed";
dA[x++] = "20090905 4:30pm class closed";
dA[x++] = "20090906 9:00am class closed";
dA[x++] = "20090907 All normal classes closed. Special class at noon!";
dA[x++] = "20090910 First day for noon classes on Thursdays";
dA[x++] = "20090912 Yoga in the Park, 9:30am";
dA[x++] = "20090923 8:15pm class is cancelled";
dA[x++] = "20091010 Regional Asana Championships";
dA[x++] = "20091012 Yoga Nerd Throw Down, 4:30pm & 6:30pm";
dA[x++] = "20091024 Halloween Party!";
dA[x++] = "20091107 Open Play @10:30am";
dA[x++] = "20091125 8:15pm class is cancelled";
dA[x++] = "20091126 9:30am class ONLY";
dA[x++] = "20091127 4:30pm class ONLY";
dA[x++] = "20091223 8:15pm class is cancelled";
dA[x++] = "20091224 4:30pm & 6:30pm classes closed";
dA[x++] = "20091225 3pm class ONLY";
dA[x++] = "20091230 8:15pm class is cancelled";
dA[x++] = "20091231 4:30pm & 6:30pm classes closed";
dA[x++] = "20100101 3pm class ONLY";
dA[x++] = "20100109 Open Play @10:30am";
dA[x++] = "20100111 Yoga Nerd Throw Down II, 4:30pm & 6:30pm";
dA[x++] = "20100129 Food & Clothing Drive, 6am & 6:30pm";
dA[x++] = "20100201 30-Day Challenge Begins";
dA[x++] = "20100301 1-yr unlimited package goes on sale till 3/7";
dA[x++] = "20100302 End of the 30-Day Challenge";
dA[x++] = "20100303 KCBY's 3rd Anniversary";
dA[x++] = "20100305 Anniversary Party, 8:30pm";
dA[x++] = "20100307 Last day for the 1-yr unlimited membership sale";
dA[x++] = "20100320 Yoga Nerd Throwdown III, 9am & 4:30pm";
dA[x++] = "20100522 2-3pm brain-tapping presentation";
dA[x++] = "20100531 9:30am class ONLY";
dA[x++] = "20100709 STUDIO CLOSED ALL DAY";
dA[x++] = "20100806 6:30pm class CANCELLED";
dA[x++] = "20100807 9am class MOVED to 8am. Competition starts at 11am";
dA[x++] = "20100808 9am - seminar with Esak";
dA[x++] = "20100702 6:30pm class CLOSED";
dA[x++] = "20100703 9am class ONLY";
dA[x++] = "20100704 9am class ONLY";
dA[x++] = "20100903 6:30pm class CLOSED";
dA[x++] = "20100904 9am class ONLY";
dA[x++] = "20100905 9am class ONLY";
dA[x++] = "20100906 9:30am class ONLY";


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 + '" ><b>'; var td_start = '<td width="30" align="center">'; var cal = '<div id="cal"><div style="border:1pt solid #cccccc;height:200px;width:238px;margin-left:auto;margin-right:auto;"><table border="0" cellspacing="0" cellpadding="2" align="center"><tr><td colspan="7" align="center" style="background:' + headbg + '" ><b>' + moy[month]  + ' ' + year + '<\/b><\/td><\/tr><tr style="background:' + headbg + '">'; 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" align="center"><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="color:'+evColor+';border:1pt solid #cccccc;width:238px;margin-left:auto;margin-right:auto;"><\/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;font-weight:bold;background:black;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 = '<b>' + selDate + ':<br \/>' +ct+'</b>'; 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; }