// Event Calendar
// copyright Stephen Chapman, 10th June 2006, 30th October 2006

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 = '#336666'; // text colour
var linkclr = '#FFFFFF'; // link text colour
var noMessage =  'No events 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++] = "20120201 11:30am-1:00 Brant & Helms chapters 15-16;1:00-2:00 pm Dr. Mody's, Gastritis; 2:00-3:00 Dr. Smith, Chest Infections; 3:00-4:00 pm Dr. Smith, Bugles & Seagulls (ss)";
dA[x++] = "20120202 12:30-1:30pm Dr. Liu  Lecture";
dA[x++] = "20120203 12:30pm CHM - Conference Auditorium Main Floor Lecture";
dA[x++] = "20120204 ";
dA[x++] = "20120205 ";
dA[x++] = "20120206 12:30pm Dr. Malay Lecture";
dA[x++] = "20120207 12:30pm Dr. Lee Lecture";
dA[x++] = "20120208 11:30am-1:00 Brant & Helms (ms)Chapters 17-19;1:00-2:00 pm Journal Club, Dr.R.Kapadia & Dr. J.Critchfield (ss); 2:30-3:30 pm Dr. Mastromatteo septic arthritis/abscess; 3:40-4:45 pm Dr. John Kalabat 'Infection and Inflammation with Gallium for WBC; scanning' ";
dA[x++] = "20120209 12:30pm Dr. Zerin Lecture";
dA[x++] = "20120210 12:30pm CHM - Conference Auditorium Main Floor";
dA[x++] = "20120211 ";
dA[x++] = "20120212 ";
dA[x++] = "20120213 12:30pm Dr. M Shah (Teleconferenced from S-G)";
dA[x++] = "20120214 12:30pm Dr. Zuk Lecture";
dA[x++] = "20120215 11:30am-1:00 Brant & Helms Chapters 21-23; 1:00-2:00 pm CQI-Dose Reduction to Anterior Surfaces With Organ-Based Tube-Current Modulation:Evaluation of Performance in a Phantom Study and Pt.Safety Event Reporting in a Large Radiology Department; 2:15-3:15 Dr.Altinok, Spine and Spinal Cord Malformations; 3:15-4:15 Dr. Li, Breast MRI (ss) ";
dA[x++] = "20120216 12:30pm pm Dr. Butros Lecture";
dA[x++] = "20120217 12:30pm CHM - Conference Auditorium Main Floor";
dA[x++] = "20120218 ";
dA[x++] = "20120219 ";
dA[x++] = "20120220 12:30pm Dr. Jain Lecture";
dA[x++] = "20120221 12:30pm Dr. Danny Ma Lecture";
dA[x++] = "20120222 11:30am-1:00 Brant & Helms (ms)Chapters 24-25; 1:00-2:00 pm Review of the AAPM/RSNA module 'Radionuclide Dosimetry and Nuclear Regulations,' Dr. Joyrich (ss); 2:00-3:00 Dr. Zak, Multiple Sclerosis (ss)";
dA[x++] = "20120223 12:30-1:30pm Dr. Thummula  Lecture";
dA[x++] = "20120224 12:30pm Dr. Hanson Lecture";
dA[x++] = "20120225 ";
dA[x++] = "20120226 ";
dA[x++] = "20120227 12:30pm Dr. Danrad Lecture";
dA[x++] = "20120228 12:30pm Dr. Abdallah Lecture";
dA[x++] = "20120229 11:30-1:00 Brant & Helms Chapters 34-36;1:00-2:00 pm Review of the AAPM/RSNA module 'Nuclear Medicine:Principles and Radiopharmaceuticals,' Dr. Joyrich (ss); 2:00-3:00 Dr. Mody's lecture; 3:15-4:15 pm Dr. Johnson - anatomy (mk)";

dA[x++] = "20111101 12:30 pm Dr. Abdallah Lecture";
dA[x++] = "20111102 1:00-5:00 pm Visiting Professor, Hosted by St. Joseph Mercy, Dr. Myron Pozniak, Professor of Radiology, University of WI-Ultrasound (ss)";
dA[x++] = "20111103 11:30-1:00 Brant & Helms Chapters 26-29";
dA[x++] = "20111104 12:30 pm CHM - Conference Auditorium Main Floor";
dA[x++] = "20111105 ";
dA[x++] = "20111106 ";
dA[x++] = "20111107 12:30 pm Dr. S. Chander (Teleconferenced from S-G)";
dA[x++] = "20111108 12:30 Dr. S. Johnson Lecture";
dA[x++] = "20111109 11:30-1:00 Brant & Helms Chapters 30-33; 1:00-2:00 pm Program Director/Chair's Meeting; 2:15-3:15 Journal Club, Moderators- Dr. Slovis: 'Dose Reduction to Anterior Surfaces with Organ-Based Tube-Current Modulation: Evaluation of Performance in a Phantom Study' w/Drs.Ahuja & Elnasif; Dr.Joyrich: 'Fears,Feelings and Facts: Interactively Communicating Benefits and Risks of Medical Radiation with Patients w/Drs. Sattar & G. Altinok; 3:20-4:20 pm Dr. Lee Head and Neck Cancer (mk) ";
dA[x++] = "20111110 12:30 pm Dr. Ambereen Khan Lecture";
dA[x++] = "20111111 12:30 pm CHM - Auditorium";
dA[x++] = "20111112 ";
dA[x++] = "20111113 ";
dA[x++] = "20111114 12:30 pm Dr. Al Hihi Lecture";
dA[x++] = "20111115 12:30 Dr. Hillman Lecture";
dA[x++] = "20111116 11:30-1:00 Brant & Helms Chapters 34-36;1:00-2:00 pm Review of the AAPM/RSNA module 'Nuclear Medicine:Principles and Radiopharmaceuticals,' Dr. Joyrich (ss); 2:00-3:00 Dr. Mody's lecture; 3:15-4:15 pm Dr. Johnson - anatomy (mk)";
dA[x++] = "20111117 12:30 pm Dr. Grigorian Lecture";
dA[x++] = "20111118 12:30 pm 12:30 pm Dr. Vollmer Lecture ";
dA[x++] = "20111119 ";
dA[x++] = "20111120 ";
dA[x++] = "20111121 12:30 pm Guest lecturer: Dr. Mark D. Kettler, OHSU, Portland,Oregon ";
dA[x++] = "20111122 12:30 pm Dr. Sangharat Lecture";
dA[x++] = "20111123 11:30-1:00 Brant & Helms (ms)Chapters 37-39; 1:00-2:00 pm CQI-cases; 2:00-3:00 pm, Dr. K. Tech, Imaging of the Pituitary (ss)";
dA[x++] = "20111124 Thanksgiving No Conference";
dA[x++] = "20111125 No Conference";
dA[x++] = "20111126 ";
dA[x++] = "20111127 ";
dA[x++] = "20111128 RSNA - No Conference";
dA[x++] = "20111129 RSNA - No Conference";
dA[x++] = "20111130 RSNA - No Conference";

// 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;height:150px;width:238px"><table border="1" 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 #336666; 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;}
