// Event Calendar
// copyright Stephen Chapman, 10th June 2006, 22nd January 2010

var tb = 't'; // top or bottom (t or b)
var headbg = '#cccccc';  // table heading background colour
var todaybg = '#99cccc'; // current selected date background colour
var textclr = '#000000'; // text colour
var linkclr = '#ff9999'; // 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++] = "20101028 Midland Counties - Gdgs";
dA[x++] = "20101029 Midland Counties - Wkg/Terr";
dA[x++] = "20101030 Midland Counties - Toy/Uty";
dA[x++] = "20101031 Midland Counties - Hds/Past";
dA[x++] = "20101106 Working and Pastoral Breeds of Scotland - Past";
dA[x++] = "20101107 Working and Pastoral Breeds of Scotland - Wkg";
dA[x++] = "20101113 Gundog Breeds of Scotland";
dA[x++] = "20101204 BUBA";
dA[x++] = "20101211 LKA - Toy/Uty/Wkg/Past";
dA[x++] = "20101212 LKA - Hds/Gdgs/Terr";
dA[x++] = "20110107 Boston & DCS - Gundog";
dA[x++] = "20110108 Boston & DCS - Hound/Pastoral/Working";
dA[x++] = "20110109 Boston & DCS - Utility/Toy/Terrier";
dA[x++] = "20110120 Manchester Dog Show - Terrier/Hound";
dA[x++] = "20110121 Manchester Dog Show - Utility/Toy";
dA[x++] = "20110122 Manchester Dog Show - Working/Pastoral";
dA[x++] = "20110123 Manchester Dog Show - Gundog";
dA[x++] = "20110310 dfsCrufts - Gundog";
dA[x++] = "20110311 dfsCrufts - Working/Pastoral/Obedience";
dA[x++] = "20110312 dfsCrufts - Terrier/Hound/Obedience";
dA[x++] = "20110313 dfsCrufts - Toy/Utility/Agility";
dA[x++] = "20110326 Scottish Breeds - UK Toydog";
dA[x++] = "20110402 National Terrier";
dA[x++] = "20110409 Hound Association of Scotland";
dA[x++] = "20110416 Working and Pastoral Breeds of Wales";
dA[x++] = "20110429 West of England Ladies Kennel Society - Hound/Working/Terrier";
dA[x++] = "20110430 West of England Ladies Kennel Society - Gundog/Toy";
dA[x++] = "20110501 West of England Ladies Kennel Society - Utility/Pastoral";
dA[x++] = "20110505 Birmingham National - Working/Pastoral";
dA[x++] = "20110506 Birmingham National - Utility/Toy";
dA[x++] = "20110507 Birmingham National - Hound/Terrier";
dA[x++] = "20110508 Birmingham National - Gundog";
dA[x++] = "20110520 Scottish Kennel Club - Hound/Terrier/Toy";
dA[x++] = "20110521 Scottish Kennel Club - Working/Pastoral/Obedience";
dA[x++] = "20110522 Scottish Kennel Club - Gundog/Utility/Agility";
dA[x++] = "20110527 Bath - Terrier/Toy";
dA[x++] = "20110528 Bath - Gundog";
dA[x++] = "20110529 Bath - Working/Pastoral";
dA[x++] = "20110530 Bath - Hound/Utility";
dA[x++] = "20110603 Southern Counties - Gundog/Utility";
dA[x++] = "20110604 Southern Counties - Hound/Terrier/Toy";
dA[x++] = "20110605 Southern Counties - Working/Pastoral";
dA[x++] = "20110608 Three Counties - Hound/Terrier";
dA[x++] = "20110609 Three Counties - Working/Toy";
dA[x++] = "20110610 Three Counties - Gundog";
dA[x++] = "20110611 Three Counties - Pastoral/Utility";
dA[x++] = "20110618 Border Union - Gundog/Hound/Terrier";
dA[x++] = "20110619 Border Union - Working/Pastoral/Utility/Toy";
dA[x++] = "20110624 Blackpool - Terrier/Utility/Toy";
dA[x++] = "20110625 Blackpool - Hound/Gundog";
dA[x++] = "20110626 Blackpool - Working/Pastoral";
dA[x++] = "20110630 Windsor - Terrier/Utility";
dA[x++] = "20110701 Windsor - Working/Pastoral";
dA[x++] = "20110702 Windsor - Gundog";
dA[x++] = "20110703 Windsor - Hound/Toy";
dA[x++] = "20110708 East of England - Gundog/Utility";
dA[x++] = "20110709 East of England - Working/Pastoral";
dA[x++] = "20110710 East of England - Hound/Terrier/Toy";
dA[x++] = "20110716 National Working and Pastoral Breeds";
dA[x++] = "20110722 Leeds - Hound/Gundog";
dA[x++] = "20110723 Leeds - Working/Pastoral";
dA[x++] = "20110724 Leeds - Utility/Toy/Terrier";
dA[x++] = "20110801 Paignton - Working/Pastoral/Terrier";
dA[x++] = "20110802 Paignton - Gundog/Utility";
dA[x++] = "20110803 Paignton - Hound/Toy";
dA[x++] = "20110806 Hound Assocition - National Gundog";
dA[x++] = "20110813 Bournemounth - Hound/Toy";
dA[x++] = "20110814 Bournemounth - Terrier/Working/Pastoral";
dA[x++] = "20110815 Bournemounth - Utility/Gundog";
dA[x++] = "20110819 Welsh Kennel Club - Hound/Toy";
dA[x++] = "20110820 Welsh Kennel Club - Terrier/Working/Pastoral/Obedience";
dA[x++] = "20110821 Welsh Kennel Club - Gundog/Utility";
dA[x++] = "20110827 Scottish Kennel Club - Working/Pastoral/Utility/Toy";
dA[x++] = "20110828 Scottish Kennel Club - Terrier/Gundog/Hound";
dA[x++] = "20110902 City of Birmingham - Hound/Toy";
dA[x++] = "20110903 City of Birmingham - Working/Pastoral/Terrier";
dA[x++] = "20110904 City of Birmingham - Gundog/Utility";
dA[x++] = "20110909 Richmond - Hound/Toy";
dA[x++] = "20110910 Richmond - Working/Pastoral/Terrier";
dA[x++] = "20110911 Richmond - Gundog/Utility";
dA[x++] = "20110916 Darlington - Hound/Terrier/Utility";
dA[x++] = "20110917 Darlington - Working/Pastoral";
dA[x++] = "20110918 Darlington - Gundog/Toy";
dA[x++] = "20110924 Belfast - Hound/Gundog/Terrier";
dA[x++] = "20110925 Belfast - Utility/Working/Pastoral/Terrier";
dA[x++] = "20110929 Driffield - Working/Pastoral";
dA[x++] = "20110930 Driffield - Gundog";
dA[x++] = "20111001 Driffield - Hound/Terrier";
dA[x++] = "20111002 Driffield - Toy/Utility";
dA[x++] = "20111007 South Wales - Gundog/Toy";
dA[x++] = "20111008 South Wales - Working/Utility";
dA[x++] = "20111009 South Wales - Hound/Terrier/Pastoral";
dA[x++] = "20111012 Gundog Society of Wales";
dA[x++] = "20111027 Midland Counties - Toy/Utility";
dA[x++] = "20111028 Midland Counties - Gundog";
dA[x++] = "20111029 Midland Counties - Hound/Pastoral";
dA[x++] = "20111030 Midland Counties - Working/Terrier";
dA[x++] = "20111105 Working and Pastoral Breeds of Scotland - Pastoral";
dA[x++] = "20111106 Working and Pastoral Breeds of Scotland - Working";
dA[x++] = "20111112 Gundog Breeds of Scotland";
dA[x++] = "20111203 British Utility Breeds Association";
dA[x++] = "20111210 Ladies Kennel Association - Terrier/Gundog/Hound";
dA[x++] = "20111211 Ladies Kennel Association - Toy/Utility/Pastoral/Working";
dA[x++] = "20120106 Boston & DCS - Gundog";
dA[x++] = "20120107 Boston & DCS - Hound/Pastoral/Working";
dA[x++] = "20120108 Boston & DCS - Utility/Toy/Terrier";
dA[x++] = "20120119 Manchester Dog Show - Terrier/Hound";
dA[x++] = "20120120 Manchester Dog Show - Utility/Toy";
dA[x++] = "20120121 Manchester Dog Show - Working/Pastoral";
dA[x++] = "20120122 Manchester Dog Show - Gundog";
dA[x++] = "20120308 Crufts - Utility/Toy";
dA[x++] = "20120309 Crufts - Gundog/Obedience";
dA[x++] = "20120310 Crufts - Working/Pastoral/Obedience";
dA[x++] = "20120311 Crufts - Hound/Terrier/Agility";
dA[x++] = "20120331 Scottish Breeds - UK Toydog";
dA[x++] = "20120407 National Terrier";
dA[x++] = "20120414 Hound Association of Scotland";
dA[x++] = "20120421 Working and Pastoral Breeds of Wales";
dA[x++] = "20120427 West of England Ladies Kennel Society - Utility/Pastoral";
dA[x++] = "20120428 West of England Ladies Kennel Society - Hound/Working/Terrier";
dA[x++] = "20120429 West of England Ladies Kennel Society - Gundog/Toy";
dA[x++] = "20120510 Birmingham National - Gundog";
dA[x++] = "20120511 Birmingham National - Working/Pastoral";
dA[x++] = "20120512 Birmingham National - Utility/Toy";
dA[x++] = "20120513 Birmingham National - Hound/Terrier";
dA[x++] = "20120518 Scottish Kennel Club - Gundog/Utility";
dA[x++] = "20120519 Scottish Kennel Club - Hound/Terrier/Toy/Obedience";
dA[x++] = "20120520 Scottish Kennel Club - Working/Pastoral/Agility";
dA[x++] = "20120525 Bath - Terrier/Toy";
dA[x++] = "20120526 Bath - Gundog";
dA[x++] = "20120527 Bath - Working/Pastoral";
dA[x++] = "20120528 Bath - Hound/Utility";
dA[x++] = "20120601 Southern Counties - Gundog/Utility";
dA[x++] = "20120602 Southern Counties - Hound/Terrier/Toy";
dA[x++] = "20120603 Southern Counties - Working/Pastoral";
dA[x++] = "20120607 Three Counties - Working/Toy";
dA[x++] = "20120608 Three Counties - Gundog";
dA[x++] = "20120609 Three Counties - Pastoral/Utility";
dA[x++] = "20120610 Three Counties - Hound/Terrier";
dA[x++] = "20120616 Border Union - Working/Pastoral/Utility/Toy";
dA[x++] = "20120617 Border Union - Gundog/Hound/Terrier";
dA[x++] = "20120622 Blackpool - Terrier/Utility/Toy";
dA[x++] = "20120623 Blackpool - Hound/Gundog";
dA[x++] = "20120624 Blackpool - Working/Pastoral";
dA[x++] = "20120628 Windsor - Working/Pastoral";
dA[x++] = "20120629 Windsor - Gundog";
dA[x++] = "20120630 Windsor - Hound/Toy";
dA[x++] = "20120701 Windsor - Terrier/Utility";
dA[x++] = "20120706 East of England - Hound/Terrier/Toy";
dA[x++] = "20120707 East of England - Gundog/Utility";
dA[x++] = "20120708 East of England - Working/Pastoral";
dA[x++] = "20120714 National Working and Pastoral Breeds";
dA[x++] = "20120727 Leeds - Utility/Toy/Terrier";
dA[x++] = "20120728 Leeds - Hound/Gundog";
dA[x++] = "20120729 Leeds - Working/Pastoral";
dA[x++] = "20120804 Hound Assocition - National Gundog";
dA[x++] = "20120805 Paignton - Gundog";
dA[x++] = "20120806 Paignton - Working/Pastoral";
dA[x++] = "20120807 Paignton - Terrier/Utility";
dA[x++] = "20120808 Paignton - Hound/Toy";
dA[x++] = "20120811 Bournemounth - Utility/Gundog";
dA[x++] = "20120812 Bournemounth - Toy/Hound";
dA[x++] = "20120813 Bournemounth - Terrier/Working/Pastoral";
dA[x++] = "20120817 Welsh Kennel Club - Hound/Toy";
dA[x++] = "20120818 Welsh Kennel Club - Terrier/Working/Pastoral/Obedience";
dA[x++] = "20120819 Welsh Kennel Club - Gundog/Utility";
dA[x++] = "20120825 Scottish Kennel Club - Terrier/Gundog/Hound";
dA[x++] = "20120826 Scottish Kennel Club - Working/Pastoral/Utility/Toy";
dA[x++] = "20120831 City of Birmingham - Hound/Toy";
dA[x++] = "20120901 City of Birmingham - Working/Pastoral/Terrier";
dA[x++] = "20120902 City of Birmingham - Gundog/Utility";
dA[x++] = "20120907 Richmond - Hound/Toy";
dA[x++] = "20120908 Richmond - Working/Pastoral/Terrier";
dA[x++] = "20120909 Richmond - Gundog/Utility";
dA[x++] = "20120914 Darlington - Hound/Terrier/Utility";
dA[x++] = "20120915 Darlington - Working/Pastoral";
dA[x++] = "20120916 Darlington - Gundog/Toy";
dA[x++] = "20120920 Driffield - Working/Pastoral";
dA[x++] = "20120921 Driffield - Gundog";
dA[x++] = "20120922 Driffield - Hound/Terrier";
dA[x++] = "20120923 Driffield - Toy/Utility";
dA[x++] = "20120929 Belfast - Hound/Gundog/Terrier";
dA[x++] = "20120930 Belfast - Utility/Working/Pastoral/Terrier";
dA[x++] = "20121012 South Wales - Working/Pastoral";
dA[x++] = "20121013 South Wales - Toy/Hound/Terrier";
dA[x++] = "20121014 South Wales - Gundog/Utility";
dA[x++] = "20121017 Gundog Society of Wales";
dA[x++] = "20121025 Midland Counties - Working/Terrier";
dA[x++] = "20121026 Midland Counties - Toy/Utility";
dA[x++] = "20121027 Midland Counties - Gundog";
dA[x++] = "20121028 Midland Counties - Hound/Pastoral";
dA[x++] = "20121103 Working and Pastoral Breeds of Scotland - Pastoral";
dA[x++] = "20121104 Working and Pastoral Breeds of Scotland - Working";
dA[x++] = "20121110 Gundog Breeds of Scotland";
dA[x++] = "20121201 British Utility Breeds Association";
dA[x++] = "20121215 Ladies Kennel Association - Toy/Utility/Pastoral/Working";
dA[x++] = "20121216 Ladies Kennel Association - Terrier/Gundog/Hound";



// 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 = ['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;}
