var tb = 't'; // top or bottom (t or b)
var headbg = '#6280cb';  // table heading background colour
var todaybg = '#a7bce8'; // current selected date background colour
var textclr = '#0f3187'; // text colour
var linkclr = '#FF0000'; // link text colour
var noMessage =  'Geen activiteit'; // 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++] = "02022008 Vastenavondfeest";
dA[x++] = "08022008 Receptie Gemeente";
dA[x++] = "08032008 Lenteconcert";
dA[x++] = "30032008 Plantenmarkt Opdorp 15u";
dA[x++] = "05042008 Concert te Haacht";
dA[x++] = "12042008 Lenterestaurant";
dA[x++] = "13042008 Lenterestaurant";
dA[x++] = "04052008 Concert Sint-Jozef";
dA[x++] = "18052008 Tornooi (Ternat)";
dA[x++] = "30052008 Examen Concordiaantjes";
dA[x++] = "06062008 Examen Concordiaantjes";
dA[x++] = "08062008 Breughelconcert";
dA[x++] = "27062008 Kanaalfeesten";
dA[x++] = "28062008 Kanaalfeesten";
dA[x++] = "29062008 Parochiefeesten (Jeugd)";
dA[x++] = "19072008 Fietstocht";
dA[x++] = "07092008 Concert Sint-Jozef";
dA[x++] = "12102008 Vlamo-Tornooi";
dA[x++] = "18102008 Herfstrestaurant";
dA[x++] = "19102008 Herfstrestaurant";
dA[x++] = "24102008 Muziekweekend";
dA[x++] = "25102008 Muziekweekend";
dA[x++] = "26102008 Muziekweekend";
dA[x++] = "08112008 Ledenfeest";
dA[x++] = "07122008 Vlamo-Tornooi";
dA[x++] = "20122008 Kerstconcert";
dA[x++] = "28022009 Vastenavondfeest";
dA[x++] = "28032009 Lenteconcert";
dA[x++] = "26042009 Wedstrijd Luc Joosten";
dA[x++] = "16052009 Lenterestaurant";
dA[x++] = "17052009 Lenterestaurant";
dA[x++] = "29052009 Examen Concordiaantjes";
dA[x++] = "07062009 Breughelconcert";
dA[x++] = "26062009 Kanaalfeesten";
dA[x++] = "27062009 Kanaalfeesten";
dA[x++] = "05072009 Aperitiefconcert";
dA[x++] = "18072009 Fietstocht";
dA[x++] = "04092009 Inschrijvingen concordiaantjes";
dA[x++] = "12092009 Concert te Brussel";
dA[x++] = "27092009 Try-out";
dA[x++] = "11102009 Provinciaal Tornooi";
dA[x++] = "17102009 Herfstrestaurant";
dA[x++] = "18102009 Herfstrestaurant";
dA[x++] = "14112009 Ledenfeest";
dA[x++] = "12122009 Concert De Pit";
dA[x++] = "16012010 Mnozil Brass";
dA[x++] = "06022010 Concert Kapelle o/d Bos";
dA[x++] = "13022010 Vastenavondfeest";
dA[x++] = "28022010 Solistentornooi";
dA[x++] = "20032010 Lenteconcert";
dA[x++] = "24042010 Lenterestaurant";
dA[x++] = "25042010 Lenterestaurant";
dA[x++] = "30052010 Breughelconcert";
dA[x++] = "13062010 Zeepkistenrace";
dA[x++] = "25062010 Kanaalfeesten";
dA[x++] = "26062010 Kanaalfeesten";
dA[x++] = "27062010 Parochiefeesten";
dA[x++] = "17072010 Fietstocht";
dA[x++] = "25092010 Trouw Bart & Katrien";
dA[x++] = "02102010 Dubbelconcert Schriek";
dA[x++] = "23102010 Herfstrestaurant";
dA[x++] = "24102010 Herfstrestaurant";
dA[x++] = "29102010 Muziekweekend";
dA[x++] = "30102010 Muziekweekend";
dA[x++] = "31102010 Muziekweekend";
dA[x++] = "06112010 Ledenfeest";
dA[x++] = "04122010 Dubbelconcert";
dA[x++] = "05032011 Vastenavondfeest";
dA[x++] = "09042011 Lenteconcert";
dA[x++] = "14052011 Lenterestaurant";
dA[x++] = "15052011 Lenterestaurant";
dA[x++] = "21052011 Trouw Christophe & Cindy";
dA[x++] = "22102011 Herfstrestaurant";
dA[x++] = "23102011 Herfstrestaurant";
dA[x++] = "05112011 Ledenfeest";
dA[x++] = "03122011 Concert in De Pit";

// dA[x++] = "20060610 New Event Calendar Started today";

// 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 = ['JANUARI','FEBRUARI','MAART','APRIL','MEI','JUNI','JULI','AUGUSTUS','SEPTEMBER','OKTOBER','NOVEMBER','DECEMBER'];
var today = new Date();
var selDate = getmmdd(today.getDate(),today.getMonth()+1)+today.getFullYear();

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 = ['M','D','W','D','V','Z','Z']; 
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="40" style="background:' + todaybg + '" align="center"><b>'; 
var td_start = '<td width="40" align="center">'; 
var cal = '<div id="cal"><div style="border:1pt solid #0f3187;height:150px;width:220px"><table border="1" bordercolor="#0f3187" cellspacing="1" cellpadding="1" align="center"><tr><td colspan="7" width="98%" 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 - 0; 
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==getmmdd(dex,month+1)+year) 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="1" bordercolor="#0f3187" cellspacing="1" cellpadding="1" width="100%"><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="center"><a href="#" onclick="if (cala = dispCal('+yya+','+mma+')) {document.getElementById(\'cal\').innerHTML = cala; return false;}">></a></td><td align="center"><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 #0f3187;width:220px"><\/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(getmmdd(day,month+1) + year);
if (ct == '') ct = nextDate(getmmdd(day,month+1) + '0000');
if (ct == '') return 'style="color:'+textclr+'"'; 
else return 'style="cursor:pointer;color:'+linkclr+'" onclick="selDate = '+ getmmdd(day,month+1)+year+'; isDate(' + day + ',' + month + ',' + year + ');return false;"';
}function isDate(dayVal,monthVal,yearVal) {var ct = nextDate(getmmdd(dayVal,monthVal+1) + yearVal);
if (ct == '') ct = nextDate(getmmdd(day,month+1) + '0000');
if (ct == '') ct = noMessage;document.getElementById('calDate').innerHTML = selDate + ':' +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(selDate.substr(4) + '0000');if (ct == '') ct = noMessage; document.getElementById('calDate').innerHTML = selDate + ':' +ct;}
